[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [virt-tools-list] [Patch V2] Add virDomainSetMigrateMaxDowntime support



At 2010-11-30 08:15, Cole Robinson Write:
> 
> Hmm, I didn't think of that. I've pushed a change to virtinst now that
> should practically eliminate the likelihood of side effects:
> 
> http://hg.fedorahosted.org/hg/python-virtinst/rev/df54d069af85
> 
> I'd be interested in a follow up patch to clean up these comments, and
> use the support check earlier in the migrate dialog.
> 
> Thanks,
> Cole
> 

# HG changeset patch
# User Wen Congyang <wency cn fujitsu com>
# Date 1291087313 -28800
# Node ID 85433ed45ba949b868457ef67d6cae42158dae80
# Parent  6437bc731bb0d32bcc127184a6d69258c043a542
check whether the domain supports downtime early

diff -r 6437bc731bb0 -r 85433ed45ba9 src/virtManager/domain.py
--- a/src/virtManager/domain.py	Mon Nov 29 16:58:23 2010 +0800
+++ b/src/virtManager/domain.py	Tue Nov 30 11:21:53 2010 +0800
@@ -858,8 +858,6 @@
         return self._backend.XMLDesc(flags)
 
     def support_downtime(self):
-        # Note: this function has side effect
-        # if domain supports downtime, the downtime may be overriden to 30ms
         return support.check_domain_support(self._backend,
                         support.SUPPORT_DOMAIN_MIGRATE_DOWNTIME)
 
diff -r 6437bc731bb0 -r 85433ed45ba9 src/virtManager/migrate.py
--- a/src/virtManager/migrate.py	Mon Nov 29 16:58:23 2010 +0800
+++ b/src/virtManager/migrate.py	Tue Nov 30 11:21:53 2010 +0800
@@ -146,6 +146,15 @@
         self.window.get_widget("migrate-rate").set_value(0)
         self.window.get_widget("migrate-secure").set_active(False)
 
+        downtime_box = self.window.get_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)
+        util.tooltip_wrapper(downtime_box, downtime_tooltip)
+
         if self.conn.is_xen():
             # Default xen port is 8002
             self.window.get_widget("migrate-port").set_value(8002)
@@ -497,13 +506,9 @@
                 logging.debug("Migrating vm=%s from %s to %s", vm.get_name(),
                               srcconn.get_uri(), dstconn.get_uri())
                 timer = None
-                if max_downtime != 0 and vm.support_downtime():
+                if max_downtime != 0:
                     # 0 means that the spin box migrate-max-downtime does not
                     # be enabled.
-                    #
-                    # We should check whether the domain supports downtime
-                    # early, but vm.support_downtime() has side effect, so
-                    # we check it only when user needs to modify downtime...
                     current_thread = threading.currentThread()
                     timer = util.safe_timeout_add(100,
                                                   self._async_set_max_downtime,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]