ia64/xen-unstable
changeset 14518:5f526fcc8e58
Add VM_metrics.start_time, and use this to implement xm uptime through the
Xen-API.
Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
Xen-API.
Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
author | Ewan Mellor <ewan@xensource.com> |
---|---|
date | Thu Mar 22 16:32:18 2007 +0000 (2007-03-22) |
parents | 4baae9f9fdbb |
children | b98832bcac53 |
files | tools/python/xen/xend/XendAPI.py tools/python/xen/xend/XendVMMetrics.py tools/python/xen/xm/main.py |
line diff
1.1 --- a/tools/python/xen/xend/XendAPI.py Thu Mar 22 14:31:03 2007 +0000 1.2 +++ b/tools/python/xen/xend/XendAPI.py Thu Mar 22 16:32:18 2007 +0000 1.3 @@ -1592,7 +1592,8 @@ class XendAPI(object): 1.4 'VCPUs_utilisation', 1.5 'VCPUs_CPU', 1.6 'VCPUs_flags', 1.7 - 'VCPUs_params'] 1.8 + 'VCPUs_params', 1.9 + 'start_time'] 1.10 VM_metrics_attr_rw = [] 1.11 VM_metrics_methods = [] 1.12 1.13 @@ -1623,6 +1624,9 @@ class XendAPI(object): 1.14 def VM_metrics_get_VCPUs_params(self, _, ref): 1.15 return xen_api_success(self._VM_metrics_get(ref).get_VCPUs_params()) 1.16 1.17 + def VM_metrics_get_start_time(self, _, ref): 1.18 + return xen_api_success(self._VM_metrics_get(ref).get_start_time()) 1.19 + 1.20 1.21 # Xen API: Class VBD 1.22 # ----------------------------------------------------------------
2.1 --- a/tools/python/xen/xend/XendVMMetrics.py Thu Mar 22 14:31:03 2007 +0000 2.2 +++ b/tools/python/xen/xend/XendVMMetrics.py Thu Mar 22 16:32:18 2007 +0000 2.3 @@ -113,6 +113,9 @@ class XendVMMetrics: 2.4 else: 2.5 return {} 2.6 2.7 + def get_start_time(self): 2.8 + return self.xend_domain_instance.info.get("start_time", -1) 2.9 + 2.10 def get_record(self): 2.11 return { 'uuid' : self.uuid, 2.12 'memory_actual' : self.get_memory_actual(), 2.13 @@ -120,5 +123,6 @@ class XendVMMetrics: 2.14 'VCPUs_utilisation' : self.get_VCPUs_utilisation(), 2.15 'VCPUs_CPU' : self.get_VCPUs_CPU(), 2.16 'VCPUs_flags' : self.get_VCPUs_flags(), 2.17 - 'VCPUs_params' : self.get_VCPUs_params() 2.18 + 'VCPUs_params' : self.get_VCPUs_params(), 2.19 + 'start_time' : self.get_start_time(), 2.20 }
3.1 --- a/tools/python/xen/xm/main.py Thu Mar 22 14:31:03 2007 +0000 3.2 +++ b/tools/python/xen/xm/main.py Thu Mar 22 16:32:18 2007 +0000 3.3 @@ -709,7 +709,8 @@ def getDomains(domain_names, state, full 3.4 'memory_actual': int(dom_metrics['memory_actual'])/1024, 3.5 'vcpus': dom_metrics['VCPUs_number'], 3.6 'state': '-----', 3.7 - 'cpu_time': dom_metrics['VCPUs_utilisation']}) 3.8 + 'cpu_time': dom_metrics['VCPUs_utilisation'], 3.9 + 'start_time': dom_metrics['start_time']}) 3.10 3.11 doms_sxp.append(['domain'] + map2sxp(dom_rec)) 3.12 doms_dict.append(dom_rec)