Improve xm vcpu-list command for inactive managed domains.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
This commit is contained in:
kfraser@localhost.localdomain committed 2007-07-19 17:17:25 +01:00
1 parent bd99184d54
commit 9d53b5f351
2 files changed
+34 -16

No files matched your search

+20 -9
View File
@@ -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)
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']]])
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
+14 -7
View File
@@ -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()
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.