debuggers.hg
changeset 19648:a89e83f2d43e
xend: solve issues with xm block-configure command.
In the case of inactive managed domains:
The following error occurs currently. We cannot change the
configuration of the VBD by using xm block-configure. Of course,
using xm block-detach and xm block-attach instead of xm
block-configure, we can change it. However, I'd like to change it by
using xm block-configure.
In the case of active domains:
Another problem occurs after a domain was rebooted. Even if we
change a configuration of a VBD in the domain by using xm
block-configure, the configuration of the VBD is reverted to previous
configuration after the domain was rebooted.
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
In the case of inactive managed domains:
The following error occurs currently. We cannot change the
configuration of the VBD by using xm block-configure. Of course,
using xm block-detach and xm block-attach instead of xm
block-configure, we can change it. However, I'd like to change it by
using xm block-configure.
In the case of active domains:
Another problem occurs after a domain was rebooted. Even if we
change a configuration of a VBD in the domain by using xm
block-configure, the configuration of the VBD is reverted to previous
configuration after the domain was rebooted.
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
author | Keir Fraser <keir.fraser@citrix.com> |
---|---|
date | Tue May 19 01:37:19 2009 +0100 (2009-05-19) |
parents | 4d6029814742 |
children | 887337323bd8 |
files | tools/python/xen/xend/XendDomainInfo.py |
line diff
1.1 --- a/tools/python/xen/xend/XendDomainInfo.py Tue May 19 01:34:34 2009 +0100 1.2 +++ b/tools/python/xen/xend/XendDomainInfo.py Tue May 19 01:37:19 2009 +0100 1.3 @@ -1048,14 +1048,41 @@ class XendDomainInfo: 1.4 except IndexError: 1.5 pass 1.6 1.7 - # use DevController.reconfigureDevice to change device config 1.8 dev_control = self.getDeviceController(dev_class) 1.9 - dev_uuid = dev_control.reconfigureDevice(devid, dev_config) 1.10 + if devid is None: 1.11 + dev = dev_config.get('dev', '') 1.12 + if not dev: 1.13 + raise VmError('Block device must have virtual details specified') 1.14 + if 'ioemu:' in dev: 1.15 + (_, dev) = dev.split(':', 1) 1.16 + try: 1.17 + (dev, _) = dev.split(':', 1) # Remove ":disk" or ":cdrom" 1.18 + except ValueError: 1.19 + pass 1.20 + devid = dev_control.convertToDeviceNumber(dev) 1.21 + dev_info = self._getDeviceInfo_vbd(devid) 1.22 + if dev_info is None: 1.23 + raise VmError("Device %s not connected" % devid) 1.24 + dev_uuid = sxp.child_value(dev_info, 'uuid') 1.25 + 1.26 + if self.domid is not None: 1.27 + # use DevController.reconfigureDevice to change device config 1.28 + dev_control.reconfigureDevice(devid, dev_config) 1.29 + else: 1.30 + (_, new_b, new_f) = dev_control.getDeviceDetails(dev_config) 1.31 + if (new_f['device-type'] == 'cdrom' and 1.32 + sxp.child_value(dev_info, 'dev').endswith(':cdrom') and 1.33 + new_b['mode'] == 'r' and 1.34 + sxp.child_value(dev_info, 'mode') == 'r'): 1.35 + pass 1.36 + else: 1.37 + raise VmError('Refusing to reconfigure device %s:%d to %s' % 1.38 + (dev_class, devid, dev_config)) 1.39 1.40 # update XendConfig with new device info 1.41 - if dev_uuid: 1.42 - self.info.device_update(dev_uuid, dev_sxp) 1.43 - 1.44 + self.info.device_update(dev_uuid, dev_sxp) 1.45 + xen.xend.XendDomain.instance().managed_config_save(self) 1.46 + 1.47 return True 1.48 1.49 def waitForDevices(self):