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

[Xen-changelog] [xen-unstable] xend: Check for valid CPU_CAP value when creating new domain



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1238501947 -3600
# Node ID 156093ff80678fb93cd9f88861452a775e330441
# Parent  f9501b0bcc1b421a7add49dfefce5cc448df3b8d
xend: Check for valid CPU_CAP value when creating new domain

Signed-off-by: Michal Novotny <minovotn@xxxxxxxxxx>
Signed-off-by: Masaki Kanno <kanno.masaki@xxxxxxxxxxxxxx>
---
 tools/python/xen/xend/XendDomainInfo.py |   15 +++++++++++++++
 1 files changed, 15 insertions(+)

diff -r f9501b0bcc1b -r 156093ff8067 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Tue Mar 31 13:17:48 2009 +0100
+++ b/tools/python/xen/xend/XendDomainInfo.py   Tue Mar 31 13:19:07 2009 +0100
@@ -2313,6 +2313,21 @@ class XendDomainInfo:
         # Set maximum number of vcpus in domain
         xc.domain_max_vcpus(self.domid, int(self.info['VCPUs_max']))
 
+        # Check for cpu_{cap|weight} validity for credit scheduler
+        if XendNode.instance().xenschedinfo() == 'credit':
+            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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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