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-devel

[Xen-devel] [PATCH] Fix "xm list --long" listing for removed devices

To: Xen Developers <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] Fix "xm list --long" listing for removed devices
From: Dan Smith <danms@xxxxxxxxxx>
Date: Wed, 30 Nov 2005 13:23:51 -0800
Delivery-date: Wed, 30 Nov 2005 21:23:38 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux)
This patch makes xend clean up information about devices at removal so
that the long xm listing is consistent with reality.

This will close bug #416.

Signed-off-by: Dan Smith <danms@xxxxxxxxxx>
# HG changeset patch
# User dan@xxxxxxxxxxxxxxxxxxxxxxxxxxx
# Node ID c7b558e88f08037f68ba2fc5f6c5361517075f62
# Parent  2b45f4c5a565b24c06e0a25e920ff104eeb6eb62
Finish up bug #416.  Remove devices from the config stored inside
XendDomainInfo so that "xm list --long" is consistent with reality.

diff -r 2b45f4c5a565 -r c7b558e88f08 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Wed Nov 30 20:19:15 2005
+++ b/tools/python/xen/xend/XendDomainInfo.py   Wed Nov 30 20:21:15 2005
@@ -31,7 +31,7 @@
 
 import xen.lowlevel.xc
 from xen.util import asserts
-from xen.util.blkif import blkdev_uname_to_file
+from xen.util.blkif import blkdev_uname_to_file, blkdev_name_to_number
 
 from xen.xend import image
 from xen.xend import sxp
@@ -1275,6 +1275,33 @@
         self.info['device'].append((dev_type, dev_config))
         return self.getDeviceController(dev_type).sxpr(devid)
 
+
+    def device_destroy(self, type, dev):
+        """Destroy a device.
+
+        @param type: device type
+        @param dev: device id
+        """
+
+        try:
+            device = int(dev)
+        except:
+            device = blkdev_name_to_number(dev)
+
+        for t,c in self.info['device']:
+            if t == type:
+            
+                currentDev = sxp.child_value(c, "dev")
+                try:
+                    currentDev = int(currentDev)
+                except:
+                    currentDev = blkdev_name_to_number(currentDev)
+
+                if currentDev == device:
+                    self.info['device'].remove((t,c))
+                    break
+
+        self.destroyDevice(type, dev)
 
     def device_configure(self, dev_config, devid):
         """Configure an existing device.
diff -r 2b45f4c5a565 -r c7b558e88f08 tools/python/xen/xend/server/SrvDomain.py
--- a/tools/python/xen/xend/server/SrvDomain.py Wed Nov 30 20:19:15 2005
+++ b/tools/python/xen/xend/server/SrvDomain.py Wed Nov 30 20:21:15 2005
@@ -155,7 +155,7 @@
                          req)
 
     def op_device_destroy(self, _, req):
-        return self.call(self.dom.destroyDevice,
+        return self.call(self.dom.device_destroy,
                          [['type', 'str'],
                           ['dev',  'str']],
                          req)
-- 
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: danms@xxxxxxxxxx
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] Fix "xm list --long" listing for removed devices, Dan Smith <=