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

[Xen-changelog] [xen-unstable] Improve xm vcpu-list command for inactive managed domains.



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1184861845 -3600
# Node ID e934846666e6ef7e50322b8dd6244c7152c7d70a
# Parent  f85acff5bef548b934e3d8840a3eae01d2f38f7a
Improve xm vcpu-list command for inactive managed domains.
Signed-off-by: Masaki Kanno <kanno.masaki@xxxxxxxxxxxxxx>
---
 tools/python/xen/xend/XendDomainInfo.py |   31 +++++++++++++++++++++----------
 tools/python/xen/xm/main.py             |   21 ++++++++++++++-------
 2 files changed, 35 insertions(+), 17 deletions(-)

diff -r f85acff5bef5 -r e934846666e6 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Thu Jul 19 17:15:49 2007 +0100
+++ b/tools/python/xen/xend/XendDomainInfo.py   Thu Jul 19 17:17:25 2007 +0100
@@ -632,16 +632,27 @@ class XendDomainInfo:
                     ['vcpu_count', self.info['VCPUs_max']]]
 
             for i in range(0, self.info['VCPUs_max']):
-                info = xc.vcpu_getinfo(self.domid, i)
-
-                sxpr.append(['vcpu',
-                             ['number',   i],
-                             ['online',   info['online']],
-                             ['blocked',  info['blocked']],
-                             ['running',  info['running']],
-                             ['cpu_time', info['cpu_time'] / 1e9],
-                             ['cpu',      info['cpu']],
-                             ['cpumap',   info['cpumap']]])
+                if self.domid is not None:
+                    info = xc.vcpu_getinfo(self.domid, i)
+
+                    sxpr.append(['vcpu',
+                                 ['number',   i],
+                                 ['online',   info['online']],
+                                 ['blocked',  info['blocked']],
+                                 ['running',  info['running']],
+                                 ['cpu_time', info['cpu_time'] / 1e9],
+                                 ['cpu',      info['cpu']],
+                                 ['cpumap',   info['cpumap']]])
+                else:
+                    sxpr.append(['vcpu',
+                                 ['number',   i],
+                                 ['online',   0],
+                                 ['blocked',  0],
+                                 ['running',  0],
+                                 ['cpu_time', 0.0],
+                                 ['cpu',      -1],
+                                 ['cpumap',   self.info['cpus'] and \
+                                              self.info['cpus'] or range(64)]])
 
             return sxpr
 
diff -r f85acff5bef5 -r e934846666e6 tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py       Thu Jul 19 17:15:49 2007 +0100
+++ b/tools/python/xen/xm/main.py       Thu Jul 19 17:17:25 2007 +0100
@@ -1023,13 +1023,13 @@ def xm_vcpu_list(args):
         if args:
             dominfo = map(server.xend.domain.getVCPUInfo, args)
         else:
-            doms = server.xend.domains(False)
+            doms = server.xend.domains_with_state(False, 'all', False)
             dominfo = map(server.xend.domain.getVCPUInfo, doms)
 
     print '%-32s %5s %5s %5s %5s %9s %s' % \
           ('Name', 'ID', 'VCPU', 'CPU', 'State', 'Time(s)', 'CPU Affinity')
 
-    format = '%(name)-32s %(domid)5d %(number)5d %(c)5s %(s)5s ' \
+    format = '%(name)-32s %(domid)5s %(number)5d %(c)5s %(s)5s ' \
              ' %(cpu_time)8.1f %(cpumap)s'
 
     for dom in dominfo:
@@ -1098,8 +1098,12 @@ def xm_vcpu_list(args):
 
             return format_pairs(list_to_rangepairs(cpumap))
 
-        name  =     get_info('name')
-        domid = int(get_info('domid'))
+        name  = get_info('name')
+        domid = get_info('domid')
+        if domid is not None:
+            domid = str(domid)
+        else:
+            domid = ''
 
         for vcpu in sxp.children(dom, 'vcpu'):
             def vinfo(n, t):
@@ -1113,7 +1117,10 @@ def xm_vcpu_list(args):
             running  = vinfo('running',  int)
             blocked  = vinfo('blocked',  int)
 
-            if online:
+            if cpu < 0:
+                c = ''
+                s = ''
+            elif online:
                 c = str(cpu)
                 if running:
                     s = 'r'
@@ -1125,8 +1132,8 @@ def xm_vcpu_list(args):
                     s += '-'
                 s += '-'
             else:
-                c = "-"
-                s = "--p"
+                c = '-'
+                s = '--p'
 
             print format % locals()
 

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