Change in vdsm[master]: vm: rename vm.status() for clarity

fromani at redhat.com fromani at redhat.com
Mon Dec 8 14:34:26 UTC 2014


Francesco Romani has uploaded a new change for review.

Change subject: vm: rename vm.status() for clarity
......................................................................

vm: rename vm.status() for clarity

the Vm class method 'status' is not just
returning the Vm status, but the whole
Vm configuration.

So rename it to something less surprising,
for the sake of clarity and to make room
to a new 'status' method which will actually
just return the Vm status.

Change-Id: I3ed259f67eb83a0d73873309f94a1f0e30680963
Signed-off-by: Francesco Romani <fromani at redhat.com>
---
M tests/vmTests.py
M vdsm/API.py
M vdsm/clientIF.py
M vdsm/virt/migration.py
M vdsm/virt/vm.py
5 files changed, 16 insertions(+), 16 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/69/34869/1

diff --git a/tests/vmTests.py b/tests/vmTests.py
index 07dc6be..f6a9389 100644
--- a/tests/vmTests.py
+++ b/tests/vmTests.py
@@ -1743,12 +1743,12 @@
 
             with MonkeyPatchScope([(testvm, '_underlyingPause',
                                     _fireAsyncEvent)]):
-                self.assertEqual(testvm.status()['status'], vmstatus.UP)
+                self.assertEqual(testvm.getConf()['status'], vmstatus.UP)
                 testvm.pause(vmstatus.SAVING_STATE)
-                self.assertEqual(testvm.status()['status'],
+                self.assertEqual(testvm.getConf()['status'],
                                  vmstatus.SAVING_STATE)
                 t.join()
-                self.assertEqual(testvm.status()['status'],
+                self.assertEqual(testvm.getConf()['status'],
                                  vmstatus.SAVING_STATE)
                 # state must not change even after we are sure the event was
                 # handled
diff --git a/vdsm/API.py b/vdsm/API.py
index 1ef4b00..7fb6a04 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -516,7 +516,7 @@
         except KeyError:
             return errCode['noVM']
 
-        vmParams = v.status()
+        vmParams = v.getConf()
         if vmParams['status'] in (vmstatus.WAIT_FOR_LAUNCH, vmstatus.DOWN):
             return errCode['noVM']
         if params.get('mode') == 'file':
@@ -1367,7 +1367,7 @@
         """ return a list of known VMs with full (or partial) config each """
 
         def reportedStatus(v, full):
-            d = v.status()
+            d = v.getConf()
             if full:
                 return d
             else:
diff --git a/vdsm/clientIF.py b/vdsm/clientIF.py
index 440e5e7..1f54700 100644
--- a/vdsm/clientIF.py
+++ b/vdsm/clientIF.py
@@ -392,7 +392,7 @@
         vm.run()
         self.log.debug("Total desktops after creation of %s is %d" %
                        (vmParams['vmId'], container_len))
-        return {'status': doneCode, 'vmList': vm.status()}
+        return {'status': doneCode, 'vmList': vm.getConf()}
 
     @utils.traceback()
     def _recoverThread(self):
diff --git a/vdsm/virt/migration.py b/vdsm/virt/migration.py
index 2d890c0..51b347a 100644
--- a/vdsm/virt/migration.py
+++ b/vdsm/virt/migration.py
@@ -129,7 +129,7 @@
             self.status = errCode['noConPeer']
 
     def _setupRemoteMachineParams(self):
-        self._machineParams.update(self._vm.status())
+        self._machineParams.update(self._vm.getConf())
         # patch VM config for targets < 3.1
         self._patchConfigForLegacy()
         self._machineParams['elapsedTimeOffset'] = \
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 9740ab3..e37bf7d 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -1746,7 +1746,7 @@
         if self._destroyed:
             return
         with self._confLock:
-            toSave = deepcopy(self.status())
+            toSave = deepcopy(self.getConf())
         toSave['startTime'] = self._startTime
         if self.lastStatus != vmstatus.DOWN and self._vmStats:
             toSave['username'] = self.guestAgent.guestInfo['username']
@@ -2200,7 +2200,7 @@
             pass
         self.saveState()
 
-    def status(self):
+    def getConf(self):
         # used by API.Global.getVMList
         self.conf['status'] = self.lastStatus
         # Filter out any internal keys
@@ -2832,7 +2832,7 @@
                         {'code': errCode['hotplugNic']['status']['code'],
                          'message': e.message}}
 
-        return {'status': doneCode, 'vmList': self.status()}
+        return {'status': doneCode, 'vmList': self.getConf()}
 
     def _lookupDeviceByAlias(self, devType, alias):
         for dev in self._devices[devType][:]:
@@ -2889,7 +2889,7 @@
             with self.setLinkAndNetwork(netDev, netConf, linkValue, network,
                                         custom, specParams):
                 with self.updatePortMirroring(netConf, netsToMirror):
-                    return {'status': doneCode, 'vmList': self.status()}
+                    return {'status': doneCode, 'vmList': self.getConf()}
         except (LookupError,
                 SetLinkAndNetworkError,
                 UpdatePortMirroringError) as e:
@@ -3062,7 +3062,7 @@
 
         hooks.after_nic_hotunplug(nicXml, self.conf,
                                   params=nic.custom)
-        return {'status': doneCode, 'vmList': self.status()}
+        return {'status': doneCode, 'vmList': self.getConf()}
 
     def setNumberOfCpus(self, numberOfCpus):
 
@@ -3084,7 +3084,7 @@
         self.conf['smp'] = str(numberOfCpus)
         self.saveState()
         hooks.after_set_num_of_cpus()
-        return {'status': doneCode, 'vmList': self.status()}
+        return {'status': doneCode, 'vmList': self.getConf()}
 
     def updateVmPolicy(self, params):
         """
@@ -3368,7 +3368,7 @@
             hooks.after_disk_hotplug(driveXml, self.conf,
                                      params=drive.custom)
 
-        return {'status': doneCode, 'vmList': self.status()}
+        return {'status': doneCode, 'vmList': self.getConf()}
 
     def hotunplugDisk(self, params):
         if self.isMigrating():
@@ -3428,7 +3428,7 @@
                                        params=drive.custom)
             self._cleanupDrives(drive)
 
-        return {'status': doneCode, 'vmList': self.status()}
+        return {'status': doneCode, 'vmList': self.getConf()}
 
     def _readPauseCode(self, timeout):
         # libvirt does not not export yet the I/O error reason code.
@@ -4180,7 +4180,7 @@
             self.cif.teardownVolumePath(self.conf[vmDev])
 
         self.conf[vmDev] = path
-        return {'status': doneCode, 'vmList': self.status()}
+        return {'status': doneCode, 'vmList': self.getConf()}
 
     def setTicket(self, otp, seconds, connAct, params):
         """


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3ed259f67eb83a0d73873309f94a1f0e30680963
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server


More information about the vdsm-patches mailing list