[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] Check for valid CPU_CAP value when creating (constructing) new domain



Hi Kan,
this is new version of my patch implementing check for both CPU_CAP and CPU_WEIGHT and also considering int type for both (asserting it).

Best regards,
Michal

Masaki Kanno wrote:
Hi Michal,

Why does the patch implement only CPU_CAP?
You should consider CPU_WEIGHT too.
And you should consider scheduler types too.

Best regards,
 Kan

Mon, 30 Mar 2009 08:43:07 +0200, Michal Novotny wrote:

Hi,

This patch implements check for valid cpu_cap value when creating domain (
in range 0 to VcpuCount * 100 as when changing scheduler parameters).

Signed-off-by: Michal Novotny <minovotn@xxxxxxxxxx>


-------------------------------text/plain-------------------------------
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


diff -r 0b13d9787622 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Tue Mar 24 06:55:29 2009 +0000
+++ b/tools/python/xen/xend/XendDomainInfo.py   Mon Mar 30 09:27:37 2009 +0200
@@ -2305,6 +2305,20 @@
         # Set maximum number of vcpus in domain
         xc.domain_max_vcpus(self.domid, int(self.info['VCPUs_max']))
 
+       # Check for cpu_{cap|weight} validity
+       cap = self.getCap()
+       weight = self.getWeight()
+
+       assert type(weight) == int
+       assert type(cap) == int
+
+       if weight < 1 or weight > 65535:
+           raise VmError("Cpu weight out of range, valid values are within 
range from 1 to 65535")
+
+       if cap < 0 or cap > dominfo.getVCpuCount() * 100:
+           raise VmError("Cpu cap out of range, valid range is from 0 to %s 
for specified number of vcpus" %
+                         (dominfo.getVCpuCount() * 100))
+
         # Test whether the devices can be assigned with VT-d
         pci = self.info["platform"].get("pci")
         pci_str = ''
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.