ia64/xen-unstable

changeset 19470:156093ff8067

xend: Check for valid CPU_CAP value when creating new domain

Signed-off-by: Michal Novotny <minovotn@redhat.com>
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Mar 31 13:19:07 2009 +0100 (2009-03-31)
parents f9501b0bcc1b
children b2b0825d6f8e
files tools/python/xen/xend/XendDomainInfo.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Tue Mar 31 13:17:48 2009 +0100
     1.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Tue Mar 31 13:19:07 2009 +0100
     1.3 @@ -2313,6 +2313,21 @@ class XendDomainInfo:
     1.4          # Set maximum number of vcpus in domain
     1.5          xc.domain_max_vcpus(self.domid, int(self.info['VCPUs_max']))
     1.6  
     1.7 +        # Check for cpu_{cap|weight} validity for credit scheduler
     1.8 +        if XendNode.instance().xenschedinfo() == 'credit':
     1.9 +            cap = self.getCap()
    1.10 +            weight = self.getWeight()
    1.11 +
    1.12 +            assert type(weight) == int
    1.13 +            assert type(cap) == int
    1.14 +
    1.15 +            if weight < 1 or weight > 65535:
    1.16 +                raise VmError("Cpu weight out of range, valid values are within range from 1 to 65535")
    1.17 +
    1.18 +            if cap < 0 or cap > dominfo.getVCpuCount() * 100:
    1.19 +                raise VmError("Cpu cap out of range, valid range is from 0 to %s for specified number of vcpus" %
    1.20 +                              (dominfo.getVCpuCount() * 100))
    1.21 +
    1.22          # Test whether the devices can be assigned with VT-d
    1.23          pci = self.info["platform"].get("pci")
    1.24          pci_str = ''