Change in vdsm[master]: vdsm: Code simplifications

vfeenstr at redhat.com vfeenstr at redhat.com
Tue Feb 5 12:48:14 UTC 2013


Vinzenz Feenstra has uploaded a new change for review.

Change subject: vdsm: Code simplifications
......................................................................

vdsm: Code simplifications

* Made vmName available as variable of the vm object
* Simplified the naming of the guest socket files

Change-Id: Iaff375542048f49da507910252a35780161ee09c
Signed-off-by: Vinzenz Feenstra <vfeenstr at redhat.com>
---
M vdsm/vm/vm.py
1 file changed, 6 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/48/11748/1

diff --git a/vdsm/vm/vm.py b/vdsm/vm/vm.py
index 2286e41..ad6e969 100644
--- a/vdsm/vm/vm.py
+++ b/vdsm/vm/vm.py
@@ -159,14 +159,11 @@
         self._devices = initDeviceMap()
 
         self._connection = libvirtconnection.get(cif)
-        if 'vmName' not in self.conf:
-            self.conf['vmName'] = 'n%s' % self.id
-        self._guestSocketFile = (constants.P_LIBVIRT_VMCHANNELS +
-                                 self.conf['vmName'].encode('utf-8') +
-                                 '.' + _VMCHANNEL_DEVICE_NAME)
-        self._qemuguestSocketFile = (constants.P_LIBVIRT_VMCHANNELS +
-                                     self.conf['vmName'].encode('utf-8') +
-                                     '.' + _QEMU_GA_DEVICE_NAME)
+        self.vmName = self.conf.get('vmName', 'n%s' % self.id)
+        self.conf['vmName'] = self.vmName.encode('utf-8')
+        socketFilesBase = constants.P_LIBVIRT_VMCHANNELS + self.vmName + '.'
+        self._guestSocketFile = socketFilesBase + _VMCHANNEL_DEVICE_NAME
+        self._qemuguestSocketFile = socketFilesBase + _QEMU_GA_DEVICE_NAME
         self._lastXMLDesc = '<domain><uuid>%s</uuid></domain>' % self.id
         self._devXmlHash = '0'
         self._released = False
@@ -2103,8 +2100,7 @@
     def _getPid(self):
         pid = '0'
         try:
-            vmName = self.conf['vmName'].encode('utf-8')
-            pid = supervdsm.getProxy().getVmPid(vmName)
+            pid = supervdsm.getProxy().getVmPid(self.vmName)
         except:
             pass
         return pid


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

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