diff --git a/ui/migrate.ui b/ui/migrate.ui index 3b81fbb8..cbbbc5ca 100644 --- a/ui/migrate.ui +++ b/ui/migrate.ui @@ -295,6 +295,53 @@ 0 + + + True + False + 6 + + + True + False + 6 + + + True + False + _Allow unsafe migration: + True + migrate-unsafe + + + False + True + 0 + + + + + True + True + False + False + True + + + False + True + 1 + + + + + + + True + True + 1 + + True @@ -408,7 +455,7 @@ True True - 1 + 2 @@ -659,7 +706,7 @@ False True - 2 + 3 diff --git a/virtManager/domain.py b/virtManager/domain.py index 2fc869ad..b0acd938 100644 --- a/virtManager/domain.py +++ b/virtManager/domain.py @@ -1323,7 +1323,7 @@ class vmmDomain(vmmLibvirtObject): self._backend.migrateSetMaxDowntime(max_downtime, flag) def migrate(self, destconn, interface=None, rate=0, - live=False, secure=False, meter=None): + live=False, secure=False, unsafe=False, meter=None): self._install_abort = True newname = None @@ -1336,6 +1336,9 @@ class vmmDomain(vmmLibvirtObject): flags |= libvirt.VIR_MIGRATE_PEER2PEER flags |= libvirt.VIR_MIGRATE_TUNNELLED + if unsafe: + flags |= libvirt.VIR_MIGRATE_UNSAFE + destconn = destconn.get_backend().libvirtconn logging.debug("Migrating: conn=%s flags=%s dname=%s uri=%s rate=%s", destconn, flags, newname, interface, rate) diff --git a/virtManager/migrate.py b/virtManager/migrate.py index 75dce354..f32dcf19 100644 --- a/virtManager/migrate.py +++ b/virtManager/migrate.py @@ -141,6 +141,7 @@ class vmmMigrateDialog(vmmGObjectUI): self.widget("migrate-rate").set_value(0) self.widget("migrate-secure").set_active(False) + self.widget("migrate-unsafe").set_active(False) downtime_box = self.widget("migrate-maxdowntime-box") support_downtime = self.vm.support_downtime() @@ -168,6 +169,16 @@ class vmmMigrateDialog(vmmGObjectUI): secure_box.set_sensitive(support_secure) secure_box.set_tooltip_text(secure_tooltip) + unsafe_box = self.widget("migrate-unsafe-box") + support_unsafe = hasattr(libvirt, "VIR_MIGRATE_UNSAFE") + unsafe_tooltip = "" + if not support_unsafe: + unsafe_tooltip = _("Libvirt version does not support unsafe " + "migration.") + + unsafe_box.set_sensitive(support_unsafe) + unsafe_box.set_tooltip_text(unsafe_tooltip) + self.rebuild_dest_rows() def set_state(self, vm): @@ -228,6 +239,9 @@ class vmmMigrateDialog(vmmGObjectUI): def get_config_secure(self): return self.widget("migrate-secure").get_active() + def get_config_unsafe(self): + return self.widget("migrate-unsafe").get_active() + def get_config_max_downtime_enabled(self): return self.widget("migrate-max-downtime").get_sensitive() @@ -464,6 +478,7 @@ class vmmMigrateDialog(vmmGObjectUI): max_downtime = self.get_config_max_downtime() live = not self.get_config_offline() secure = self.get_config_secure() + unsafe = self.get_config_unsafe() uri = self.build_migrate_uri(destconn, srcuri) rate = self.get_config_rate() if rate: @@ -485,7 +500,7 @@ class vmmMigrateDialog(vmmGObjectUI): progWin = vmmAsyncJob( self._async_migrate, - [self.vm, destconn, uri, rate, live, secure, max_downtime], + [self.vm, destconn, uri, rate, live, secure, unsafe, max_downtime], self._finish_cb, [destconn], _("Migrating VM '%s'" % self.vm.get_name()), (_("Migrating VM '%s' from %s to %s. This may take a while.") % @@ -525,7 +540,7 @@ class vmmMigrateDialog(vmmGObjectUI): def _async_migrate(self, asyncjob, origvm, origdconn, migrate_uri, rate, live, - secure, max_downtime): + secure, unsafe, max_downtime): meter = asyncjob.get_meter() srcconn = origvm.conn @@ -545,6 +560,6 @@ class vmmMigrateDialog(vmmGObjectUI): timer = self.timeout_add(100, self._async_set_max_downtime, vm, max_downtime, current_thread) - vm.migrate(dstconn, migrate_uri, rate, live, secure, meter=meter) + vm.migrate(dstconn, migrate_uri, rate, live, secure, unsafe, meter=meter) if timer: self.idle_add(GLib.source_remove, timer)