Skip to content

Commit 2be1570

Browse files
committed
Reproduce live migration rollback w/o multi port bindings error
When the libvirt driver does live migration rollback of an instance with network interfaces, it unconditionally refers to migrate_data.vifs. These will only be set when Neutron has the multiple port bindings extension. We don't handle the case of the extension not being present, and currently the rollback will fail with a "NotImplementedError: Cannot load 'vifs' in the base class" error. Related-bug: 1969980 Change-Id: Ieef773453ed9f3ced564c1a352fbefbcc6a653ec (cherry picked from commit 5181bae)
1 parent 1ac0d69 commit 2be1570

File tree

1 file changed

+38
-7
lines changed

1 file changed

+38
-7
lines changed

nova/tests/functional/regressions/test_bug_1888395.py

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,8 @@
2323
from nova.tests.functional.libvirt import base as libvirt_base
2424

2525

26-
class TestLiveMigrationWithoutMultiplePortBindings(
26+
class TestLiveMigrationWithoutMultiplePortBindingsBase(
2727
libvirt_base.ServersTestBase):
28-
"""Regression test for bug 1888395.
29-
30-
This regression test asserts that Live migration works when
31-
neutron does not support the binding-extended api extension
32-
and the legacy single port binding workflow is used.
33-
"""
3428

3529
ADMIN_API = True
3630
microversion = 'latest'
@@ -72,6 +66,16 @@ def setUp(self):
7266
'nova.tests.fixtures.libvirt.Domain.migrateToURI3',
7367
self._migrate_stub))
7468

69+
70+
class TestLiveMigrationWithoutMultiplePortBindings(
71+
TestLiveMigrationWithoutMultiplePortBindingsBase):
72+
"""Regression test for bug 1888395.
73+
74+
This regression test asserts that Live migration works when
75+
neutron does not support the binding-extended api extension
76+
and the legacy single port binding workflow is used.
77+
"""
78+
7579
def _migrate_stub(self, domain, destination, params, flags):
7680
"""Stub out migrateToURI3."""
7781

@@ -124,3 +128,30 @@ def test_live_migrate(self):
124128
server, {'OS-EXT-SRV-ATTR:host': 'end_host', 'status': 'ACTIVE'})
125129
msg = "NotImplementedError: Cannot load 'vif_type' in the base class"
126130
self.assertNotIn(msg, self.stdlog.logger.output)
131+
132+
133+
class TestLiveMigrationRollbackWithoutMultiplePortBindings(
134+
TestLiveMigrationWithoutMultiplePortBindingsBase):
135+
136+
def _migrate_stub(self, domain, destination, params, flags):
137+
source = self.computes['start_host']
138+
conn = source.driver._host.get_connection()
139+
dom = conn.lookupByUUIDString(self.server['id'])
140+
dom.fail_job()
141+
142+
def test_live_migration_rollback(self):
143+
self.server = self._create_server(
144+
host='start_host',
145+
networks=[{'port': self.neutron.port_1['id']}])
146+
147+
self.assertFalse(
148+
self.neutron_api.has_port_binding_extension(self.ctxt))
149+
# FIXME(artom) Until bug 1969980 is fixed, this will fail with a
150+
# NotImplementedError.
151+
self._live_migrate(self.server, migration_expected_state='error',
152+
server_expected_state='ERROR')
153+
server = self.api.get_server(self.server['id'])
154+
self.assertIn(
155+
"NotImplementedError: Cannot load 'vifs' in the base class",
156+
server['fault']['details']
157+
)

0 commit comments

Comments
 (0)