diff options
author | root <shrike_@mail.ru> | 2020-07-18 00:32:54 -0400 |
---|---|---|
committer | Billy Olsen <billy.olsen@gmail.com> | 2020-11-04 13:39:15 -0700 |
commit | afa843c8a7e128489a8245ed7a1b391c022b3305 (patch) | |
tree | 5372532e5fa09d42eb9abae61590dd50cb4ffaff /nova/tests/functional/regressions | |
parent | bea55a7d45bdc97679cf08c9faec789cfc90de27 (diff) | |
download | nova-afa843c8a7e128489a8245ed7a1b391c022b3305.tar.gz |
Set migrate_data.vifs only when using multiple port bindings
In the rocky cycle nova was enhanced to support the multiple
port binding live migration workflow when neutron supports
the binding-extended API extension.
When the migration_data object was extended to support
multiple port bindings, populating the vifs field was used
as a sentinel to indicate that the new workflow should
be used.
In the train release
I734cc01dce13f9e75a16639faf890ddb1661b7eb
(SR-IOV Live migration indirect port support)
broke the semantics of the migrate_data object by
unconditionally populating the vifs field
This change restores the rocky semantics, which are depended
on by several parts of the code base, by only conditionally
populating vifs if neutron supports multiple port bindings.
Changes to patch:
- unit/virt/libvirt/fakelibvirt.py: Include partial pick from
change Ia3d7351c1805d98bcb799ab0375673c7f1cb8848 to add the
jobStats, complete_job and fail_job to fakelibvirt. The full
change was not cherry-picked as it was part of the numa aware
live migration feature in Victoria.
Co-Authored-By: Sean Mooney <work@seanmooney.info>
Change-Id: Ia00277ac8a68a635db85f9e0ce2c6d8df396e0d8
Closes-Bug: #1888395
(cherry picked from commit b8f3be6b3c5af91d215b4a0cecb9be098e8d8799)
Diffstat (limited to 'nova/tests/functional/regressions')
-rw-r--r-- | nova/tests/functional/regressions/test_bug_1888395.py | 48 |
1 files changed, 39 insertions, 9 deletions
diff --git a/nova/tests/functional/regressions/test_bug_1888395.py b/nova/tests/functional/regressions/test_bug_1888395.py index f1626187da..214b82d3d1 100644 --- a/nova/tests/functional/regressions/test_bug_1888395.py +++ b/nova/tests/functional/regressions/test_bug_1888395.py @@ -12,6 +12,9 @@ import fixtures +from lxml import etree +from urllib import parse as urlparse + from nova import context from nova.network import constants as neutron_constants from nova.network import neutron @@ -69,6 +72,40 @@ class TestLiveMigrationWithoutMultiplePortBindings( kB_mem=10740000)}) self.ctxt = context.get_admin_context() + # TODO(sean-k-mooney): remove this when it is part of ServersTestBase + self.useFixture(fixtures.MonkeyPatch( + 'nova.tests.unit.virt.libvirt.fakelibvirt.Domain.migrateToURI3', + self._migrate_stub)) + + def _migrate_stub(self, domain, destination, params, flags): + """Stub out migrateToURI3.""" + + src_hostname = domain._connection.hostname + dst_hostname = urlparse.urlparse(destination).netloc + + # In a real live migration, libvirt and QEMU on the source and + # destination talk it out, resulting in the instance starting to exist + # on the destination. Fakelibvirt cannot do that, so we have to + # manually create the "incoming" instance on the destination + # fakelibvirt. + dst = self.computes[dst_hostname] + dst.driver._host.get_connection().createXML( + params['destination_xml'], + 'fake-createXML-doesnt-care-about-flags') + + src = self.computes[src_hostname] + conn = src.driver._host.get_connection() + + # because migrateToURI3 is spawned in a background thread, this method + # does not block the upper nova layers. Because we don't want nova to + # think the live migration has finished until this method is done, the + # last thing we do is make fakelibvirt's Domain.jobStats() return + # VIR_DOMAIN_JOB_COMPLETED. + server = etree.fromstring( + params['destination_xml'] + ).find('./uuid').text + dom = conn.lookupByUUIDString(server) + dom.complete_job() def test_live_migrate(self): server = self._create_server( @@ -88,14 +125,7 @@ class TestLiveMigrationWithoutMultiplePortBindings( } ) - # FIXME(sean-k-mooney): this should succeed but because of bug #188395 - # it will fail. - # self._wait_for_server_parameter( - # server, {'OS-EXT-SRV-ATTR:host': 'end_host', 'status': 'ACTIVE'}) - # because of the bug the migration will fail in pre_live_migrate so - # the vm should still be active on the start_host self._wait_for_server_parameter( - server, {'OS-EXT-SRV-ATTR:host': 'start_host', 'status': 'ACTIVE'}) - + server, {'OS-EXT-SRV-ATTR:host': 'end_host', 'status': 'ACTIVE'}) msg = "NotImplementedError: Cannot load 'vif_type' in the base class" - self.assertIn(msg, self.stdlog.logger.output) + self.assertNotIn(msg, self.stdlog.logger.output) |