ia64/xen-unstable

changeset 8265:653d38c8fbc8

Change configuration handling wrt to the vcpus entry, so that we only see a
vcpus entry in the image section when using VMX, only add VMX options at all
if the builder is vmx, and issue a warning when overriding the global vcpus
setting with the one from the image.

This removes the duplicated vcpus entries in the domain's sxpr.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author emellor@leeni.uk.xensource.com
date Wed Dec 07 11:50:55 2005 +0000 (2005-12-07)
parents eae64901e428
children 91046e4a49dd
files tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xm/create.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Wed Dec 07 11:47:46 2005 +0000
     1.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Wed Dec 07 11:50:55 2005 +0000
     1.3 @@ -285,16 +285,18 @@ def parseConfig(config):
     1.4      for e in ROUNDTRIPPING_CONFIG_ENTRIES:
     1.5          result[e[0]] = get_cfg(e[0], e[1])
     1.6  
     1.7 -    result['cpu']       = get_cfg('cpu',       int)
     1.8 -    result['cpus']      = get_cfg('cpus',      str)
     1.9 -    result['image']     = get_cfg('image')
    1.10 +    result['cpu']   = get_cfg('cpu',  int)
    1.11 +    result['cpus']  = get_cfg('cpus', str)
    1.12 +    result['image'] = get_cfg('image')
    1.13  
    1.14      try:
    1.15          if result['image']:
    1.16 -            result['vcpus'] = int(sxp.child_value(result['image'],
    1.17 -                                                  'vcpus', 1))
    1.18 -        else:
    1.19 -            result['vcpus'] = 1
    1.20 +            v = sxp.child_value(result['image'], 'vcpus')
    1.21 +            if v is not None and int(v) != result['vcpus']:
    1.22 +                log.warn(('Image VCPUs setting overrides vcpus=%d elsewhere.'
    1.23 +                          '  Using %s VCPUs for VM %s.') %
    1.24 +                         (result['vcpus'], v, result['uuid']))
    1.25 +                result['vcpus'] = int(v)
    1.26      except TypeError, exn:
    1.27          raise VmError(
    1.28              'Invalid configuration setting: vcpus = %s: %s' %
     2.1 --- a/tools/python/xen/xm/create.py	Wed Dec 07 11:47:46 2005 +0000
     2.2 +++ b/tools/python/xen/xm/create.py	Wed Dec 07 11:50:55 2005 +0000
     2.3 @@ -424,8 +424,10 @@ def configure_image(vals):
     2.4          config_image.append(['root', cmdline_root])
     2.5      if vals.extra:
     2.6          config_image.append(['args', vals.extra])
     2.7 -    if vals.vcpus:
     2.8 -        config_image.append(['vcpus', vals.vcpus])
     2.9 +
    2.10 +    if vals.builder == 'vmx':
    2.11 +        configure_vmx(config_image, vals)
    2.12 +        
    2.13      return config_image
    2.14      
    2.15  def configure_disks(config_devs, vals):
    2.16 @@ -573,7 +575,7 @@ def make_config(vals):
    2.17                  config.append([n, v])
    2.18  
    2.19      map(add_conf, ['name', 'memory', 'ssidref', 'maxmem', 'restart',
    2.20 -                   'on_poweroff', 'on_reboot', 'on_crash'])
    2.21 +                   'on_poweroff', 'on_reboot', 'on_crash', 'vcpus'])
    2.22      
    2.23      if vals.cpu is not None:
    2.24          config.append(['cpu', vals.cpu])
    2.25 @@ -593,7 +595,6 @@ def make_config(vals):
    2.26          config_image = run_bootloader(vals)
    2.27      else:
    2.28          config_image = configure_image(vals)
    2.29 -    configure_vmx(config_image, vals)
    2.30      config.append(['image', config_image])
    2.31  
    2.32      config_devs = []