Milan Zamazal has uploaded a new change for review.

Change subject: virt: Fetch only minimum VM stats during post-copy migration
......................................................................

virt: Fetch only minimum VM stats during post-copy migration

When a migration switches to post-copy mode, the VM starts running on
the destination.  Libvirt no longer provides actual stats on the source,
with the exception of progress, which is still available on the source
and only on the source.

This patch stops reporting stats other than progress during post-copy
migration.

Change-Id: Iac3da08b0816e7a9a247969147c17b15518c7624
Signed-off-by: Milan Zamazal <mzama...@redhat.com>
Bug-Url: https://bugzilla.redhat.com/1354343
---
M vdsm/virt/migration.py
M vdsm/virt/vm.py
2 files changed, 21 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/52/63552/8

diff --git a/vdsm/virt/migration.py b/vdsm/virt/migration.py
index 13f2155..63cdf8c 100644
--- a/vdsm/virt/migration.py
+++ b/vdsm/virt/migration.py
@@ -149,6 +149,11 @@
     def hibernating(self):
         return self._mode == MODE_FILE
 
+    @property
+    def in_post_copy(self):
+        return (self._monitorThread is not None and
+                self._monitorThread.in_post_copy)
+
     def getStat(self):
         """
         Get the status of the migration.
@@ -653,6 +658,10 @@
     def enabled(self):
         return MonitorThread._MIGRATION_MONITOR_INTERVAL > 0
 
+    @property
+    def in_post_copy(self):
+        return self._in_post_copy
+
     @utils.traceback()
     def run(self):
         if self.enabled:
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index e274388..f32d119 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -1198,10 +1198,15 @@
         if self.lastStatus == vmstatus.DOWN:
             stats.update(self._getDownVmStats())
         else:
-            stats.update(self._getConfigVmStats())
-            stats.update(self._getRunningVmStats())
+            if self.isMigrating() and self._migrationSourceThread.in_post_copy:
+                # Stats are on the destination during post-copy migration,
+                # except for migration progress, which is always on the source.
+                stats['migrationProgress'] = self._get_vm_migration_progress()
+            else:
+                stats.update(self._getConfigVmStats())
+                stats.update(self._getRunningVmStats())
+                stats.update(self._getGuestStats())
             stats['status'] = self._getVmStatus()
-            stats.update(self._getGuestStats())
         return stats
 
     def _getDownVmStats(self):
@@ -1255,7 +1260,7 @@
             if 'pauseCode' in self.conf:
                 stats['pauseCode'] = self.conf['pauseCode']
         if self.isMigrating():
-            stats['migrationProgress'] = self.migrateStatus()['progress']
+            stats['migrationProgress'] = self._get_vm_migration_progress()
 
         try:
             vm_sample = sampling.stats_cache.get(self.id)
@@ -1346,6 +1351,9 @@
         else:
             return self.lastStatus
 
+    def _get_vm_migration_progress(self):
+        return self.migrateStatus()['progress']
+
     def _getGraphicsStats(self):
         def getInfo(dev):
             return {


-- 
To view, visit https://gerrit.ovirt.org/63552
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iac3da08b0816e7a9a247969147c17b15518c7624
Gerrit-PatchSet: 8
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Milan Zamazal <mzama...@redhat.com>
Gerrit-Reviewer: Francesco Romani <from...@redhat.com>
Gerrit-Reviewer: Milan Zamazal <mzama...@redhat.com>
Gerrit-Reviewer: gerrit-hooks <automat...@ovirt.org>
_______________________________________________
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org

Reply via email to