[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] xend: solve issues with xm block-configure command.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1242693439 -3600
# Node ID a89e83f2d43e00502b28a056989fcb5145b6eb40
# Parent  4d6029814742cf32ca6b6212acb5b291a741c079
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@xxxxxxxxxxxxxx>
---
 tools/python/xen/xend/XendDomainInfo.py |   37 +++++++++++++++++++++++++++-----
 1 files changed, 32 insertions(+), 5 deletions(-)

diff -r 4d6029814742 -r a89e83f2d43e tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Tue May 19 01:34:34 2009 +0100
+++ b/tools/python/xen/xend/XendDomainInfo.py   Tue May 19 01:37:19 2009 +0100
@@ -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):

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.