ia64/xen-unstable

changeset 12871:8beecb8c5ae2

[XEND] Fix xm vcpu-set when decrementing VCPU count

Signed-off-by: Alastair Tse <atse@xensource.com>
author Alastair Tse <atse@xensource.com>
date Fri Dec 08 11:08:26 2006 +0000 (2006-12-08)
parents d3846d6f30d5
children df5fa63490f4
files tools/python/xen/xend/XendConfig.py tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xm/main.py
line diff
     1.1 --- a/tools/python/xen/xend/XendConfig.py	Fri Dec 08 10:48:46 2006 +0000
     1.2 +++ b/tools/python/xen/xend/XendConfig.py	Fri Dec 08 11:08:26 2006 +0000
     1.3 @@ -632,6 +632,9 @@ class XendConfig(dict):
     1.4          self['memory_dynamic_max'] = self['memory_static_max']
     1.5          self['memory_dynamic_min'] = self['memory_static_min']
     1.6  
     1.7 +        # make sure max_vcpu_id is set correctly
     1.8 +        self['max_vcpu_id'] = self['vcpus_number'] - 1
     1.9 +
    1.10          # set device references in the configuration
    1.11          self['devices'] = cfg.get('devices', {})
    1.12          
    1.13 @@ -714,7 +717,7 @@ class XendConfig(dict):
    1.14          _set_cfg_if_exists('on_xend_stop')
    1.15          _set_cfg_if_exists('on_xend_start')
    1.16          _set_cfg_if_exists('vcpu_avail')
    1.17 -        _set_cfg_if_exists('max_vcpu_id') # TODO, deprecated?
    1.18 +        _set_cfg_if_exists('max_vcpu_id') # needed for vcpuDomDetails
    1.19          
    1.20          # Parse and store runtime configuration 
    1.21          _set_cfg_if_exists('start_time')
     2.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Fri Dec 08 10:48:46 2006 +0000
     2.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Fri Dec 08 11:08:26 2006 +0000
     2.3 @@ -876,10 +876,18 @@ class XendDomainInfo:
     2.4  
     2.5      def setVCpuCount(self, vcpus):
     2.6          self.info['vcpu_avail'] = (1 << vcpus) - 1
     2.7 -        self.info['vcpus_number'] = vcpus
     2.8          self.storeVm('vcpu_avail', self.info['vcpu_avail'])
     2.9 -        self.storeVm('vcpus', self.info['vcpus_number'])
    2.10 -        self._writeDom(self._vcpuDomDetails())
    2.11 +        # update dom differently depending on whether we are adjusting
    2.12 +        # vcpu number up or down, otherwise _vcpuDomDetails does not
    2.13 +        # disable the vcpus
    2.14 +        if self.info['vcpus_number'] > vcpus:
    2.15 +            # decreasing
    2.16 +            self._writeDom(self._vcpuDomDetails())
    2.17 +            self.info['vcpus_number'] = vcpus
    2.18 +        else:
    2.19 +            # same or increasing
    2.20 +            self.info['vcpus_number'] = vcpus
    2.21 +            self._writeDom(self._vcpuDomDetails())
    2.22  
    2.23      def getLabel(self):
    2.24          return security.get_security_info(self.info, 'label')
     3.1 --- a/tools/python/xen/xm/main.py	Fri Dec 08 10:48:46 2006 +0000
     3.2 +++ b/tools/python/xen/xm/main.py	Fri Dec 08 11:08:26 2006 +0000
     3.3 @@ -643,7 +643,7 @@ def parse_doms_info(info):
     3.4          'domid'    : get_info('domid',        str,   ''),
     3.5          'name'     : get_info('name',         str,   '??'),
     3.6          'mem'      : get_info('memory_dynamic_min', int,   0),
     3.7 -        'vcpus'    : get_info('vcpus',        int,   0),
     3.8 +        'vcpus'    : get_info('online_vcpus',        int,   0),
     3.9          'state'    : get_info('state',        str,    ''),
    3.10          'cpu_time' : get_info('cpu_time',     float, 0),
    3.11          'up_time'  : up_time,