diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py index e9d3e7e..36dc599 100644 --- a/tools/python/xen/xend/XendDomainInfo.py +++ b/tools/python/xen/xend/XendDomainInfo.py @@ -1167,7 +1167,7 @@ class XendDomainInfo: @param dev_config: device configuration @type dev_config: SXP object (parsed config) @param devid: device id - @type devid: int + @type devid: str @return: Returns True if successfully updated device @rtype: boolean """ @@ -1193,24 +1193,24 @@ class XendDomainInfo: dev_control = self.getDeviceController(dev_class) if devid is None: - dev = dev_config.get('dev', '') - if not dev: + devid = dev_config.get('dev', '') + if not devid: raise VmError('Block device must have virtual details specified') - if 'ioemu:' in dev: - (_, dev) = dev.split(':', 1) + if 'ioemu:' in devid: + (_, devid) = devid.split(':', 1) try: - (dev, _) = dev.split(':', 1) # Remove ":disk" or ":cdrom" + (devid, _) = devid.split(':', 1) # Remove ":disk" or ":cdrom" except ValueError: pass - devid = dev_control.convertToDeviceNumber(dev) - dev_info = self._getDeviceInfo_vbd(devid) + dev = dev_control.convertToDeviceNumber(devid) + dev_info = self._getDeviceInfo_vbd(dev) if dev_info is None: raise VmError("Device %s not connected" % devid) dev_uuid = sxp.child_value(dev_info, 'uuid') if self.domid is not None: # use DevController.reconfigureDevice to change device config - dev_control.reconfigureDevice(devid, dev_config) + dev_control.reconfigureDevice(dev, dev_config) else: (_, new_b, new_f) = dev_control.getDeviceDetails(dev_config) if (new_f['device-type'] == 'cdrom' and @@ -1220,7 +1220,7 @@ class XendDomainInfo: pass else: raise VmError('Refusing to reconfigure device %s:%d to %s' % - (dev_class, devid, dev_config)) + (dev_class, dev, dev_config)) # update XendConfig with new device info self.info.device_update(dev_uuid, dev_sxp)