Added documentation, C bindings, and a test for VM_metrics.{start_time,

VCPUs_CPU,VCPUs_params}.

Changed VM_metrics.start_time to be a DateTime, not an integer.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
This commit is contained in:
Ewan Mellor committed 2007-04-09 17:09:21 +01:00
1 parent 668fbded84
commit 6492f2ffbf
11 files changed
+339 -3

No files matched your search

+10 -1
View File
@@ -87,7 +87,16 @@ def xen_api_todo():
def now():
return xmlrpclib.DateTime(time.strftime("%Y%m%dT%H:%M:%S", time.gmtime()))
return datetime()
def datetime(when = None):
"""Marshall the given time as a Xen-API DateTime.
@param when The time in question, given as seconds since the epoch, UTC.
May be None, in which case the current time is used.
"""
return xmlrpclib.DateTime(time.gmtime(when))
# ---------------------------------------------------
+3 -1
View File
@@ -138,7 +138,9 @@ class XendVMMetrics:
return {}
def get_start_time(self):
return self.xend_domain_instance.info.get("start_time", -1)
import xen.xend.XendAPI as XendAPI
return XendAPI.datetime(
self.xend_domain_instance.info.get("start_time", 0))
def get_last_updated(self):
import xen.xend.XendAPI as XendAPI
+6 -1
View File
@@ -731,6 +731,10 @@ def xm_restore(args):
server.xend.domain.restore(savefile, paused)
def datetime_to_secs(v):
return time.mktime(time.strptime(str(v) + 'UTC', '%Y%m%dT%H:%M:%S%Z'))
def getDomains(domain_names, state, full = 0):
if serverType == SERVER_XEN_API:
doms_sxp = []
@@ -756,7 +760,8 @@ def getDomains(domain_names, state, full = 0):
'vcpus': dom_metrics['VCPUs_number'],
'state': state_str,
'cpu_time': dom_metrics['VCPUs_utilisation'],
'start_time': dom_metrics['start_time']})
'start_time': datetime_to_secs(
dom_metrics['start_time'])})
doms_sxp.append(['domain'] + map2sxp(dom_rec))
doms_dict.append(dom_rec)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.