Martin Sivák has uploaded a new change for review.

Change subject: Collect current QoS settings for IO devices and report through 
RunningVmStats
......................................................................

Collect current QoS settings for IO devices and report through RunningVmStats

Change-Id: Ie4fab132b60ce6ae2285115034f3d1ffcdca9e9d
Signed-off-by: Martin Sivak <[email protected]>
---
M lib/vdsm/config.py.in
M vdsm/rpc/vdsmapi-schema.json
M vdsm/virt/vm.py
3 files changed, 60 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/12/28712/1

diff --git a/lib/vdsm/config.py.in b/lib/vdsm/config.py.in
index c1cc112..4dd0641 100644
--- a/lib/vdsm/config.py.in
+++ b/lib/vdsm/config.py.in
@@ -183,6 +183,8 @@
 
         ('vm_sample_cpu_tune_interval', '15', None),
 
+        ('vm_sample_io_tune_interval', '15', None),
+
         ('trust_store_path', '@TRUSTSTORE@',
             'Where the certificates and keys are situated.'),
 
diff --git a/vdsm/rpc/vdsmapi-schema.json b/vdsm/rpc/vdsmapi-schema.json
index dd97594..341b6c6 100644
--- a/vdsm/rpc/vdsmapi-schema.json
+++ b/vdsm/rpc/vdsmapi-schema.json
@@ -2307,6 +2307,23 @@
           '*ioTune': 'VmDiskDeviceIoTuneParams'}}
 
 ##
+# @VmDiskDeviceTuneParams:
+#
+# Extra parameters for VM disk devices.
+#
+# @name:    #optional The name of the taget device
+#
+# @path:    #optional The path of the taget device
+#
+# @ioTune:  IO tune parameters
+#
+# Since: 4.15.0
+##
+{'type': 'VmDiskDeviceTuneParams',
+ 'data': {'*name': 'str', '*path': 'str',
+          'ioTune': 'VmDiskDeviceIoTuneParams'}}
+
+##
 # @VmDiskDeviceVolumeChainEntry:
 #
 # Identifies one volume in a VM disk device volume chain.
@@ -6281,6 +6298,9 @@
 # @vcpuUserLimit:      #optional Cpu usage hard limit in percents.
 #                      (new in version 4.15.0)
 #
+# @ioTune:             #optional Current QoS settings for IO devices
+#                      (new in version 4.15.0)
+#
 # Since: 4.10.0
 ##
 {'type': 'RunningVmStats',
@@ -6304,7 +6324,8 @@
           'displayInfo': ['VmDisplayInfo'], '*vmJobs': 'VmJobsMap',
           '*vNodeRuntimeInfo': 'VmNumaNodeRuntimeInfoMap',
           'displayInfo': ['VmDisplayInfo'], '*vcpuQuota': 'int',
-          '*vcpuPeriod': 'int', '*vcpuCount': 'int', '*vcpuUserLimit': 'int'}}
+          '*vcpuPeriod': 'int', '*vcpuCount': 'int', '*vcpuUserLimit': 'int',
+          '*ioTune': ['VmDiskDeviceTuneParams']}}
 
 ##
 # @VmStats:
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index d4129f9..a1b034f 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -180,9 +180,10 @@
 class VmStatsThread(sampling.AdvancedStatsThread):
     MBPS_TO_BPS = 10 ** 6 / 8
 
-    # CPU tune sampling window
+    # CPU and IO tune sampling window
     # minimum supported value is 2
     CPU_TUNE_SAMPLING_WINDOW = 2
+    IO_TUNE_SAMPLING_WINDOW = 2
 
     def __init__(self, vm):
         sampling.AdvancedStatsThread.__init__(self, log=vm.log, daemon=True)
@@ -237,6 +238,11 @@
                 self._sampleCpuTune,
                 config.getint('vars', 'vm_sample_cpu_tune_interval'),
                 self.CPU_TUNE_SAMPLING_WINDOW))
+        self.sampleIoTune = (
+            sampling.AdvancedStatsFunction(
+                self._sampleIoTune,
+                config.getint('vars', 'vm_sample_io_tune_interval'),
+                self.IO_TUNE_SAMPLING_WINDOW))
 
         self.addStatsFunction(
             self.highWrite, self.updateVolumes, self.sampleCpu,
@@ -319,6 +325,34 @@
             infos['vcpuLimit'] = nodeList[0].childNodes[0].data
 
         return infos
+
+    def _sampleIoTune(self):
+        info = []
+        for device in self._vm._devices:
+            if not isVdsmImage(device):
+                continue
+
+            try:
+                info.append({
+                    "name": device.name,
+                    "path": device.get("path"),
+                    "ioTune": self._vm._dom.blockIoTune(
+                        device.name,
+                        libvirt.VIR_DOMAIN_AFFECT_CURRENT)
+                })
+            except libvirt.libvirtError:
+                self._log.exception("Error while collecting ioTune for %s",
+                                    device.name)
+
+        return info
+
+    def _getIoTuneStats(self, stats):
+        sInfo, eInfo, sampleInterval = self.sampleIoTune.getStats()
+
+        if sInfo is None:
+            return
+
+        stats['ioTune'] = eInfo
 
     def _diff(self, prev, curr, val):
         return prev[val] - curr[val]
@@ -553,6 +587,7 @@
         self._getDiskLatency(stats)
         self._getBalloonStats(stats)
         self._getVmJobs(stats)
+        self._getIoTuneStats(stats)
 
         vmNumaNodeRuntimeMap = numaUtils.getVmNumaNodeRuntimeInfo(self._vm)
         if vmNumaNodeRuntimeMap:


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie4fab132b60ce6ae2285115034f3d1ffcdca9e9d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Sivák <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to