* [PATCH] Fix xm block-configure
@ 2009-05-13 5:13 Masaki Kanno
0 siblings, 0 replies; only message in thread
From: Masaki Kanno @ 2009-05-13 5:13 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1: Mail message body --]
[-- Type: text/plain, Size: 1096 bytes --]
Hi,
This patch solves problems of 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.
# xm block-list vm1
Vdev BE handle state evt-ch ring-ref BE-path
5632 -1 0 -1 -1 -1 ??
# xm block-configure vm1 file:/var/xen/boot.iso hdc:cdrom r
Error: Device 5632 not connected
Usage: xm block-configure <Domain> <BackDev> <FrontDev> <Mode> [BackDomain]
Change block device configuration
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>
Best regards,
Kan
[-- Attachment #2: xm_block_configure.patch --]
[-- Type: application/octet-stream, Size: 2172 bytes --]
diff -r 2522cc95efd2 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py Mon May 11 13:52:04 2009 +0100
+++ b/tools/python/xen/xend/XendDomainInfo.py Wed May 13 14:07:36 2009 +0900
@@ -1048,14 +1048,41 @@ class XendDomainInfo:
except IndexError:
pass
- # use DevController.reconfigureDevice to change device config
dev_control = self.getDeviceController(dev_class)
- dev_uuid = dev_control.reconfigureDevice(devid, dev_config)
+ if devid is None:
+ dev = dev_config.get('dev', '')
+ if not dev:
+ raise VmError('Block device must have virtual details specified')
+ if 'ioemu:' in dev:
+ (_, dev) = dev.split(':', 1)
+ try:
+ (dev, _) = dev.split(':', 1) # Remove ":disk" or ":cdrom"
+ except ValueError:
+ pass
+ devid = dev_control.convertToDeviceNumber(dev)
+ dev_info = self._getDeviceInfo_vbd(devid)
+ 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)
+ else:
+ (_, new_b, new_f) = dev_control.getDeviceDetails(dev_config)
+ if (new_f['device-type'] == 'cdrom' and
+ sxp.child_value(dev_info, 'dev').endswith(':cdrom') and
+ new_b['mode'] == 'r' and
+ sxp.child_value(dev_info, 'mode') == 'r'):
+ pass
+ else:
+ raise VmError('Refusing to reconfigure device %s:%d to %s' %
+ (dev_class, devid, dev_config))
# update XendConfig with new device info
- if dev_uuid:
- self.info.device_update(dev_uuid, dev_sxp)
-
+ self.info.device_update(dev_uuid, dev_sxp)
+ xen.xend.XendDomain.instance().managed_config_save(self)
+
return True
def waitForDevices(self):
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-05-13 5:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-13 5:13 [PATCH] Fix xm block-configure Masaki Kanno
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.