[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] [XEND][XM] Restore old state string in xm.



# HG changeset patch
# User Alastair Tse <atse@xxxxxxxxxxxxx>
# Node ID 374087600412d42bc63054207226c3c94b55570a
# Parent  f64cc6f50f6ee4d5035c618c8f446ddb74eb90d7
[XEND][XM] Restore old state string in xm.

Signed-off-by: Alastair Tse <atse@xxxxxxxxxxxxx>
---
 tools/python/xen/xend/XendConfig.py |   14 +++++++++++++-
 tools/python/xen/xm/main.py         |    6 +++---
 2 files changed, 16 insertions(+), 4 deletions(-)

diff -r f64cc6f50f6e -r 374087600412 tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py       Fri Nov 03 10:38:18 2006 +0000
+++ b/tools/python/xen/xend/XendConfig.py       Fri Nov 03 10:39:32 2006 +0000
@@ -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.
@@ -649,6 +659,8 @@ class XendConfig(dict):
             sxpr.append(['status', str(domain.state)])
         else:
             sxpr.append(['status', str(DOM_STATE_HALTED)])
+
+        sxpr.append(['state', self._get_old_state_string()])
 
         # For save/restore migration
         if domain:
diff -r f64cc6f50f6e -r 374087600412 tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py       Fri Nov 03 10:38:18 2006 +0000
+++ b/tools/python/xen/xm/main.py       Fri Nov 03 10:39:32 2006 +0000
@@ -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:

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.