From: Alastair Tse Date: Fri, 3 Nov 2006 10:39:32 +0000 (+0000) Subject: [XEND][XM] Restore old state string in xm. X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=38a1a1649442218474ce59fc64c0bde9f9d74421;p=xen.git [XEND][XM] Restore old state string in xm. Signed-off-by: Alastair Tse --- diff --git a/tools/python/xen/xend/XendConfig.py b/tools/python/xen/xend/XendConfig.py index 823ffedd73..aff91825af 100644 --- a/tools/python/xen/xend/XendConfig.py +++ b/tools/python/xen/xend/XendConfig.py @@ -603,7 +603,17 @@ class XendConfig(dict): def _populate_from_python_config(self, parsed_py): raise NotImplementedError - + + def _get_old_state_string(self): + state_string = '' + for state_name in CONFIG_OLD_DOM_STATES: + on_off = self.get(state_name, 0) + if on_off: + state_string += state_name[0] + else: + state_string += '-' + + return state_string def get_sxp(self, domain = None, ignore_devices = False, ignore = []): """ Get SXP representation of this config object. @@ -650,6 +660,8 @@ class XendConfig(dict): else: sxpr.append(['status', str(DOM_STATE_HALTED)]) + sxpr.append(['state', self._get_old_state_string()]) + # For save/restore migration if domain: if domain.store_mfn: diff --git a/tools/python/xen/xm/main.py b/tools/python/xen/xm/main.py index cfa7546092..2a3778c7c8 100644 --- a/tools/python/xen/xm/main.py +++ b/tools/python/xen/xm/main.py @@ -542,7 +542,7 @@ def parse_doms_info(info): 'name' : get_info('name', str, '??'), 'mem' : get_info('memory', int, 0), 'vcpus' : get_info('online_vcpus', int, 0), - 'status' : get_status('status', int, DOM_STATE_HALTED), + 'state' : get_info('state', str, ''), 'cpu_time' : get_info('cpu_time', float, 0), 'up_time' : get_info('up_time', float, -1), 'seclabel' : security.get_security_printlabel(info), @@ -566,7 +566,7 @@ def xm_brief_list(doms): print '%-40s %3s %5s %5s %10s %9s' % \ ('Name', 'ID', 'Mem', 'VCPUs', 'State', 'Time(s)') - format = "%(name)-40s %(domid)3d %(mem)5d %(vcpus)5d %(status)10s " \ + format = "%(name)-40s %(domid)3d %(mem)5d %(vcpus)5d %(state)10s " \ "%(cpu_time)8.1f" for dom in doms: @@ -578,7 +578,7 @@ def xm_label_list(doms): ('Name', 'ID', 'Mem', 'VCPUs', 'State', 'Time(s)', 'Label') output = [] - format = '%(name)-32s %(domid)3d %(mem)5d %(vcpus)5d %(status)10s ' \ + format = '%(name)-32s %(domid)3d %(mem)5d %(vcpus)5d %(state)10s ' \ '%(cpu_time)8.1f %(seclabel)9s' for dom in doms: