Change in vdsm[master]: vm: extract cheap subset of running vm stats

fromani at redhat.com fromani at redhat.com
Wed Jul 8 11:56:09 UTC 2015


Francesco Romani has uploaded a new change for review.

Change subject: vm: extract cheap subset of running vm stats
......................................................................

vm: extract cheap subset of running vm stats

The getRunningVmStats() method does a lot of work an fetches
all the stats related to a running VMs. This involves
fetching data from periodic tasks, sanitizing all the
data and so forth.

There is an subset of this data which it is easy and cheap
to gather, and yet it contains useful information from
Engine.

This patch extracts this subset and moves it in a separate
function, to be used both by old code and from a new event.

Change-Id: Ia3e2c19d0b69e78f463976478ded12f306e2f2c7
Signed-off-by: Francesco Romani <fromani at redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 14 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/85/43285/2

diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index bed6b7e..770435b 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -1364,21 +1364,29 @@
             stats['boot'] = self.conf['boot']
         return stats
 
-    def _getRunningVmStats(self):
-        """
-        gathers all the stats which can change while a VM is running.
-        """
+    def _getUpVmStats(self):
         stats = {
             'elapsedTime': str(int(time.time() - self._startTime)),
             'monitorResponse': str(self._monitorResponse),
             'timeOffset': self.conf.get('timeOffset', '0'),
             'clientIp': self.conf.get('clientIp', ''),
-            'network': {},
-            'disks': {}}
+        }
         if 'pauseCode' in self.conf:
             stats['pauseCode'] = self.conf['pauseCode']
+        if self._watchdogEvent:
+            stats['watchdogEvent'] = self._watchdogEvent
         if self.isMigrating():
             stats['migrationProgress'] = self.migrateStatus()['progress']
+        return stats
+
+    def _getRunningVmStats(self):
+        """
+        gathers all the stats which can change while a VM is running.
+        """
+        stats = self._getUpVmStats()
+
+        stats['network'] = {}
+        stats['disks'] = {}
 
         decStats = {}
         try:
@@ -1414,8 +1422,6 @@
         stats.update(self._getGraphicsStats())
         stats['hash'] = self._getVmStatusHash()
 
-        if self._watchdogEvent:
-            stats['watchdogEvent'] = self._watchdogEvent
         if self._numaInfo:
             stats['vNodeRuntimeInfo'] = self._numaInfo
         if self._vcpuLimit:


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia3e2c19d0b69e78f463976478ded12f306e2f2c7
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: automation at ovirt.org


More information about the vdsm-patches mailing list