Change in vdsm[master]: vm: report migration progress in VmStats

fromani at redhat.com fromani at redhat.com
Thu Feb 13 16:59:17 UTC 2014


Francesco Romani has uploaded a new change for review.

Change subject: vm: report migration progress in VmStats
......................................................................

vm: report migration progress in VmStats

add migration progress information in the
VM Statistics.

This information is passed to engine, which can now
in turn inform the user about the migration status.

Change-Id: I35e40663921b2d73a9b49727c61b8b1f4dacdb9a
Bug-Url: https://bugzilla.redhat.com/967466
Signed-off-by: Francesco Romani <fromani at redhat.com>
---
M vdsm/vm.py
M vdsm_api/vdsmapi-schema.json
2 files changed, 40 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/65/24465/1

diff --git a/vdsm/vm.py b/vdsm/vm.py
index 9371049..e2192b4 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -136,6 +136,17 @@
         self._migrationCanceledEvt = False
         self._monitorThread = None
 
+    def getProgress(self):
+        """
+        Reports the progress of the migration.
+        """
+        status = {}
+        if self._monitorThread is not None:
+            status['progressData'] = self._monitorThread.data_progress
+            status['progressMem'] = self._monitorThread.mem_progress
+            status['timeElapsed'] = self._monitorThread.timeElapsed
+        return status
+
     def getStat(self):
         """
         Get the status of the migration.
@@ -757,6 +768,7 @@
         self.daemon = True
         self.data_progress = 0
         self.mem_progress = 0
+        self.timeElapsed = 0
 
     def run(self):
         def calculateProgress(remaining, total):
@@ -821,6 +833,7 @@
 
             self.data_progress = calculateProgress(dataRemaining, dataTotal)
             self.mem_progress = calculateProgress(memRemaining, memTotal)
+            self.timeElapsed = timeElapsed
 
             self._vm.log.info('Migration Progress: %s seconds elapsed, %s%% of'
                               ' data processed, %s%% of mem processed' %
@@ -2863,6 +2876,8 @@
                         int(self.conf['memSize']) * 100)
         stats['memUsage'] = utils.convertToStr(int(memUsage))
         stats['balloonInfo'] = self._getBalloonInfo()
+        if self.isMigrating():
+            stats['migrationProgress'] = self.getMigrateProgress()
         return stats
 
     def isMigrating(self):
@@ -2896,6 +2911,9 @@
     def migrateStatus(self):
         return self._migrationSourceThread.getStat()
 
+    def migrateProgress(self):
+        return self._migrationSourceThread.getProgress()
+
     def migrateCancel(self):
         self._acquireCpuLockWithTimeout()
         try:
diff --git a/vdsm_api/vdsmapi-schema.json b/vdsm_api/vdsmapi-schema.json
index dcf9db5..c411a6b 100644
--- a/vdsm_api/vdsmapi-schema.json
+++ b/vdsm_api/vdsmapi-schema.json
@@ -5645,6 +5645,23 @@
  'data': {'time': 'float', 'action': 'WatchdogEventAction'}}
 
 ##
+# @VmMigrationProgress:
+#
+# Information about the migration progress of a VM.
+#
+# @progressData:  The percentage completion of the data migration.
+#
+# @progressMem:   The percentage completion of the memory migration.
+#
+# @timeElapsed:   Time elapsed in secods from the migration start.
+#
+# Since: 4.15.0
+##
+{'type': 'VmMigrationProgress',
+ 'data': {'progressData': 'uint', 'progressMem': 'uint',
+          'timeElapsed': 'uint'}}
+
+##
 # @RunningVmStats:
 #
 # Statistics for a running virtual machine.
@@ -5712,6 +5729,9 @@
 # @guestFQDN:          Fully qualified domain name of the guest OS. (Reported
 #                      by the guest agent)
 #
+# @migrationProgress:  #optional Indicates the progress of a Migration, when
+#                      there is one active. (new in version 4.15.0)
+#
 # Since: 4.10.0
 ##
 {'type': 'RunningVmStats',
@@ -5730,7 +5750,8 @@
           'memoryStats': 'GuestMemoryStats', 'balloonInfo': 'BalloonInfo',
           'disksUsage': ['GuestMountInfo'],
           'netIfaces': ['GuestNetworkDeviceInfo'],
-          '*watchdogEvent': 'WatchdogEvent', 'guestFQDN': 'str'}}
+          '*watchdogEvent': 'WatchdogEvent', 'guestFQDN': 'str',
+          '*migrationProgress': 'VmMigrationProgress'}}
 
 ##
 # @VmStats:


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I35e40663921b2d73a9b49727c61b8b1f4dacdb9a
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