Change in vdsm[master]: vm: add 'name' property

fromani at redhat.com fromani at redhat.com
Mon Feb 16 14:24:59 UTC 2015


Francesco Romani has uploaded a new change for review.

Change subject: vm: add 'name' property
......................................................................

vm: add 'name' property

add a 'name' property -recycling already existing code
and export it in vm.getStats() output. This is needed
to better integrate with MOM.

Change-Id: Ic079c592c2758926e56ca337380d2e9b783dbcda
Signed-off-by: Francesco Romani <fromani at redhat.com>
---
M vdsm/rpc/vdsmapi-schema.json
M vdsm/virt/vm.py
2 files changed, 10 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/24/37824/1

diff --git a/vdsm/rpc/vdsmapi-schema.json b/vdsm/rpc/vdsmapi-schema.json
index 1d919e8..d4b6129 100644
--- a/vdsm/rpc/vdsmapi-schema.json
+++ b/vdsm/rpc/vdsmapi-schema.json
@@ -6863,6 +6863,8 @@
 # @ioTune:             #optional Current QoS settings for IO devices
 #                      (new in version 4.15.0)
 #
+# @vmName:             The Name of the Vm (new in version 4.17.0)
+#
 # Since: 4.10.0
 ##
 {'type': 'RunningVmStats',
@@ -6887,7 +6889,7 @@
           '*vNodeRuntimeInfo': 'VmNumaNodeRuntimeInfoMap',
           'displayInfo': ['VmDisplayInfo'], '*vcpuQuota': 'int',
           '*vcpuPeriod': 'int', '*vcpuCount': 'int', '*vcpuUserLimit': 'int',
-          '*ioTune': ['VmDiskDeviceTuneParams']}}
+          '*ioTune': ['VmDiskDeviceTuneParams'], 'vmName': 'str'}}
 
 ##
 # @VmStats:
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index ab72527..a2595f5 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -1230,6 +1230,7 @@
         """
         stats = {
             'vmId': self.conf['vmId'],
+            'vmName': self.name,
             'pid': self.conf['pid'],
             'vmType': self.conf['vmType'],
             'kvmEnable': self._kvmEnable,
@@ -3165,7 +3166,7 @@
         self._watchdogEvent["time"] = time.time()
         self._watchdogEvent["action"] = actionEnum[action]
         self.log.info("Watchdog event comes from guest %s. "
-                      "Action: %s", self.conf['vmName'],
+                      "Action: %s", self.name,
                       actionToString(action))
 
     def changeCD(self, drivespec):
@@ -3288,11 +3289,14 @@
                     for dev in self.conf.get('devices', [])
                     if dev['type'] == hwclass.GRAPHICS))
 
+    @property
+    def name(self):
+        return self.conf['vmName'].encode('utf-8')
+
     def _getPid(self):
         pid = '0'
         try:
-            vmName = self.conf['vmName'].encode('utf-8')
-            pid = supervdsm.getProxy().getVmPid(vmName)
+            pid = supervdsm.getProxy().getVmPid(self.name)
         except Exception:
             pass
         return pid


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

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