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 1/2] xend: fix vcpu related items

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 1/2] xend: fix vcpu related items
From: Ryan Harper <ryanh@xxxxxxxxxx>
Date: Fri, 4 Nov 2005 16:24:30 -0600
Delivery-date: Fri, 04 Nov 2005 22:24:44 +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: Mutt/1.5.6+20040907i
This patch fixes a number of vcpu related issues.

1.  xm vcpu-list now shows info for all vcpus by using
    info['max_vcpu_id']+1 as end of the range to query
    vcpu_info.
2.  Add new vcpu fields, online_vcpus, max_vcpu_id to 
    XendDomainInfo.sxpr() 
3.  Remove filter_cpump() which isn't needed now that
    the per vcpu cpumap field is correct.
4.  Update xm/main.py to use online_vcpus as the number 
    vcpus to display in list.
   

-- 
Ryan Harper
Software Engineer; Linux Technology Center
IBM Corp., Austin, Tx
(512) 838-9253   T/L: 678-9253
ryanh@xxxxxxxxxx


diffstat output:
 xend/XendDomainInfo.py |   15 +++++++--------
 xm/main.py             |   14 +++++++-------
 2 files changed, 14 insertions(+), 15 deletions(-)

Signed-off-by: Ryan Harper <ryanh@xxxxxxxxxx>
---
diff -r 38f64b8f5839 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Thu Nov  3 23:27:01 2005
+++ b/tools/python/xen/xend/XendDomainInfo.py   Fri Nov  4 15:25:25 2005
@@ -426,8 +426,10 @@
             defaultInfo('cpu',          lambda: None)
             defaultInfo('cpu_weight',   lambda: 1.0)
             defaultInfo('vcpus',        lambda: int(1))
+            defaultInfo('online_vcpus', lambda: self.info['vcpus'])
 
             self.info['vcpus'] = int(self.info['vcpus'])
+            defaultInfo('max_vcpu_id',  lambda: self.info['vcpus']-1)
 
             defaultInfo('vcpu_avail',   lambda: (1 << self.info['vcpus']) - 1)
             defaultInfo('bootloader',   lambda: None)
@@ -963,6 +965,7 @@
         if self.infoIsSet('cpu_time'):
             sxpr.append(['cpu_time', self.info['cpu_time']/1e9])
         sxpr.append(['vcpus', self.info['vcpus']])
+        sxpr.append(['online_vcpus', self.info['online_vcpus']])
             
         if self.infoIsSet('start_time'):
             up_time =  time.time() - self.info['start_time']
@@ -979,16 +982,13 @@
 
     def getVCPUInfo(self):
         try:
-            def filter_cpumap(map, max):
-                return filter(lambda x: x >= 0, map[0:max])
-
             # We include the domain name and ID, to help xm.
             sxpr = ['domain',
                     ['domid',      self.domid],
                     ['name',       self.info['name']],
-                    ['vcpu_count', self.info['vcpus']]]
-
-            for i in range(0, self.info['vcpus']):
+                    ['vcpu_count', self.info['online_vcpus']]]
+
+            for i in range(0, self.info['max_vcpu_id']+1):
                 info = xc.vcpu_getinfo(self.domid, i)
 
                 sxpr.append(['vcpu',
@@ -998,8 +998,7 @@
                              ['running',  info['running']],
                              ['cpu_time', info['cpu_time'] / 1e9],
                              ['cpu',      info['cpu']],
-                             ['cpumap',   filter_cpumap(info['cpumap'],
-                                                        self.info['vcpus'])]])
+                             ['cpumap',   info['cpumap']]])
 
             return sxpr
 
diff -r 38f64b8f5839 tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py       Thu Nov  3 23:27:01 2005
+++ b/tools/python/xen/xm/main.py       Fri Nov  4 15:25:25 2005
@@ -260,13 +260,13 @@
         return t(sxp.child_value(info, n, d))
     
     return {
-        'dom'      : get_info('domid',    int,   -1),
-        'name'     : get_info('name',     str,   '??'),
-        'mem'      : get_info('memory',   int,   0),
-        'vcpus'    : get_info('vcpus',    int,   0),
-        'state'    : get_info('state',    str,   '??'),
-        'cpu_time' : get_info('cpu_time', float, 0),
-        'ssidref'  : get_info('ssidref',  int,   0),
+        'dom'      : get_info('domid',        int,   -1),
+        'name'     : get_info('name',         str,   '??'),
+        'mem'      : get_info('memory',       int,   0),
+        'vcpus'    : get_info('online_vcpus', int,   0),
+        'state'    : get_info('state',        str,   '??'),
+        'cpu_time' : get_info('cpu_time',     float, 0),
+        'ssidref'  : get_info('ssidref',      int,   0),
         }
 
 

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH 1/2] xend: fix vcpu related items, Ryan Harper <=