on openxencenter i use (not with xenapi.py):

self.all_vms = self.connection.VM.get_all_records\
                      (self.session_uuid)['Value']

metric = self.all_vms[ref]['metrics']
startup = 
self.humanize_time(self.get_seconds_difference(self.all_vm_metrics[metric]['start_time']))


functions are:

    def humanize_time(self, secs):
        string = ""
        mins, secs = divmod(secs, 60)
        hours, mins = divmod(mins, 60)
        days, hours = divmod(hours, 24)
        if days:
            string += "%02d days " % (days)
        if hours:
            string += "%02d hours " % (hours)
        if mins:
            string += "%02d minutes " % (mins)
        if secs:
            string += "%02d seconds " % (secs)
        return string

    def get_seconds_difference(self, toconvert):
        converted = datetime.datetime.strptime(str(toconvert),
"%Y%m%dT%H:%M:%SZ")
        totime = time.mktime(converted.timetuple())
        #FIXME
        return time.time()-totime-3600



2010/5/11 Sane, Abhijeet <[email protected]>:
> Hi,
>
> I want to know if it is possible to get the uptime of individual VM that are
> running on the Citrix host using the Citrix Xen python API..
>
> Something on the lines of ‘xm uptime’
>
>
>
> Regards
>
> Abhijeet Sane
>
> _______________________________________________
> xen-api mailing list
> [email protected]
> http://lists.xensource.com/mailman/listinfo/xen-api
>
>

_______________________________________________
xen-api mailing list
[email protected]
http://lists.xensource.com/mailman/listinfo/xen-api

Reply via email to