Change in vdsm[master]: virt: migration: always run migration monitor

fromani at redhat.com fromani at redhat.com
Fri Mar 21 10:49:06 UTC 2014


Francesco Romani has uploaded a new change for review.

Change subject: virt: migration: always run migration monitor
......................................................................

virt: migration: always run migration monitor

The migration monitor thread was run conditionally
if the migration monitor was specified.

This patch let the migration monitor always run.
If the migration monitor interval is disabled (= set to zero)
then the monitor thread will just sit idle.

This patch is a necessary step toward the unification
of MigrationMonitor and MigrationDowntime threads.

Change-Id: Ib4953ddda5a5c6c0ecd7ea0f95377309e18f771a
Signed-off-by: Francesco Romani <fromani at redhat.com>
---
M vdsm/migration.py
1 file changed, 17 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/75/25975/1

diff --git a/vdsm/migration.py b/vdsm/migration.py
index a684499..3699ca5 100644
--- a/vdsm/migration.py
+++ b/vdsm/migration.py
@@ -295,10 +295,9 @@
 
             t = MigrationDowntimeThread(self._vm, int(self._downtime))
 
-            if MigrationMonitorThread._MIGRATION_MONITOR_INTERVAL:
-                self._monitorThread = MigrationMonitorThread(self._vm,
-                                                             startTime)
-                self._monitorThread.start()
+            self._monitorThread = MigrationMonitorThread(self._vm,
+                                                         startTime)
+            self._monitorThread.start()
 
             try:
                 if ('qxl' in self._vm.conf['display'] and
@@ -327,8 +326,7 @@
 
             finally:
                 t.cancel()
-                if MigrationMonitorThread._MIGRATION_MONITOR_INTERVAL:
-                    self._monitorThread.stop()
+                self._monitorThread.stop()
 
     def stop(self):
         # if its locks we are before the migrateToURI2()
@@ -389,7 +387,17 @@
         self.daemon = True
         self.progress = 0
 
+    @property
+    def enabled(self):
+        return MigrationMonitorThread._MIGRATION_MONITOR_INTERVAL > 0
+
     def run(self):
+        if self.enabled:
+            self.monitor_migration()
+        else:
+            self.idle()
+
+    def monitor_migration(self):
         def calculateProgress(remaining, total):
             if remaining == 0:
                 return 100
@@ -455,6 +463,9 @@
                               ' data processed' %
                               (timeElapsed / 1000, self.progress))
 
+    def idle(self):
+        self._stop.wait(1.0)
+
     def stop(self):
         self._vm.log.debug('stopping migration monitor thread')
         self._stop.set()


-- 
To view, visit http://gerrit.ovirt.org/25975
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib4953ddda5a5c6c0ecd7ea0f95377309e18f771a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>


More information about the vdsm-patches mailing list