Skip to content

Commit 74a618a

Browse files
committed
Adds a repoducer for post live migration fail
Adds a regression test or repoducer for post live migration fail at destination, the possible casue can be fail to get instance network info or block device info changes: adds updating server after _live_migrate in reproducer test (missed in main commit) Related-Bug: #1628606 Change-Id: I48dbe0aae8a3943fdde69cda1bd663d70ea0eb19 (cherry picked from commit a20baec)
1 parent c3489ed commit 74a618a

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
2+
# not use this file except in compliance with the License. You may obtain
3+
# a copy of the License at
4+
#
5+
# http://www.apache.org/licenses/LICENSE-2.0
6+
#
7+
# Unless required by applicable law or agreed to in writing, software
8+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10+
# License for the specific language governing permissions and limitations
11+
# under the License.
12+
13+
from nova import test
14+
from nova.tests import fixtures as nova_fixtures
15+
from nova.tests.functional.api import client
16+
from nova.tests.functional import fixtures as func_fixtures
17+
from nova.tests.functional import integrated_helpers
18+
from unittest import mock
19+
20+
21+
class PostLiveMigrationFail(
22+
test.TestCase, integrated_helpers.InstanceHelperMixin):
23+
"""Regression test for bug 1628606
24+
"""
25+
26+
def setUp(self):
27+
super().setUp()
28+
self.useFixture(nova_fixtures.NeutronFixture(self))
29+
self.glance = self.useFixture(nova_fixtures.GlanceFixture(self))
30+
self.useFixture(func_fixtures.PlacementFixture())
31+
self.useFixture(nova_fixtures.HostNameWeigherFixture())
32+
33+
self.start_service('conductor')
34+
self.start_service('scheduler')
35+
36+
api_fixture = self.useFixture(nova_fixtures.OSAPIFixture(
37+
api_version='v2.1'))
38+
39+
self.api = api_fixture.admin_api
40+
self.api.microversion = 'latest'
41+
42+
self.src = self._start_compute(host='host1')
43+
self.dest = self._start_compute(host='host2')
44+
45+
@mock.patch(
46+
'nova.compute.manager.ComputeManager'
47+
'._post_live_migration_remove_source_vol_connections')
48+
def test_post_live_migration(self, mock_migration):
49+
server = self._create_server(networks=[])
50+
self.assertEqual(self.src.host, server['OS-EXT-SRV-ATTR:host'])
51+
52+
error = client.OpenStackApiException(
53+
"Failed to remove source vol connection post live migration")
54+
mock_migration.side_effect = error
55+
56+
server = self._live_migrate(
57+
server, migration_expected_state='error',
58+
server_expected_state='ERROR')
59+
# FIXME(amit): this should point to the dest as after migration
60+
# but does not because of bug 1628606
61+
self.assertEqual(self.src.host, server['OS-EXT-SRV-ATTR:host'])

0 commit comments

Comments
 (0)