Change in vdsm[master]: virt: stats: report partial content in stats

fromani at redhat.com fromani at redhat.com
Tue Apr 8 13:29:38 UTC 2014


Francesco Romani has uploaded a new change for review.

Change subject: virt: stats: report partial content in stats
......................................................................

virt: stats: report partial content in stats

this patch adds reporting for the actual content
in the RunningVmStats returned by the getStats API,
so the engine can possibly distinguish between partial
and complete answers.

Change-Id: Ifd62e9d682812afbb4dedc82ee02e6c8bf5bfbf7
Signed-off-by: Francesco Romani <fromani at redhat.com>
---
M vdsm/virt/vm.py
M vdsm_api/vdsmapi-schema.json
2 files changed, 14 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/58/26558/1

diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 84527b9..7517d73 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -2398,9 +2398,11 @@
 
     def getStats(self):
         stats = {}
+
         if self.lastStatus == vmstatus.DOWN:
             self._addExitedVmStats(stats)
         else:
+            stats['content'] = []
             self._addStaticVmStats(stats)
             self._addDynamicVmStats(stats)
             self._addVmStatusStats(stats)
@@ -2447,6 +2449,7 @@
         stats['hash'] = self._devXmlHash
         if self._watchdogEvent:
             stats['watchdogEvent'] = self._watchdogEvent
+        stats['content'].append('static')
 
     def _addDynamicVmStats(self, stats):
         decStats = {}
@@ -2473,6 +2476,7 @@
                 except Exception:
                     self.log.error("Error setting vm disk stats",
                                    exc_info=True)
+        stats['content'].append('dynamic')
 
     def _addVmStatusStats(self, stats):
         def _getGuestStatus():
@@ -2502,13 +2506,16 @@
             stats['status'] = _getGuestStatus()
         else:
             stats['status'] = self.lastStatus
+        stats['content'].append('status')
 
     def _addMigrationVmStats(self, stats):
         if self.isMigrating():
             stats['migrationProgress'] = self.migrateStatus()['progress']
+        stats['content'].append('migration')
 
     def _addBalloonInfoStats(self, stats):
         stats['balloonInfo'] = self._getBalloonInfo()
+        stats['content'].append('balloon')
 
     def _addGuestInfoStats(self, stats):
         stats.update(self.guestAgent.getGuestInfo())
@@ -2518,6 +2525,7 @@
             memUsage = (100 - float(realMemUsage) /
                         int(self.conf['memSize']) * 100)
         stats['memUsage'] = utils.convertToStr(int(memUsage))
+        stats['content'].append('guest')
 
     def isMigrating(self):
         return self._migrationSourceThread.isAlive()
diff --git a/vdsm_api/vdsmapi-schema.json b/vdsm_api/vdsmapi-schema.json
index 31bd869..9edc132 100644
--- a/vdsm_api/vdsmapi-schema.json
+++ b/vdsm_api/vdsmapi-schema.json
@@ -5801,6 +5801,10 @@
 #
 # Statistics for a running virtual machine.
 #
+# @content:            Flags describing the content of the stats,
+#                      partial or total.
+#                      (new in version 4.15.0)
+#
 # @displayPort:        The port in use for unencrypted display data
 #
 # @displaySecurePort:  The port in use for encrypted display data
@@ -5871,7 +5875,8 @@
 # Since: 4.10.0
 ##
 {'type': 'RunningVmStats',
- 'data': {'displayPort': 'uint', 'displaySecurePort': 'uint',
+ 'data': {'content': ['str'],
+          'displayPort': 'uint', 'displaySecurePort': 'uint',
           'displayType': 'VmDisplayType', 'displayIp': 'str', 'pid': 'uint',
           'vmType': 'VmType', 'kvmEnable': 'bool',
           'network': 'NetworkInterfaceStatsMap',


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

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