ia64/xen-unstable

changeset 7834:2acbe70dd418

This patch fixes dom0 SMP vcpu hotplug. Currently, domains without
config files (e.g. dom0) don't set info['vcpus'] correctly resulting in
incorrect cpu availablity values in the store. This prevents hotplug
from functioning.

Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
author emellor@leeni.uk.xensource.com
date Tue Nov 15 17:30:55 2005 +0100 (2005-11-15)
parents fcf13f653dba
children 5e111356ba17 fa76c455af35
files tools/python/xen/xend/XendDomainInfo.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Tue Nov 15 17:28:05 2005 +0100
     1.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Tue Nov 15 17:30:55 2005 +0100
     1.3 @@ -437,12 +437,18 @@ class XendDomainInfo:
     1.4              defaultInfo('on_crash',     lambda: "restart")
     1.5              defaultInfo('cpu',          lambda: None)
     1.6              defaultInfo('cpu_weight',   lambda: 1.0)
     1.7 -            defaultInfo('vcpus',        lambda: int(1))
     1.8 -            defaultInfo('online_vcpus', lambda: self.info['vcpus'])
     1.9  
    1.10 -            self.info['vcpus'] = int(self.info['vcpus'])
    1.11 +            # some domains don't have a config file (e.g. dom0 )
    1.12 +            # to set number of vcpus so we derive available cpus
    1.13 +            # from max_vcpu_id which is present for running domains.
    1.14 +            if not self.infoIsSet('vcpus') and self.infoIsSet('max_vcpu_id'):
    1.15 +                avail = int(self.info['max_vcpu_id'])+1
    1.16 +            else:
    1.17 +                avail = int(1)
    1.18 +
    1.19 +            defaultInfo('vcpus',        lambda: avail)
    1.20 +            defaultInfo('online_vcpus', lambda: self.info['vcpus'])
    1.21              defaultInfo('max_vcpu_id',  lambda: self.info['vcpus']-1)
    1.22 -
    1.23              defaultInfo('vcpu_avail',   lambda: (1 << self.info['vcpus']) - 1)
    1.24  
    1.25              defaultInfo('memory',       lambda: 0)