migrate: Remove 'max downtime' support

This is only needed when people have very specific downtime constraints
on public facing services. I don't think that covers many virt-manager
users. So suggest they just use the command line for this.
This commit is contained in:
Cole Robinson 2015-04-15 18:25:53 -04:00
parent 39dc0c7b94
commit 2b877cf337
3 changed files with 14 additions and 191 deletions

View File

@ -7,17 +7,6 @@
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
<object class="GtkAdjustment" id="adjustment2">
<property name="upper">10000</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
<object class="GtkAdjustment" id="adjustment3">
<property name="upper">1000000</property>
<property name="value">30</property>
<property name="step_increment">1</property>
<property name="page_increment">1000</property>
</object>
<object class="GtkWindow" id="vmm-migrate">
<property name="can_focus">False</property>
<property name="title" translatable="yes">Migrate the virtual machine</property>
@ -290,122 +279,6 @@
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="migrate-maxdowntime-box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">3</property>
<child>
<object class="GtkAlignment" id="alignment4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">6</property>
<child>
<object class="GtkLabel" id="label15">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Max downtime:</property>
<property name="use_markup">True</property>
<property name="use_underline">True</property>
<property name="xalign">1</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="migrate-set-maxdowntime">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_migrate_set_maxdowntime_toggled" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox8">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkHBox" id="hbox9">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkSpinButton" id="migrate-max-downtime">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="adjustment">adjustment3</property>
<property name="snap_to_ticks">True</property>
<property name="numeric">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label16">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">ms</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkAlignment" id="alignment6">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame1">
<property name="visible">True</property>
@ -557,7 +430,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
<property name="position">2</property>
</packing>
</child>
</object>
@ -637,4 +510,15 @@
</object>
</child>
</object>
<object class="GtkAdjustment" id="adjustment2">
<property name="upper">10000</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
<object class="GtkAdjustment" id="adjustment3">
<property name="upper">1000000</property>
<property name="value">30</property>
<property name="step_increment">1</property>
<property name="page_increment">1000</property>
</object>
</interface>

View File

@ -1492,13 +1492,6 @@ class vmmDomain(vmmLibvirtObject):
self._has_managed_save = None
def support_downtime(self):
return self.conn.check_support(
self.conn.SUPPORT_DOMAIN_MIGRATE_DOWNTIME, self._backend)
def migrate_set_max_downtime(self, max_downtime, flag=0):
self._backend.migrateSetMaxDowntime(max_downtime, flag)
def migrate(self, destconn, interface=None,
live=False, secure=False, unsafe=False, meter=None):
self._install_abort = True

View File

@ -55,7 +55,6 @@ class vmmMigrateDialog(vmmGObjectUI):
"on_migrate_dest_changed" : self.destconn_changed,
"on_migrate_set_interface_toggled" : self.toggle_set_interface,
"on_migrate_set_port_toggled" : self.toggle_set_port,
"on_migrate_set_maxdowntime_toggled" : self.toggle_set_maxdowntime,
})
self.bind_escape_key_close()
@ -119,21 +118,10 @@ class vmmMigrateDialog(vmmGObjectUI):
self.widget("migrate-set-interface").set_active(False)
self.widget("migrate-set-port").set_active(False)
self.widget("migrate-set-maxdowntime").set_active(False)
self.widget("migrate-max-downtime").set_value(30)
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()
downtime_tooltip = ""
if not support_downtime:
downtime_tooltip = _("Libvirt version does not support setting "
"downtime.")
downtime_box.set_sensitive(support_downtime)
downtime_box.set_tooltip_text(downtime_tooltip)
if self.conn.is_xen():
# Default xen port is 8002
self.widget("migrate-port").set_value(8002)
@ -184,10 +172,6 @@ class vmmMigrateDialog(vmmGObjectUI):
self.widget("migrate-set-port").set_sensitive(enable)
self.widget("migrate-port").set_sensitive(enable and port_enable)
def toggle_set_maxdowntime(self, src):
enable = src.get_active()
self.widget("migrate-max-downtime").set_sensitive(enable)
def toggle_set_port(self, src):
enable = src.get_active()
self.widget("migrate-port").set_sensitive(enable)
@ -198,20 +182,12 @@ class vmmMigrateDialog(vmmGObjectUI):
return None
return row[1]
def get_config_max_downtime(self):
if not self.get_config_max_downtime_enabled():
return 0
return int(self.widget("migrate-max-downtime").get_value())
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()
def get_config_interface_enabled(self):
return self.widget("migrate-interface").get_sensitive()
def get_config_interface(self):
@ -391,10 +367,6 @@ class vmmMigrateDialog(vmmGObjectUI):
def validate(self):
interface = self.get_config_interface()
port = self.get_config_port()
max_downtime = self.get_config_max_downtime()
if self.get_config_max_downtime_enabled() and max_downtime == 0:
return self.err.val_err(_("max downtime must be greater than 0."))
if self.get_config_interface_enabled() and interface is None:
return self.err.val_err(_("An interface must be specified."))
@ -428,7 +400,6 @@ class vmmMigrateDialog(vmmGObjectUI):
srcuri = self.vm.conn.get_uri()
srchost = self.vm.conn.get_hostname()
dsthost = destconn.get_qualified_hostname()
max_downtime = self.get_config_max_downtime()
secure = self.get_config_secure()
unsafe = self.get_config_unsafe()
uri = self.build_migrate_uri(destconn, srcuri)
@ -449,7 +420,7 @@ class vmmMigrateDialog(vmmGObjectUI):
progWin = vmmAsyncJob(
self._async_migrate,
[self.vm, destconn, uri, live, secure, unsafe, max_downtime],
[self.vm, destconn, uri, live, secure, unsafe],
self._finish_cb, [destconn],
_("Migrating VM '%s'" % self.vm.get_name()),
(_("Migrating VM '%s' from %s to %s. This may take a while.") %
@ -457,21 +428,6 @@ class vmmMigrateDialog(vmmGObjectUI):
self.topwin, cancel_cb=cancel_cb)
progWin.run()
def _async_set_max_downtime(self, vm, max_downtime, migrate_thread):
if not migrate_thread.isAlive():
return False
try:
vm.migrate_set_max_downtime(max_downtime, 0)
return False
except libvirt.libvirtError, e:
if (isinstance(e, libvirt.libvirtError) and
e.get_error_code() == libvirt.VIR_ERR_OPERATION_INVALID):
# migration has not been started, wait 100 milliseconds
return True
logging.warning("Error setting migrate downtime: %s", e)
return False
def cancel_migration(self, asyncjob, vm):
logging.debug("Cancelling migrate job")
if not vm:
@ -489,7 +445,7 @@ class vmmMigrateDialog(vmmGObjectUI):
def _async_migrate(self, asyncjob,
origvm, origdconn, migrate_uri, live,
secure, unsafe, max_downtime):
secure, unsafe):
meter = asyncjob.get_meter()
srcconn = origvm.conn
@ -501,14 +457,4 @@ class vmmMigrateDialog(vmmGObjectUI):
logging.debug("Migrating vm=%s from %s to %s", vm.get_name(),
srcconn.get_uri(), dstconn.get_uri())
timer = None
if max_downtime != 0:
# 0 means that the spin box migrate-max-downtime does not
# be enabled.
current_thread = threading.currentThread()
timer = self.timeout_add(100, self._async_set_max_downtime,
vm, max_downtime, current_thread)
vm.migrate(dstconn, migrate_uri, live, secure, unsafe, meter=meter)
if timer:
self.idle_add(GLib.source_remove, timer)