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] Fix 'xm vcpu-list'. List cpumap as 'CPU Affinity'. Use

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Fix 'xm vcpu-list'. List cpumap as 'CPU Affinity'. Use
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Sun, 23 Oct 2005 16:54:06 +0000
Delivery-date: Sun, 23 Oct 2005 16:51:45 +0000
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/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 kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID a2cf10b8da5a696075edb9b734d0b37aec0f0c74
# Parent  94cee9a918de7752881376fa3d376a2d0459c70d
Fix 'xm vcpu-list'. List cpumap as 'CPU Affinity'. Use
special descriptive strings for empty and full cpu maps.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>

diff -r 94cee9a918de -r a2cf10b8da5a tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py       Sat Oct 22 07:35:03 2005
+++ b/tools/python/xen/xm/main.py       Sat Oct 22 09:33:26 2005
@@ -274,7 +274,7 @@
 
 
 def xm_vcpu_list(args):
-    print 'Name                              ID  VCPU  CPU  State  Time(s)  
CPU Map'
+    print 'Name                              ID  VCPU  CPU  State  Time(s)  
CPU Affinity'
 
     from xen.xend.XendClient import server
     if args:
@@ -319,6 +319,8 @@
         # Convert pairs to range string, e.g: [(1,2),(3,3),(5,7)] -> 1-2,3,5-7
         #
         def format_pairs(pairs):
+            if not pairs:
+                return "no cpus"
             out = ""
             for f,s in pairs:
                 if (f==s):
@@ -330,24 +332,22 @@
             return out[:-1]
 
         def format_cpumap(cpumap):
-            def uniq(x):
-               return [ u for u in x if u not in locals()['_[1]'] ]
+            cpumap = map(lambda x: int(x), cpumap)
+            cpumap.sort()
 
             from xen.xend.XendClient import server
             for x in server.xend_node()[1:]:
                 if len(x) > 1 and x[0] == 'nr_cpus':
                     nr_cpus = int(x[1])
+                    cpumap = filter(lambda x: x < nr_cpus, cpumap)
+                    if len(cpumap) == nr_cpus:
+                        return "any cpu"
                     break
  
-            return format_pairs(
-                          list_to_rangepairs(
-                              map(lambda x: x % nr_cpus, 
-                                  uniq(map(lambda x: int(x), cpumap)) )))
-                
+            return format_pairs(list_to_rangepairs(cpumap))
 
         name  =     get_info('name')
         domid = int(get_info('domid'))
-
 
         for vcpu in sxp.children(dom, 'vcpu'):
             def vinfo(n, t):

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Fix 'xm vcpu-list'. List cpumap as 'CPU Affinity'. Use, Xen patchbot -unstable <=