Change in vdsm[master]: host stats: Add number of in/out migrations

mperina at redhat.com mperina at redhat.com
Thu Mar 5 15:02:41 UTC 2015


Martin Peřina has uploaded a new change for review.

Change subject: host stats: Add number of in/out migrations
......................................................................

host stats: Add number of in/out migrations

Adds number of incoming and outgoing VM migrations into HostStats.

Change-Id: I6d7d333a34503701b998c656c72d67790c9f58af
Bug-Url: https://bugzilla.redhat.com/1113664
Signed-off-by: Martin Perina <mperina at redhat.com>
---
M vdsm/API.py
M vdsm/rpc/vdsmapi-schema.json
2 files changed, 17 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/20/38420/1

diff --git a/vdsm/API.py b/vdsm/API.py
index 42c471e..a19be5a 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -1342,7 +1342,8 @@
         stats['memCommitted'] = self._memCommitted() / Mbytes
         stats['memFree'] = self._memFree() / Mbytes
         stats['swapTotal'], stats['swapFree'] = _readSwapTotalFree()
-        stats['vmCount'], stats['vmActive'], stats['vmMigrating'] = \
+        (stats['vmCount'], stats['vmActive'], stats['vmMigrating'],
+         stats['incomingVmMigrations'], stats['outgoingVmMigrations']) = \
             self._countVms()
         (tm_year, tm_mon, tm_day, tm_hour, tm_min, tm_sec,
          dummy, dummy, dummy) = time.gmtime(time.time())
@@ -1704,18 +1705,20 @@
         return committed
 
     def _countVms(self):
-        count = active = migrating = 0
+        count = active = incoming = outgoing = 0
         for vmId, v in self._cif.vmContainer.items():
             try:
                 count += 1
                 status = v.lastStatus
                 if status == vmstatus.UP:
                     active += 1
-                elif 'Migration' in status:
-                    migrating += 1
+                elif status == vmstatus.MIGRATION_DESTINATION:
+                    incoming += 1
+                elif status == vmstatus.MIGRATION_SOURCE:
+                    outgoing += 1
             except:
                 self.log.error(vmId + ': Lost connection to VM')
-        return count, active, migrating
+        return count, active, incoming + outgoing, incoming, outgoing
 
     def _getHaInfo(self):
         """
diff --git a/vdsm/rpc/vdsmapi-schema.json b/vdsm/rpc/vdsmapi-schema.json
index 1d919e8..7c9044d 100644
--- a/vdsm/rpc/vdsmapi-schema.json
+++ b/vdsm/rpc/vdsmapi-schema.json
@@ -2000,7 +2000,7 @@
 #
 # @vmActive:        The number of VMs active on this host
 #
-# @vmMigrating:     The number of VMs migrating away from this host
+# @vmMigrating:     The number of VMs migrating to or from this host
 #
 # @dateTime:        The current date and time according to this host
 #
@@ -2031,6 +2031,12 @@
 # @cpuStatistics:   Statistics about each cpu core
 #                   (new in version 4.15.0)
 #
+# @incomingVmMigrations:   The number of VMs migrating to this host
+#                          (new in version 4.17.0)
+#
+# @outgoingVmMigrations:   The number of VMs migrating away from this host
+#                          (new in version 4.17.0)
+#
 # Since: 4.10.0
 ##
 {'type': 'HostStats',
@@ -2051,7 +2057,8 @@
            'momStatus': 'MOMStatus', '*haScore': 'int',
            'haStatus': 'HostedEngineStatus', '*bootTime': 'uint',
            'numaNodeMemFree': 'NumaNodeMemoryStatsMap',
-           'cpuStatistics': 'CpuCoreStatsMap'}}
+           'cpuStatistics': 'CpuCoreStatsMap',
+           'incomingVmMigrations': 'int', 'outgoingVmMigrations': 'int'}}
 
 ##
 # @Host.getStats:


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6d7d333a34503701b998c656c72d67790c9f58af
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Peřina <mperina at redhat.com>


More information about the vdsm-patches mailing list