ia64/xen-unstable

changeset 8276:cdf76916951a

Read start_time and image from the store on restart. Closes bugs #441 and
#442.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author emellor@leeni.uk.xensource.com
date Thu Dec 08 12:10:22 2005 +0000 (2005-12-08)
parents 05b37057b1cf
children 8e74f2cf985e
files tools/python/xen/xend/XendDomainInfo.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Thu Dec 08 12:08:59 2005 +0000
     1.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Thu Dec 08 12:10:22 2005 +0000
     1.3 @@ -132,8 +132,8 @@ ROUNDTRIPPING_CONFIG_ENTRIES += VM_CONFI
     1.4  
     1.5  
     1.6  ##
     1.7 -# All entries written to the store.  This is VM_CONFIGURATION_PARAMS, plus
     1.8 -# those entries written to the store that cannot be reconfigured on-the-fly.
     1.9 +# All entries written to the store.  This is VM_CONFIG_PARAMS, plus those
    1.10 +# entries written to the store that cannot be reconfigured on-the-fly.
    1.11  #
    1.12  VM_STORE_ENTRIES = [
    1.13      ('uuid',       str),
    1.14 @@ -142,6 +142,7 @@ VM_STORE_ENTRIES = [
    1.15      ('vcpu_avail', int),
    1.16      ('memory',     int),
    1.17      ('maxmem',     int),
    1.18 +    ('start_time', int),
    1.19      ]
    1.20  
    1.21  VM_STORE_ENTRIES += VM_CONFIG_PARAMS
    1.22 @@ -448,7 +449,7 @@ class XendDomainInfo:
    1.23      ## private:
    1.24  
    1.25      def readVMDetails(self, params):
    1.26 -        """Read from the store all of those entries that we consider 
    1.27 +        """Read the specified parameters from the store.
    1.28          """
    1.29          try:
    1.30              return self.gatherVm(*params)
    1.31 @@ -475,6 +476,13 @@ class XendDomainInfo:
    1.32  
    1.33          map(f, VM_CONFIG_PARAMS, self.readVMDetails(VM_CONFIG_PARAMS))
    1.34  
    1.35 +        im = self.readVm('image')
    1.36 +        current_im = self.info['image']
    1.37 +        if (im is not None and
    1.38 +            (current_im is None or sxp.to_string(current_im) != im)):
    1.39 +            self.info['image'] = sxp.from_string(im)
    1.40 +            changed = True
    1.41 +
    1.42          if changed:
    1.43              # Update the domain section of the store, as this contains some
    1.44              # parameters derived from the VM configuration.
    1.45 @@ -498,6 +506,7 @@ class XendDomainInfo:
    1.46              entries.remove(('maxmem', int))
    1.47          else:
    1.48              entries = VM_STORE_ENTRIES
    1.49 +        entries.append(('image', str))
    1.50  
    1.51          map(lambda x, y: useIfNeeded(x[0], y), entries,
    1.52              self.readVMDetails(entries))
    1.53 @@ -651,9 +660,6 @@ class XendDomainInfo:
    1.54          if self.infoIsSet('image'):
    1.55              to_store['image'] = sxp.to_string(self.info['image'])
    1.56  
    1.57 -        if self.infoIsSet('start_time'):
    1.58 -            to_store['start_time'] = str(self.info['start_time'])
    1.59 -
    1.60          log.debug("Storing VM details: %s", to_store)
    1.61  
    1.62          self.writeVm(to_store)