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

[Xen-changelog] [xen-unstable] xm: Sort pvSCSI devices information by virtual HCTL



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1236766426 0
# Node ID 20a2e3f724d55446c22f5166bf89a6589a3f08f7
# Parent  cfacba42091c651290b025e6de7716ec860f448e
xm: Sort pvSCSI devices information by virtual HCTL

Signed-off-by: Masaki Kanno <kanno.masaki@xxxxxxxxxxxxxx>
---
 tools/python/xen/xm/main.py |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+)

diff -r cfacba42091c -r 20a2e3f724d5 tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py       Wed Mar 11 10:12:14 2009 +0000
+++ b/tools/python/xen/xm/main.py       Wed Mar 11 10:13:46 2009 +0000
@@ -2231,6 +2231,33 @@ def xm_pci_list_assignable_devices(args)
             print d.name,
         print
 
+def vscsi_sort(devs):
+    def sort_hctl(ds, l):
+        s = []
+        for d1 in ds:
+            for d2 in d1:
+                v_dev = sxp.child_value(d2, 'v-dev')
+                n = int(v_dev.split(':')[l])
+                try:
+                    j = s[n]
+                except IndexError:
+                    j = []
+                    s.extend([ [] for _ in range(len(s), n+1) ])
+                j.append(d2)
+                s[n] = j
+        return s
+
+    for i in range(len(devs)):
+        ds1 = [ devs[i][1][0][1] ]
+        ds1 = sort_hctl(ds1, 3)
+        ds1 = sort_hctl(ds1, 2)
+        ds1 = sort_hctl(ds1, 1)
+        ds2 = []
+        for d in ds1:
+            ds2.extend(d)
+        devs[i][1][0][1] = ds2
+    return devs
+
 def vscsi_convert_sxp_to_dict(dev_sxp):
     dev_dict = {}
     for opt_val in dev_sxp[1:]:
@@ -2270,6 +2297,9 @@ def xm_scsi_list(args):
 
     else:
         devs = server.xend.domain.getDeviceSxprs(dom, 'vscsi')
+
+    # Sort devs by virtual HCTL.
+    devs = vscsi_sort(devs)
 
     if use_long:
         map(PrettyPrint.prettyprint, devs)

_______________________________________________
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®.