Change in vdsm[master]: vmstats: report disks stats only if present

fromani at redhat.com fromani at redhat.com
Thu Jul 16 10:54:34 UTC 2015


Francesco Romani has uploaded a new change for review.

Change subject: vmstats: report disks stats only if present
......................................................................

vmstats: report disks stats only if present

avoid to report empty values for disks stats,
as this may confuse Engine and let it to believe
there is no disks at all.

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


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/17/43717/1

diff --git a/vdsm/virt/vmstats.py b/vdsm/virt/vmstats.py
index caa2fc2..891c137 100644
--- a/vdsm/virt/vmstats.py
+++ b/vdsm/virt/vmstats.py
@@ -61,7 +61,7 @@
                 stats[var] = vm_stats[var]
         elif type(vm_stats[var]) is not dict:
             stats[var] = convertToStr(vm_stats[var])
-        elif var in ('network', 'balloonInfo'):
+        elif var in ('disks', 'network', 'balloonInfo'):
             value = vm_stats[var]
             if value:
                 stats[var] = value
@@ -230,8 +230,11 @@
 
 
 def disks(vm, stats, first_sample, last_sample, interval):
+
     if first_sample is None or last_sample is None:
         return
+
+    disk_stats = {}
 
     for vm_drive in vm.getDiskDevices():
         drive_stats = {}
@@ -272,7 +275,10 @@
             logging.exception("Disk %s stats not available",
                               vm_drive.name)
 
-        stats[vm_drive.name] = drive_stats
+        disk_stats[vm_drive.name] = drive_stats
+
+    if disk_stats:
+        stats['disks'] = disk_stats
 
 
 def _disk_rate(first_sample, last_sample, interval):


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

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