diff --git a/nova/conf/libvirt.py b/nova/conf/libvirt.py index 9e2cc08c7dc8..2046c350b738 100644 --- a/nova/conf/libvirt.py +++ b/nova/conf/libvirt.py @@ -423,7 +423,7 @@ The live-migration force complete API also uses post-copy when permitted. If post-copy mode is not available, force complete falls back to pausing the VM to ensure the live-migration operation will complete. -When using post-copy mode, if the source and destination hosts loose network +When using post-copy mode, if the source and destination hosts lose network connectivity, the VM being live-migrated will need to be rebooted. For more details, please see the Administration guide. diff --git a/nova/tests/unit/virt/libvirt/test_driver.py b/nova/tests/unit/virt/libvirt/test_driver.py index 8a1503c442d7..cfa4532f099e 100644 --- a/nova/tests/unit/virt/libvirt/test_driver.py +++ b/nova/tests/unit/virt/libvirt/test_driver.py @@ -1297,8 +1297,7 @@ class LibvirtConnTestCase(test.NoDBTestCase, libvirt_driver.libvirt.VIR_MIGRATE_NON_SHARED_INC | libvirt_driver.libvirt.VIR_MIGRATE_TLS)) - @mock.patch.object(host.Host, 'has_min_version', return_value=True) - def test_live_migration_permit_postcopy_true(self, host): + def test_live_migration_permit_postcopy_true(self): self.flags(live_migration_permit_post_copy=True, group='libvirt') self._do_test_parse_migration_flags( lm_expected=(libvirt_driver.libvirt.VIR_MIGRATE_UNDEFINE_SOURCE | @@ -1313,8 +1312,7 @@ class LibvirtConnTestCase(test.NoDBTestCase, libvirt_driver.libvirt.VIR_MIGRATE_NON_SHARED_INC | libvirt_driver.libvirt.VIR_MIGRATE_POSTCOPY)) - @mock.patch.object(host.Host, 'has_min_version', return_value=True) - def test_live_migration_permit_auto_converge_true(self, host): + def test_live_migration_permit_auto_converge_true(self): self.flags(live_migration_permit_auto_converge=True, group='libvirt') self._do_test_parse_migration_flags( lm_expected=(libvirt_driver.libvirt.VIR_MIGRATE_UNDEFINE_SOURCE | @@ -1329,9 +1327,7 @@ class LibvirtConnTestCase(test.NoDBTestCase, libvirt_driver.libvirt.VIR_MIGRATE_NON_SHARED_INC | libvirt_driver.libvirt.VIR_MIGRATE_AUTO_CONVERGE)) - @mock.patch.object(host.Host, 'has_min_version', return_value=True) - def test_live_migration_permit_auto_converge_and_post_copy_true(self, - host): + def test_live_migration_permit_auto_converge_and_post_copy_true(self): self.flags(live_migration_permit_auto_converge=True, group='libvirt') self.flags(live_migration_permit_post_copy=True, group='libvirt') self._do_test_parse_migration_flags( @@ -1347,43 +1343,6 @@ class LibvirtConnTestCase(test.NoDBTestCase, libvirt_driver.libvirt.VIR_MIGRATE_NON_SHARED_INC | libvirt_driver.libvirt.VIR_MIGRATE_POSTCOPY)) - @mock.patch.object(host.Host, 'has_min_version', return_value=False) - def test_live_migration_auto_converge_and_post_copy_true_old_libvirt( - self, min_ver): - self.flags(live_migration_permit_auto_converge=True, group='libvirt') - self.flags(live_migration_permit_post_copy=True, group='libvirt') - - self._do_test_parse_migration_flags( - lm_expected=(libvirt_driver.libvirt.VIR_MIGRATE_UNDEFINE_SOURCE | - libvirt_driver.libvirt.VIR_MIGRATE_PERSIST_DEST | - libvirt_driver.libvirt.VIR_MIGRATE_PEER2PEER | - libvirt_driver.libvirt.VIR_MIGRATE_LIVE | - libvirt_driver.libvirt.VIR_MIGRATE_AUTO_CONVERGE), - bm_expected=(libvirt_driver.libvirt.VIR_MIGRATE_UNDEFINE_SOURCE | - libvirt_driver.libvirt.VIR_MIGRATE_PERSIST_DEST | - libvirt_driver.libvirt.VIR_MIGRATE_PEER2PEER | - libvirt_driver.libvirt.VIR_MIGRATE_LIVE | - libvirt_driver.libvirt.VIR_MIGRATE_NON_SHARED_INC | - libvirt_driver.libvirt.VIR_MIGRATE_AUTO_CONVERGE)) - - min_ver.assert_called_with( - lv_ver=libvirt_driver.MIN_LIBVIRT_POSTCOPY_VERSION) - - @mock.patch.object(host.Host, 'has_min_version', return_value=False) - def test_live_migration_permit_postcopy_true_old_libvirt(self, host): - self.flags(live_migration_permit_post_copy=True, group='libvirt') - - self._do_test_parse_migration_flags( - lm_expected=(libvirt_driver.libvirt.VIR_MIGRATE_UNDEFINE_SOURCE | - libvirt_driver.libvirt.VIR_MIGRATE_PERSIST_DEST | - libvirt_driver.libvirt.VIR_MIGRATE_PEER2PEER | - libvirt_driver.libvirt.VIR_MIGRATE_LIVE), - bm_expected=(libvirt_driver.libvirt.VIR_MIGRATE_UNDEFINE_SOURCE | - libvirt_driver.libvirt.VIR_MIGRATE_PERSIST_DEST | - libvirt_driver.libvirt.VIR_MIGRATE_PEER2PEER | - libvirt_driver.libvirt.VIR_MIGRATE_LIVE | - libvirt_driver.libvirt.VIR_MIGRATE_NON_SHARED_INC)) - def test_live_migration_permit_postcopy_false(self): self._do_test_parse_migration_flags( lm_expected=(libvirt_driver.libvirt.VIR_MIGRATE_UNDEFINE_SOURCE | diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index f4a9a3f1f2bf..bbb201f3b3ed 100644 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -247,9 +247,6 @@ QEMU_MAX_SERIAL_PORTS = 4 # Qemu supports 4 serial consoles, we remove 1 because of the PTY one defined ALLOWED_QEMU_SERIAL_PORTS = QEMU_MAX_SERIAL_PORTS - 1 -# libvirt postcopy support -MIN_LIBVIRT_POSTCOPY_VERSION = (1, 3, 3) - MIN_LIBVIRT_OTHER_ARCH = { fields.Architecture.AARCH64: MIN_LIBVIRT_KVM_AARCH64_VERSION, } @@ -719,25 +716,17 @@ class LibvirtDriver(driver.ComputeDriver): migration_flags |= libvirt.VIR_MIGRATE_TLS return migration_flags - def _is_post_copy_available(self): - return self._host.has_min_version(lv_ver=MIN_LIBVIRT_POSTCOPY_VERSION) - def _is_native_luks_available(self): return self._host.has_min_version(MIN_LIBVIRT_LUKS_VERSION, MIN_QEMU_LUKS_VERSION) def _handle_live_migration_post_copy(self, migration_flags): if CONF.libvirt.live_migration_permit_post_copy: - if self._is_post_copy_available(): - migration_flags |= libvirt.VIR_MIGRATE_POSTCOPY - else: - LOG.info('The live_migration_permit_post_copy is set ' - 'to True, but it is not supported.') + migration_flags |= libvirt.VIR_MIGRATE_POSTCOPY return migration_flags def _handle_live_migration_auto_converge(self, migration_flags): - if (self._is_post_copy_available() and - (migration_flags & libvirt.VIR_MIGRATE_POSTCOPY) != 0): + if self._is_post_copy_enabled(migration_flags): LOG.info('The live_migration_permit_post_copy is set to ' 'True and post copy live migration is available ' 'so auto-converge will not be in use.') @@ -8062,10 +8051,7 @@ class LibvirtDriver(driver.ComputeDriver): instance=instance) def _is_post_copy_enabled(self, migration_flags): - if self._is_post_copy_available(): - if (migration_flags & libvirt.VIR_MIGRATE_POSTCOPY) != 0: - return True - return False + return (migration_flags & libvirt.VIR_MIGRATE_POSTCOPY) != 0 def live_migration_force_complete(self, instance): try: