From: Quentin Smith Date: Fri, 16 May 2008 00:58:19 +0000 (-0400) Subject: Compute uptime on the server so time drift doesn't cause problems X-Git-Tag: sipb-xen-remctl-auto/1.0.15^0 X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-remote.git/commitdiff_plain/ec9f34912b12e2e15f70b796e98a6ad53d4e336a?hp=e620ec46d10ab91f275abddfb0da7c54075df99f Compute uptime on the server so time drift doesn't cause problems svn path=/trunk/packages/sipb-xen-remctl-auto/; revision=533 --- diff --git a/debian/changelog b/debian/changelog index c3439d7..82f6cec 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +sipb-xen-remctl-auto (1.0.15) unstable; urgency=low + + * Compute time differences on server to avoid drift + + -- Quentin Smith Thu, 15 May 2008 20:58:04 -0400 + sipb-xen-remctl-auto (1.0.14) unstable; urgency=low * Use more efficient python API to get VM information, and return it diff --git a/files/usr/sbin/sipb-xen-listvms b/files/usr/sbin/sipb-xen-listvms index 7884d87..427a586 100755 --- a/files/usr/sbin/sipb-xen-listvms +++ b/files/usr/sbin/sipb-xen-listvms @@ -1,6 +1,7 @@ #!/usr/bin/python import sys +import time sys.path.insert(0, '/usr/lib/xen-3.1-1/lib/python') from xen.lowlevel.xs import xs @@ -8,7 +9,7 @@ trans = xs() def live_vms(): domids = set(trans.ls('', '/local/domain')) - domids.remove('0') + domids.discard('0') vms = dict() @@ -28,6 +29,7 @@ def get_dom(domid): # uptime data['vm'] = trans.read('', '/local/domain/%d/vm' % domid) data['start_time'] = float(trans.read('', '%s/start_time' % data['vm'])) + data['uptime'] = time.time()-data['start_time'] return name, data @@ -35,6 +37,6 @@ if __name__ == '__main__': vms = live_vms() if '--pickle' in sys.argv[1:]: import cPickle - cPickle.dump(vms, sys.stdout) + cPickle.dump(vms, sys.stdout, cPickle.HIGHEST_PROTOCOL) else: print vms