direct-io.hg

changeset 12222:374087600412

[XEND][XM] Restore old state string in xm.

Signed-off-by: Alastair Tse <atse@xensource.com>
author Alastair Tse <atse@xensource.com>
date Fri Nov 03 10:39:32 2006 +0000 (2006-11-03)
parents f64cc6f50f6e
children 4ff83eddd1f6
files tools/python/xen/xend/XendConfig.py tools/python/xen/xm/main.py
line diff
     1.1 --- a/tools/python/xen/xend/XendConfig.py	Fri Nov 03 10:38:18 2006 +0000
     1.2 +++ b/tools/python/xen/xend/XendConfig.py	Fri Nov 03 10:39:32 2006 +0000
     1.3 @@ -603,7 +603,17 @@ class XendConfig(dict):
     1.4  
     1.5      def _populate_from_python_config(self, parsed_py):
     1.6          raise NotImplementedError
     1.7 -        
     1.8 +
     1.9 +    def _get_old_state_string(self):
    1.10 +        state_string = ''
    1.11 +        for state_name in CONFIG_OLD_DOM_STATES:
    1.12 +            on_off = self.get(state_name, 0)
    1.13 +            if on_off:
    1.14 +                state_string += state_name[0]
    1.15 +            else:
    1.16 +                state_string += '-'
    1.17 +
    1.18 +        return state_string
    1.19  
    1.20      def get_sxp(self, domain = None, ignore_devices = False, ignore = []):
    1.21          """ Get SXP representation of this config object.
    1.22 @@ -650,6 +660,8 @@ class XendConfig(dict):
    1.23          else:
    1.24              sxpr.append(['status', str(DOM_STATE_HALTED)])
    1.25  
    1.26 +        sxpr.append(['state', self._get_old_state_string()])
    1.27 +
    1.28          # For save/restore migration
    1.29          if domain:
    1.30              if domain.store_mfn:
     2.1 --- a/tools/python/xen/xm/main.py	Fri Nov 03 10:38:18 2006 +0000
     2.2 +++ b/tools/python/xen/xm/main.py	Fri Nov 03 10:39:32 2006 +0000
     2.3 @@ -542,7 +542,7 @@ def parse_doms_info(info):
     2.4          'name'     : get_info('name',         str,   '??'),
     2.5          'mem'      : get_info('memory',       int,   0),
     2.6          'vcpus'    : get_info('online_vcpus', int,   0),
     2.7 -        'status'   : get_status('status',     int,   DOM_STATE_HALTED),
     2.8 +        'state'    : get_info('state',        str,    ''),
     2.9          'cpu_time' : get_info('cpu_time',     float, 0),
    2.10          'up_time'  : get_info('up_time',      float, -1),
    2.11          'seclabel' : security.get_security_printlabel(info),
    2.12 @@ -566,7 +566,7 @@ def xm_brief_list(doms):
    2.13      print '%-40s %3s %5s %5s %10s %9s' % \
    2.14            ('Name', 'ID', 'Mem', 'VCPUs', 'State', 'Time(s)')
    2.15      
    2.16 -    format = "%(name)-40s %(domid)3d %(mem)5d %(vcpus)5d %(status)10s " \
    2.17 +    format = "%(name)-40s %(domid)3d %(mem)5d %(vcpus)5d %(state)10s " \
    2.18               "%(cpu_time)8.1f"
    2.19      
    2.20      for dom in doms:
    2.21 @@ -578,7 +578,7 @@ def xm_label_list(doms):
    2.22            ('Name', 'ID', 'Mem', 'VCPUs', 'State', 'Time(s)', 'Label')
    2.23      
    2.24      output = []
    2.25 -    format = '%(name)-32s %(domid)3d %(mem)5d %(vcpus)5d %(status)10s ' \
    2.26 +    format = '%(name)-32s %(domid)3d %(mem)5d %(vcpus)5d %(state)10s ' \
    2.27               '%(cpu_time)8.1f %(seclabel)9s'
    2.28      
    2.29      for dom in doms: