All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ryan Harper <ryanh@us.ibm.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH 1/2][RESEND] xend: fix vcpu related items
Date: Tue, 8 Nov 2005 17:21:32 -0600	[thread overview]
Message-ID: <20051108232132.GA1858@us.ibm.com> (raw)

Resending, rediffed against changeset: 7701:abbe3df33774

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@us.ibm.com


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

Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
---
# HG changeset patch
# User rharper@localhost.localdomain
# Node ID 8780650bc95865aeea69f89511ce9b1be9dad82c
# Parent  7b01938105f9090d46e6e27e0a8d218d4c0be93c
fixup_vcpu_related_items.

diff -r 7b01938105f9 -r 8780650bc958 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py	Tue Nov  8 22:36:34 2005
+++ b/tools/python/xen/xend/XendDomainInfo.py	Tue Nov  8 22:37:05 2005
@@ -428,8 +428,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)
@@ -975,6 +977,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']
@@ -991,16 +994,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',
@@ -1010,8 +1010,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 7b01938105f9 -r 8780650bc958 tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py	Tue Nov  8 22:36:34 2005
+++ b/tools/python/xen/xm/main.py	Tue Nov  8 22:37:05 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),
         }

             reply	other threads:[~2005-11-08 23:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-08 23:21 Ryan Harper [this message]
2005-11-09 14:22 ` [PATCH 1/2][RESEND] xend: fix vcpu related items Ewan Mellor
2005-11-09 16:21   ` Ryan Harper
2005-11-14 18:59   ` Ryan Harper
2005-11-15 16:32     ` Ewan Mellor
2005-11-15 16:31 ` Ewan Mellor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051108232132.GA1858@us.ibm.com \
    --to=ryanh@us.ibm.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.