WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] Fix error message and wait time for xm bl

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Fix error message and wait time for xm block-detach command.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 07 Sep 2007 09:14:03 -0700
Delivery-date: Fri, 07 Sep 2007 09:22:36 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1189161018 -3600
# Node ID 0c14d0bf369eca202a4b35af8c9b23f47a2f1fec
# Parent  7dba4441bf922e4d810580bcbc750e09ee50c14e
Fix error message and wait time for xm block-detach command.

 - Wait time
    When xm requests a block device detach to xend, xm makes two
    requests. At first, xm requests the block device detach by device
    class 'vbd'. Next, xm requests the block device detaching by
    device class 'tap'.
    As a result, the wait time is 200 seconds because each of
    the block device detaching requests causes time-out.
 - Misleading error message
    Because the last request is by device class 'tap' to xend,
    the keyword "(tap)" is included in the error message.

This patch fixes the number of times of the block device detaching
request to one time.  At first, xm makes inquiries about device
class of a detaching target device to xend.  Then xm requires the
block device detaching by xend returned device class.  The wait
time becomes 100 seconds because the block device detaching request
is one time.  And the error message is also fixed.

Signed-off-by: Masaki Kanno <kanno.masaki@xxxxxxxxxxxxxx>
---
 tools/python/xen/xend/XendDomainInfo.py      |   18 +++++++++++++-----
 tools/python/xen/xend/server/XMLRPCServer.py |    2 +-
 tools/python/xen/xm/main.py                  |   11 ++++++-----
 3 files changed, 20 insertions(+), 11 deletions(-)

diff -r 7dba4441bf92 -r 0c14d0bf369e tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Fri Sep 07 11:24:28 2007 +0100
+++ b/tools/python/xen/xend/XendDomainInfo.py   Fri Sep 07 11:30:18 2007 +0100
@@ -602,16 +602,16 @@ class XendDomainInfo:
                                     mac = x[1]
                                     break
                             break
-                    dev_info = self.getDeviceInfo_vif(mac)
+                    dev_info = self._getDeviceInfo_vif(mac)
                 else:
                     _, dev_info = sxprs[dev]
             else:  # 'vbd' or 'tap'
-                dev_info = self.getDeviceInfo_vbd(dev)
+                dev_info = self._getDeviceInfo_vbd(dev)
                 # To remove the UUID of the device from refs,
                 # deviceClass must be always 'vbd'.
                 deviceClass = 'vbd'
             if dev_info is None:
-                return rc
+                raise XendError("Device %s is not defined" % devid)
 
             dev_uuid = sxp.child_value(dev_info, 'uuid')
             del self.info['devices'][dev_uuid]
@@ -632,14 +632,22 @@ class XendDomainInfo:
                     dev_num += 1
             return sxprs
 
-    def getDeviceInfo_vif(self, mac):
+    def getBlockDeviceClass(self, devid):
+        # To get a device number from the devid,
+        # we temporarily use the device controller of VBD.
+        dev = self.getDeviceController('vbd').convertToDeviceNumber(devid)
+        dev_info = self._getDeviceInfo_vbd(dev)
+        if dev_info:
+            return dev_info[0]
+
+    def _getDeviceInfo_vif(self, mac):
         for dev_type, dev_info in self.info.all_devices_sxpr():
             if dev_type != 'vif':
                 continue
             if mac == sxp.child_value(dev_info, 'mac'):
                 return dev_info
 
-    def getDeviceInfo_vbd(self, devid):
+    def _getDeviceInfo_vbd(self, devid):
         for dev_type, dev_info in self.info.all_devices_sxpr():
             if dev_type != 'vbd' and dev_type != 'tap':
                 continue
diff -r 7dba4441bf92 -r 0c14d0bf369e 
tools/python/xen/xend/server/XMLRPCServer.py
--- a/tools/python/xen/xend/server/XMLRPCServer.py      Fri Sep 07 11:24:28 
2007 +0100
+++ b/tools/python/xen/xend/server/XMLRPCServer.py      Fri Sep 07 11:30:18 
2007 +0100
@@ -87,7 +87,7 @@ methods = ['device_create', 'device_conf
            'destroyDevice','getDeviceSxprs',
            'setMemoryTarget', 'setName', 'setVCpuCount', 'shutdown',
            'send_sysrq', 'getVCPUInfo', 'waitForDevices',
-           'getRestartCount']
+           'getRestartCount', 'getBlockDeviceClass']
 
 exclude = ['domain_create', 'domain_restore']
 
diff -r 7dba4441bf92 -r 0c14d0bf369e tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py       Fri Sep 07 11:24:28 2007 +0100
+++ b/tools/python/xen/xm/main.py       Fri Sep 07 11:30:18 2007 +0100
@@ -2217,12 +2217,13 @@ def xm_block_detach(args):
                               % (dev,dom))
     else:
         arg_check(args, 'block-detach', 2, 3)
-        try:
+        dom = args[0]
+        dev = args[1]
+        dc = server.xend.domain.getBlockDeviceClass(dom, dev)
+        if dc == "tap":
+            detach(args, 'tap')
+        else:
             detach(args, 'vbd')
-            return
-        except:
-            pass
-        detach(args, 'tap')
 
 def xm_network_detach(args):
     if serverType == SERVER_XEN_API:

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Fix error message and wait time for xm block-detach command., Xen patchbot-unstable <=