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] xm: Sort pvSCSI devices information by vi

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xm: Sort pvSCSI devices information by virtual HCTL
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 11 Mar 2009 03:30:32 -0700
Delivery-date: Wed, 11 Mar 2009 03:31:33 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/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 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] xm: Sort pvSCSI devices information by virtual HCTL, Xen patchbot-unstable <=