Vinzenz Feenstra has uploaded a new change for review. Change subject: vdsm: Nicer names for methods ......................................................................
vdsm: Nicer names for methods Underlying is gone, _pause = _suspend, _cont = _resume Change-Id: I9614084b812d1da4a5a1b0cc8aedefbd63713f60 Signed-off-by: Vinzenz Feenstra <[email protected]> --- M vdsm/vm/migration/source_thread.py M vdsm/vm/vm.py 2 files changed, 47 insertions(+), 47 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/68/10868/1 diff --git a/vdsm/vm/migration/source_thread.py b/vdsm/vm/migration/source_thread.py index 668e892..8251e48 100644 --- a/vdsm/vm/migration/source_thread.py +++ b/vdsm/vm/migration/source_thread.py @@ -222,7 +222,7 @@ 'method': self._method, 'dstparams': self._dstparams} self._vm.saveState() - self._startUnderlyingMigration() + self._startMigration() self._finishSuccessfully() except libvirt.libvirtError, e: if e.get_error_code() == libvirt.VIR_ERR_OPERATION_ABORTED: @@ -239,7 +239,7 @@ self._recover(str(e)) self.log.error("Failed to migrate", exc_info=True) - def _startUnderlyingMigration(self): + def _startMigration(self): self._preparingMigrationEvt = True if self._mode == 'file': hooks.before_vm_hibernate(self._vm._dom.XMLDesc(0), self._vm.conf) diff --git a/vdsm/vm/vm.py b/vdsm/vm/vm.py index 0302615..5fca0f0 100644 --- a/vdsm/vm/vm.py +++ b/vdsm/vm/vm.py @@ -128,7 +128,7 @@ self._monitorResponse = 0 self.conf['clientIp'] = '' self.memCommitted = 0 - self._creationThread = threading.Thread(target=self._startUnderlyingVm) + self._creationThread = threading.Thread(target=self._startVm) if 'migrationDest' in self.conf: self._lastStatus = 'Migration Destination' elif 'restoreState' in self.conf: @@ -452,7 +452,7 @@ memory += config.getint('vars', 'guest_ram_overhead') self.memCommitted = 2 ** 20 * memory - def _startUnderlyingVm(self): + def _startVm(self): self.log.debug("Start") try: self.memCommit() @@ -525,7 +525,7 @@ self.startDisksStatsCollection() def _onQemuDeath(self): - self.log.info('underlying process disconnected') + self.log.info('qemu process disconnected') # Try release VM resources first, if failed stuck in 'Powering Down' # state response = self.releaseVm() @@ -705,7 +705,7 @@ if self.lastStatus in ('Migration Source', 'Saving State', 'Down'): self.log.error('cannot cont while %s', self.lastStatus) return errCode['unexpected'] - self._underlyingCont() + self._resume() if hasattr(self, 'updateGuestCpuRunning'): self.updateGuestCpuRunning() self._lastStatus = afterState @@ -723,7 +723,7 @@ self._acquireCpuLockWithTimeout() try: self.conf['pauseCode'] = 'NOERR' - self._underlyingPause() + self._suspend() if hasattr(self, 'updateGuestCpuRunning'): self.updateGuestCpuRunning() self._lastStatus = afterState @@ -978,21 +978,21 @@ self._guestCpuRunning = (self._dom.info()[0] == libvirt.VIR_DOMAIN_RUNNING) - def _getUnderlyingVmDevicesInfo(self): + def _getVmDevicesInfo(self): """ - Obtain underlying vm's devices info from libvirt. + Obtain vm's devices info from libvirt. """ - self._getUnderlyingNetworkInterfaceInfo() - self._getUnderlyingDriveInfo() - self._getUnderlyingDisplayPort() - self._getUnderlyingSoundDeviceInfo() - self._getUnderlyingVideoDeviceInfo() - self._getUnderlyingControllerDeviceInfo() - self._getUnderlyingBalloonDeviceInfo() - self._getUnderlyingWatchdogDeviceInfo() - self._getUnderlyingSmartcardDeviceInfo() + self._getNetworkInterfaceInfo() + self._getDriveInfo() + self._getDisplayPort() + self._getSoundDeviceInfo() + self._getVideoDeviceInfo() + self._getControllerDeviceInfo() + self._getBalloonDeviceInfo() + self._getWatchdogDeviceInfo() + self._getSmartcardDeviceInfo() # Obtain info of all unknown devices. Must be last! - self._getUnderlyingUnknownDeviceInfo() + self._getUnknownDeviceInfo() def _domDependentInit(self): if self.destroyed: @@ -1004,8 +1004,8 @@ pass raise Exception('destroy() called before Vm started') - self._getUnderlyingVmInfo() - self._getUnderlyingVmDevicesInfo() + self._getVmInfo() + self._getVmDevicesInfo() #Currently there is no protection agains mirroring a network twice, for nic in self._devices[NIC_DEVICES]: @@ -1159,7 +1159,7 @@ self._devices[NIC_DEVICES].append(nic) self.conf['devices'].append(nicParams) self.saveState() - self._getUnderlyingNetworkInterfaceInfo() + self._getNetworkInterfaceInfo() hooks.after_nic_hotplug(nicXml, self.conf) if hasattr(nic, 'portMirroring'): @@ -1395,7 +1395,7 @@ self._devices[DISK_DEVICES].append(drive) self.conf['devices'].append(diskParams) self.saveState() - self._getUnderlyingDriveInfo() + self._getDriveInfo() return {'status': doneCode, 'vmList': self.status()} @@ -1506,11 +1506,11 @@ self.saveState() self.log.debug("End of migration") - def _underlyingCont(self): + def _resume(self): hooks.before_vm_cont(self._dom.XMLDesc(0), self.conf) self._dom.resume() - def _underlyingPause(self): + def _suspend(self): hooks.before_vm_pause(self._dom.XMLDesc(0), self.conf) self._dom.suspend() @@ -2119,7 +2119,7 @@ pass return pid - def _getUnderlyingVmInfo(self): + def _getVmInfo(self): self._lastXMLDesc = self._dom.XMLDesc(0) devxml = _domParseStr(self._lastXMLDesc).childNodes[0]. \ getElementsByTagName('devices')[0] @@ -2156,7 +2156,7 @@ os.rename(f.name, self._recoveryFile) _previous(self) try: - self._getUnderlyingVmInfo() + self._getVmInfo() except: # we do not care if _dom suddenly died now pass @@ -2388,7 +2388,7 @@ self.saveState() return {'status': doneCode} - def _getUnderlyingDeviceAddress(self, devXml): + def _getDeviceAddress(self, devXml): """ Obtain device's address from libvirt """ @@ -2404,7 +2404,7 @@ return address - def _getUnderlyingUnknownDeviceInfo(self): + def _getUnknownDeviceInfo(self): """ Obtain unknown devices info from libvirt. @@ -2428,7 +2428,7 @@ alias = x.getElementsByTagName('alias')[0].getAttribute('name') if not isKnownDevice(alias): - address = self._getUnderlyingDeviceAddress(x) + address = self._getDeviceAddress(x) # I general case we assume that device has attribute 'type', # if it hasn't getAttribute returns ''. device = x.getAttribute('type') @@ -2438,7 +2438,7 @@ 'address': address} self.conf['devices'].append(newDev) - def _getUnderlyingControllerDeviceInfo(self): + def _getControllerDeviceInfo(self): """ Obtain controller devices info from libvirt. """ @@ -2456,7 +2456,7 @@ index = x.getAttribute('index') # Get controller address - address = self._getUnderlyingDeviceAddress(x) + address = self._getDeviceAddress(x) # In case the controller has index and/or model, they # are compared. Currently relevant for USB controllers. @@ -2485,7 +2485,7 @@ 'address': address, 'alias': alias}) - def _getUnderlyingBalloonDeviceInfo(self): + def _getBalloonDeviceInfo(self): """ Obtain balloon device info from libvirt. """ @@ -2497,7 +2497,7 @@ if not x.getElementsByTagName('address'): continue - address = self._getUnderlyingDeviceAddress(x) + address = self._getDeviceAddress(x) alias = x.getElementsByTagName('alias')[0].getAttribute('name') for dev in self._devices[BALLOON_DEVICES]: @@ -2511,7 +2511,7 @@ dev['address'] = address dev['alias'] = alias - def _getUnderlyingSmartcardDeviceInfo(self): + def _getSmartcardDeviceInfo(self): """ Obtain smartcard device info from libvirt. """ @@ -2522,7 +2522,7 @@ if not x.getElementsByTagName('address'): continue - address = self._getUnderlyingDeviceAddress(x) + address = self._getDeviceAddress(x) alias = x.getElementsByTagName('alias')[0].getAttribute('name') for dev in self._devices[SMARTCARD_DEVICES]: @@ -2536,7 +2536,7 @@ dev['address'] = address dev['alias'] = alias - def _getUnderlyingWatchdogDeviceInfo(self): + def _getWatchdogDeviceInfo(self): """ Obtain watchdog device info from libvirt. """ @@ -2547,7 +2547,7 @@ # PCI watchdog has "address" different from ISA watchdog if x.getElementsByTagName('address'): - address = self._getUnderlyingDeviceAddress(x) + address = self._getDeviceAddress(x) alias = x.getElementsByTagName('alias')[0].getAttribute('name') for wd in self._devices[WATCHDOG_DEVICES]: @@ -2561,7 +2561,7 @@ dev['address'] = address dev['alias'] = alias - def _getUnderlyingVideoDeviceInfo(self): + def _getVideoDeviceInfo(self): """ Obtain video devices info from libvirt. """ @@ -2570,7 +2570,7 @@ for x in videosxml: alias = x.getElementsByTagName('alias')[0].getAttribute('name') # Get video card address - address = self._getUnderlyingDeviceAddress(x) + address = self._getDeviceAddress(x) # FIXME. We have an identification problem here. # Video card device has not unique identifier, except the alias @@ -2589,7 +2589,7 @@ dev['alias'] = alias break - def _getUnderlyingSoundDeviceInfo(self): + def _getSoundDeviceInfo(self): """ Obtain sound devices info from libvirt. """ @@ -2598,7 +2598,7 @@ for x in soundsxml: alias = x.getElementsByTagName('alias')[0].getAttribute('name') # Get sound card address - address = self._getUnderlyingDeviceAddress(x) + address = self._getDeviceAddress(x) # FIXME. We have an identification problem here. # Sound device has not unique identifier, except the alias @@ -2617,7 +2617,7 @@ dev['alias'] = alias break - def _getUnderlyingDriveInfo(self): + def _getDriveInfo(self): """ Obtain block devices info from libvirt. """ @@ -2648,7 +2648,7 @@ else: drv = 'raw' # Get disk address - address = self._getUnderlyingDeviceAddress(x) + address = self._getDeviceAddress(x) for d in self._devices[DISK_DEVICES]: if d.path == devPath: @@ -2682,7 +2682,7 @@ diskDev['bootOrder'] = bootOrder self.conf['devices'].append(diskDev) - def _getUnderlyingDisplayPort(self): + def _getDisplayPort(self): """ Obtain display port info from libvirt. """ @@ -2695,7 +2695,7 @@ if port: self.conf['displaySecurePort'] = port - def _getUnderlyingNetworkInterfaceInfo(self): + def _getNetworkInterfaceInfo(self): """ Obtain network interface info from libvirt. """ @@ -2727,7 +2727,7 @@ network = network[len(netinfo.LIBVIRT_NET_PREFIX):] # Get nic address - address = self._getUnderlyingDeviceAddress(x) + address = self._getDeviceAddress(x) for nic in self._devices[NIC_DEVICES]: if nic.macAddr.lower() == mac.lower(): nic.name = name -- To view, visit http://gerrit.ovirt.org/10868 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9614084b812d1da4a5a1b0cc8aedefbd63713f60 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Vinzenz Feenstra <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
