ia64/xen-unstable

changeset 1810:50578ac46943

bitkeeper revision 1.1101 (40f79e519lI13NKbQnWXSUm96J4p3w)

Merge labyrinth.cl.cam.ac.uk:/auto/groups/xeno/BK/xeno.bk
into labyrinth.cl.cam.ac.uk:/local/scratch/tw275/xeno.bk
author tw275@labyrinth.cl.cam.ac.uk
date Fri Jul 16 09:22:25 2004 +0000 (2004-07-16)
parents e6bff1f485f8 fae04444ff22
children bd80b2bba0ce
files BitKeeper/etc/logging_ok tools/python/xen/xend/XendDomainInfo.py
line diff
     1.1 --- a/BitKeeper/etc/logging_ok	Fri Jul 16 06:28:03 2004 +0000
     1.2 +++ b/BitKeeper/etc/logging_ok	Fri Jul 16 09:22:25 2004 +0000
     1.3 @@ -41,5 +41,6 @@ smh22@uridium.cl.cam.ac.uk
     1.4  sos22@labyrinth.cl.cam.ac.uk
     1.5  tlh20@elite.cl.cam.ac.uk
     1.6  tlh20@labyrinth.cl.cam.ac.uk
     1.7 +tw275@labyrinth.cl.cam.ac.uk
     1.8  tw275@striker.cl.cam.ac.uk
     1.9  xenbk@gandalf.hpl.hp.com
     2.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Fri Jul 16 06:28:03 2004 +0000
     2.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Fri Jul 16 09:22:25 2004 +0000
     2.3 @@ -13,6 +13,7 @@ import types
     2.4  import re
     2.5  import sys
     2.6  import os
     2.7 +import time
     2.8  
     2.9  from twisted.internet import defer
    2.10  #defer.Deferred.debug = 1
    2.11 @@ -331,6 +332,7 @@ class XendDomainInfo:
    2.12          self.config = None
    2.13          self.id = None
    2.14          self.dom = None
    2.15 +        self.startTime = None
    2.16          self.name = None
    2.17          self.memory = None
    2.18          self.image = None
    2.19 @@ -354,7 +356,7 @@ class XendDomainInfo:
    2.20      def setdom(self, dom):
    2.21          self.dom = int(dom)
    2.22          self.id = str(dom)
    2.23 -        
    2.24 +    
    2.25      def update(self, info):
    2.26          """Update with  info from xc.domain_getinfo().
    2.27          """
    2.28 @@ -392,7 +394,13 @@ class XendDomainInfo:
    2.29                  reason = shutdown_reason(self.info['shutdown_reason'])
    2.30                  sxpr.append(['shutdown_reason', reason])
    2.31              sxpr.append(['cpu', self.info['cpu']])
    2.32 -            sxpr.append(['cpu_time', self.info['cpu_time']/1e9])
    2.33 +            sxpr.append(['cpu_time', self.info['cpu_time']/1e9])    
    2.34 +            
    2.35 +            if self.startTime:
    2.36 +                upTime =  time.time() - self.startTime  
    2.37 +                sxpr.append(['up_time', str( upTime ) ] )
    2.38 +                sxpr.append(['start_time', str( self.startTime ) ] )
    2.39 +
    2.40          if self.console:
    2.41              sxpr.append(self.console.sxpr())
    2.42          if self.config:
    2.43 @@ -409,6 +417,10 @@ class XendDomainInfo:
    2.44              self.memory = int(sxp.child_value(config, 'memory'))
    2.45              if self.memory is None:
    2.46                  raise VmError('missing memory size')
    2.47 +
    2.48 +            if sxp.child_value( config, 'start_time' ) != None:
    2.49 +                self.startTime = float( sxp.child_value( config, 'start_time' ) )
    2.50 +
    2.51              self.configure_console()
    2.52              self.configure_restart()
    2.53              self.configure_backends()
    2.54 @@ -586,6 +598,9 @@ class XendDomainInfo:
    2.55                            % (name, memory))
    2.56          self.setdom(dom)
    2.57  
    2.58 +        if self.startTime == None:
    2.59 +            self.startTime = time.time()
    2.60 +
    2.61      def build_domain(self, ostype, kernel, ramdisk, cmdline, vifs_n):
    2.62          """Build the domain boot image.
    2.63          """