ia64/xen-unstable

changeset 15218:16e376ed5638

xm: Extend width of ID in 'xm list' to 5 digits.

The Domain ID is currently expected to fit in 3 digits.

When doing extensive testing on SAVE/RESTORE I can easily get ID's
into the 4-digit range, which makes some of the formatting to get out
of sync. Extend the width to 5 digits (and change some %-ns to %ns, as
the ID for example is right justified, %-ns is left-justified, which
didn't look too good).

Signed-off-by: Mats Petersson <mats.petersson@amd.com>
author kfraser@localhost.localdomain
date Thu May 24 15:45:43 2007 +0100 (2007-05-24)
parents d1cce5bafe28
children d93e560c1d50
files tools/python/xen/xm/main.py
line diff
     1.1 --- a/tools/python/xen/xm/main.py	Thu May 24 15:40:54 2007 +0100
     1.2 +++ b/tools/python/xen/xm/main.py	Thu May 24 15:45:43 2007 +0100
     1.3 @@ -917,10 +917,10 @@ def domid_match(domid, info):
     1.4             domid == str(info['domid'])
     1.5  
     1.6  def xm_brief_list(doms):
     1.7 -    print '%-40s %3s %5s %5s %10s %9s' % \
     1.8 +    print '%-40s %5s %5s %5s %10s %9s' % \
     1.9            ('Name', 'ID', 'Mem', 'VCPUs', 'State', 'Time(s)')
    1.10      
    1.11 -    format = "%(name)-40s %(domid)3s %(mem)5d %(vcpus)5d %(state)10s " \
    1.12 +    format = "%(name)-40s %(domid)5s %(mem)5d %(vcpus)5d %(state)10s " \
    1.13               "%(cpu_time)8.1f"
    1.14      
    1.15      for dom in doms:
    1.16 @@ -928,11 +928,11 @@ def xm_brief_list(doms):
    1.17          print format % d
    1.18  
    1.19  def xm_label_list(doms):
    1.20 -    print '%-32s %3s %5s %5s %5s %9s %-8s' % \
    1.21 +    print '%-32s %5s %5s %5s %5s %9s %-8s' % \
    1.22            ('Name', 'ID', 'Mem', 'VCPUs', 'State', 'Time(s)', 'Label')
    1.23      
    1.24      output = []
    1.25 -    format = '%(name)-32s %(domid)3s %(mem)5d %(vcpus)5d %(state)10s ' \
    1.26 +    format = '%(name)-32s %(domid)5s %(mem)5d %(vcpus)5d %(state)10s ' \
    1.27               '%(cpu_time)8.1f %(seclabel)9s'
    1.28  
    1.29      if serverType != SERVER_XEN_API:
    1.30 @@ -1022,10 +1022,10 @@ def xm_vcpu_list(args):
    1.31              doms = server.xend.domains(False)
    1.32              dominfo = map(server.xend.domain.getVCPUInfo, doms)
    1.33  
    1.34 -    print '%-32s %3s %5s %5s %5s %9s %s' % \
    1.35 +    print '%-32s %5s %5s %5s %5s %9s %s' % \
    1.36            ('Name', 'ID', 'VCPU', 'CPU', 'State', 'Time(s)', 'CPU Affinity')
    1.37  
    1.38 -    format = '%(name)-32s %(domid)3d %(number)5d %(c)5s %(s)5s ' \
    1.39 +    format = '%(name)-32s %(domid)5d %(number)5d %(c)5s %(s)5s ' \
    1.40               ' %(cpu_time)8.1f %(cpumap)s'
    1.41  
    1.42      for dom in dominfo:
    1.43 @@ -1423,7 +1423,7 @@ def xm_sched_sedf(args):
    1.44          info['period']  = ns_to_ms(info['period'])
    1.45          info['slice']   = ns_to_ms(info['slice'])
    1.46          info['latency'] = ns_to_ms(info['latency'])
    1.47 -        print( ("%(name)-32s %(domid)3d %(period)9.1f %(slice)9.1f" +
    1.48 +        print( ("%(name)-32s %(domid)5d %(period)9.1f %(slice)9.1f" +
    1.49                  " %(latency)7.1f %(extratime)6d %(weight)6d") % info)
    1.50  
    1.51      check_sched_type('sedf')
    1.52 @@ -1469,7 +1469,7 @@ def xm_sched_sedf(args):
    1.53  
    1.54      # print header if we aren't setting any parameters
    1.55      if len(opts.keys()) == 0:
    1.56 -        print '%-33s %-2s %-4s %-4s %-7s %-5s %-6s' % \
    1.57 +        print '%-33s %4s %-4s %-4s %-7s %-5s %-6s' % \
    1.58                ('Name','ID','Period(ms)', 'Slice(ms)', 'Lat(ms)',
    1.59                 'Extra','Weight')
    1.60      
    1.61 @@ -1533,7 +1533,7 @@ def xm_sched_credit(args):
    1.62              err("Domain '%s' does not exist." % domid)
    1.63              usage('sched-credit')
    1.64          # print header if we aren't setting any parameters
    1.65 -        print '%-33s %-2s %-6s %-4s' % ('Name','ID','Weight','Cap')
    1.66 +        print '%-33s %4s %6s %4s' % ('Name','ID','Weight','Cap')
    1.67          
    1.68          for d in doms:
    1.69              try:
    1.70 @@ -1555,7 +1555,7 @@ def xm_sched_credit(args):
    1.71              
    1.72              info['name']  = d['name']
    1.73              info['domid'] = int(d['domid'])
    1.74 -            print( ("%(name)-32s %(domid)3d %(weight)6d %(cap)4d") % info)
    1.75 +            print( ("%(name)-32s %(domid)5d %(weight)6d %(cap)4d") % info)
    1.76      else:
    1.77          if domid is None:
    1.78              # place holder for system-wide scheduler parameters
    1.79 @@ -1718,7 +1718,7 @@ def xm_uptime(args):
    1.80      doms = getDomains(params, 'running')
    1.81  
    1.82      if short_mode == 0:
    1.83 -        print 'Name                              ID Uptime'
    1.84 +        print '%-33s %4s %s ' % ('Name','ID','Uptime')
    1.85  
    1.86      for dom in doms:
    1.87          d = parse_doms_info(dom)
    1.88 @@ -1752,7 +1752,7 @@ def xm_uptime(args):
    1.89              upstring += ", " + d['name'] + " (" + d['domid'] + ")"
    1.90          else:
    1.91              upstring += ':%(seconds)02d' % vars()
    1.92 -            upstring = ("%(name)-32s %(domid)3s " % d) + upstring
    1.93 +            upstring = ("%(name)-32s %(domid)5s " % d) + upstring
    1.94  
    1.95          print upstring
    1.96