Francesco Romani has uploaded a new change for review.

Change subject: virt: stats: move the guest stats in a method
......................................................................

virt: stats: move the guest stats in a method

this patch moves the guest statistics gathering in
a separate method, with no functional changes.

Change-Id: I83adb6ddc28777c50190229e5da728a3bdb3b24e
Signed-off-by: Francesco Romani <from...@redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 10 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/54/26554/1

diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 922595e..894f717 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -2414,15 +2414,9 @@
             self._addVmStatusStats(stats)
 
             try:
-                stats.update(self.guestAgent.getGuestInfo())
+                self._addGuestInfoStats(stats)
             except Exception:
                 return stats
-            memUsage = 0
-            realMemUsage = int(stats['memUsage'])
-            if realMemUsage != 0:
-                memUsage = (100 - float(realMemUsage) /
-                            int(self.conf['memSize']) * 100)
-            stats['memUsage'] = utils.convertToStr(int(memUsage))
 
             stats['balloonInfo'] = self._getBalloonInfo()
 
@@ -2518,6 +2512,15 @@
         if self.isMigrating():
             stats['migrationProgress'] = self.migrateStatus()['progress']
 
+    def _addGuestInfoStats(self, stats):
+        stats.update(self.guestAgent.getGuestInfo())
+        memUsage = 0
+        realMemUsage = int(stats['memUsage'])
+        if realMemUsage != 0:
+            memUsage = (100 - float(realMemUsage) /
+                        int(self.conf['memSize']) * 100)
+        stats['memUsage'] = utils.convertToStr(int(memUsage))
+
     def isMigrating(self):
         return self._migrationSourceThread.isAlive()
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I83adb6ddc28777c50190229e5da728a3bdb3b24e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <from...@redhat.com>
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to