Change in vdsm[master]: virt: Additional reporting of CPU and IO information

vfeenstr at redhat.com vfeenstr at redhat.com
Wed Mar 4 11:30:48 UTC 2015


Vinzenz Feenstra has uploaded a new change for review.

Change subject: virt: Additional reporting of CPU and IO information
......................................................................

virt: Additional reporting of CPU and IO information

As per request, we're now additionally reporting:
- Read and write operations per VM and disk
- Read and written bytes per VM and disk
- Number of cpu shares reported by the scheduler

Change-Id: Idb0055fcd720a88a96a67e7424007384734a4404
Bug-Url: https://bugzilla.redhat.com/1172153
Signed-off-by: Vinzenz Feenstra <vfeenstr at redhat.com>
---
M vdsm/rpc/vdsmapi-schema.json
M vdsm/virt/vm.py
2 files changed, 27 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/66/38366/1

diff --git a/vdsm/rpc/vdsmapi-schema.json b/vdsm/rpc/vdsmapi-schema.json
index 1d919e8..9e0f514 100644
--- a/vdsm/rpc/vdsmapi-schema.json
+++ b/vdsm/rpc/vdsmapi-schema.json
@@ -6473,13 +6473,22 @@
 #
 # @flushLatency:  The latency of flush operations in nanoseconds
 #
+# @writeOps:      Write operations (new in version 4.17.0)
+#
+# @readOps:       Read operations (new in version 4.17)
+#
+# @readBytes:     Bytes read (new in version 4.17.0)
+#
+# @writtenBytes:  Bytes written (new in version 4.17.0)
+#
 # Since: 4.10.0
 ##
 {'type': 'VmDiskStats',
  'data': {'truesize': 'uint', 'apparentsize': 'uint', 'imageID': 'UUID',
           'readRate': 'uint', 'writeRate': 'uint',
           'readLatency': 'uint', 'writeLatency': 'uint',
-          'flushLatency': 'uint'}}
+          'flushLatency': 'uint', 'writeOps': 'uint', 'readOps': 'uint',
+          'readBytes': 'uint', 'writtenBytes': 'uint'}}
 
 ##
 # @VmBootMode:
@@ -6863,6 +6872,9 @@
 # @ioTune:             #optional Current QoS settings for IO devices
 #                      (new in version 4.15.0)
 #
+# cpuShares:           #optional CPU shares accounted for this VM by the
+#                      scheduler (new in version 4.17.0)
+#
 # Since: 4.10.0
 ##
 {'type': 'RunningVmStats',
@@ -6887,7 +6899,7 @@
           '*vNodeRuntimeInfo': 'VmNumaNodeRuntimeInfoMap',
           'displayInfo': ['VmDisplayInfo'], '*vcpuQuota': 'int',
           '*vcpuPeriod': 'int', '*vcpuCount': 'int', '*vcpuUserLimit': 'int',
-          '*ioTune': ['VmDiskDeviceTuneParams']}}
+          '*ioTune': ['VmDiskDeviceTuneParams'], '*cpuShares': 'uint'}}
 
 ##
 # @VmStats:
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 3f194b0..122a1e7 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -561,6 +561,9 @@
             value = sample['vcpuLimit']
             stats['vcpuUserLimit'] = value
 
+        if 'cpu_shares' in sample:
+            stats['cpuShares'] = sample['cpu_shares']
+
     def _getNetworkStats(self, stats):
         stats['network'] = {}
         sInfo, eInfo, sampleInterval = self.sampleNet.getStats()
@@ -590,7 +593,11 @@
                           'apparentsize': str(vmDrive.apparentsize),
                           'readLatency': '0',
                           'writeLatency': '0',
-                          'flushLatency': '0'}
+                          'flushLatency': '0',
+                          'readOps': '0',
+                          'writeOps': '0',
+                          'writtenBytes': '0',
+                          'readBytes': '0'}
                 if isVdsmImage(vmDrive):
                     dStats['imageID'] = vmDrive.imageID
                 elif "GUID" in vmDrive:
@@ -601,6 +608,11 @@
                     dStats.update(_calcDiskRate(vmDrive, sInfo, eInfo,
                                                 sampleInterval))
                     dStats.update(_calcDiskLatency(vmDrive, sInfo, eInfo))
+                    dStats.update({
+                        'readOps': str(eInfo[vmDrive.name]['rd_operations']),
+                        'writeOps': str(eInfo[vmDrive.name]['rd_operations']),
+                        'readBytes': eInfo[vmDrive.name]['rd_bytes'],
+                        'writtenBytes': eInfo[vmDrive.name]['rd_bytes']})
 
             except (AttributeError, TypeError, ZeroDivisionError):
                 self._log.exception("Disk %s stats not available",


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idb0055fcd720a88a96a67e7424007384734a4404
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Vinzenz Feenstra <vfeenstr at redhat.com>


More information about the vdsm-patches mailing list