ia64/xen-unstable

changeset 12998:ecc16f3222dc

When recreating the record for dom 0, read the current VCPU settings from Xen,
rather than from the store, allowing boot-time configuration to take precedence.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Wed Dec 13 14:36:36 2006 +0000 (2006-12-13)
parents 478ddc354ccd
children 462b945e2f41
files tools/python/xen/xend/XendDomainInfo.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Wed Dec 13 11:32:04 2006 +0000
     1.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Wed Dec 13 14:36:36 2006 +0000
     1.3 @@ -167,7 +167,7 @@ def recreate(info, priv):
     1.4  
     1.5      @param xeninfo: Parsed configuration
     1.6      @type  xeninfo: Dictionary
     1.7 -    @param priv: TODO, unknown, something to do with memory
     1.8 +    @param priv: Is a privileged domain (Dom 0)
     1.9      @type  priv: bool
    1.10  
    1.11      @rtype:  XendDomainInfo
    1.12 @@ -381,7 +381,7 @@ class XendDomainInfo:
    1.13          @type    dompath: string
    1.14          @keyword augment: Augment given info with xenstored VM info
    1.15          @type    augment: bool
    1.16 -        @keyword priv: Is a privledged domain (Dom 0) (TODO: really?)
    1.17 +        @keyword priv: Is a privileged domain (Dom 0)
    1.18          @type    priv: bool
    1.19          @keyword resume: Is this domain being resumed?
    1.20          @type    resume: bool
    1.21 @@ -647,6 +647,8 @@ class XendDomainInfo:
    1.22          if priv:
    1.23              augment_entries.remove('memory')
    1.24              augment_entries.remove('maxmem')
    1.25 +            augment_entries.remove('vcpus')
    1.26 +            augment_entries.remove('vcpu_avail')
    1.27  
    1.28          vm_config = self._readVMDetails([(k, XendConfig.LEGACY_CFG_TYPES[k])
    1.29                                           for k in augment_entries])
    1.30 @@ -664,6 +666,14 @@ class XendDomainInfo:
    1.31                  else:
    1.32                      self.info[arg] = val
    1.33  
    1.34 +        # For dom0, we ignore any stored value for the vcpus fields, and
    1.35 +        # read the current value from Xen instead.  This allows boot-time
    1.36 +        # settings to take precedence over any entries in the store.
    1.37 +        if priv:
    1.38 +            xeninfo = dom_get(self.domid)
    1.39 +            self.info['vcpus_number'] = xeninfo['online_vcpus']
    1.40 +            self.info['vcpu_avail'] = (1 << xeninfo['online_vcpus']) - 1
    1.41 +
    1.42          # read image value
    1.43          image_sxp = self._readVm('image')
    1.44          if image_sxp: