Check for valid CPU_CAP value when creating (constructing) new domain
PATCH 1/1 Check for valid CPU_CAP value when creating (constructing) new domain
Hi,
This patch implements check for valid cpu_cap value when creating domain (in range 0 to VcpuCount * 100 as when changing scheduler parameters).
tools/python/xen/xend/XendDomainInfo.py +5 -0
@@ -2305,6 +2305,11 @@ # Set maximum number of vcpus in domain xc.domain_max_vcpus(self.domid, int(self.info['VCPUs_max'])) + cap = self.getCap() + if cap < 0 or cap > self.info['VCPUs_max'] * 100: + raise VmError("Invalid CAP range, valid range is from 0 to %s for specified number of vcpus" % + (int(self.info['VCPUs_max']) * 100) ) + # Test whether the devices can be assigned with VT-d pci = self.info["platform"].get("pci") pci_str = ''
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
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
Quoted 13 lines · Michal Novotny
Hi,
This patch implements check for valid
cpu_capvalue when creating domain ( in range 0 to VcpuCount * 100 as when changing scheduler parameters).Signed-off-by Michal Novotny <[email protected]>-------------------------------text/plain-------------------------------
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
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
Quoted 28 lines · Masaki Kanno
Hi Michal,
Why does the patch implement only
CPU_CAP?
You should considerCPU_WEIGHTtoo.
And you should consider scheduler types too.Best regards,
KanQuoted 14 lines · Michal Novotny
Hi,
This patch implements check for valid
cpu_capvalue when creating domain ( in range 0 to VcpuCount * 100 as when changing scheduler parameters).Signed-off-by Michal Novotny <[email protected]>-------------------------------text/plain-------------------------------
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
tools/python/xen/xend/XendDomainInfo.py +14 -0
@@ -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
[email protected]
http://lists.xensource.com/xen-devel
Re: [PATCH] Check for valid CPU_CAP value when creating(constructing) new domain
Hi Michal,
I have added the following fixes to your patch.
- Check scheduler type
- Replace tab-indent with space-indent
How about the patch?
Best regards,
Kan
Quoted 38 lines · Michal Novotny
Hi Kan,
this is new version of my patch implementing check for bothCPU_CAPandCPU_WEIGHTand also considering int type for both (asserting it).Best regards,
MichalQuoted 28 lines · Masaki Kanno
Hi Michal,
Why does the patch implement only
CPU_CAP?
You should considerCPU_WEIGHTtoo.
And you should consider scheduler types too.Best regards,
KanQuoted 14 lines · Michal Novotny
Hi,
This patch implements check for valid
cpu_capvalue when creating domain ( in range 0 to VcpuCount * 100 as when changing scheduler parameters).Signed-off-by Michal Novotny <[email protected]>-------------------------------text/plain-------------------------------
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 5 lines
-------------------------------text/plain-------------------------------
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
tools/python/xen/xend/XendDomainInfo.py +15 -0
@@ -2305,6 +2305,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-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Re: [PATCH] Check for valid CPU_CAP value when creating(constructing) new domain
Hi Kan,
looks fine to me. Sorry about indents - I forgot I was writing it in gedit now and not Midnight Commander editor - and that I forgot about scheduler type.
Best regards,
Michal
Quoted 62 lines · Masaki Kanno
Hi Michal,
I have added the following fixes to your patch.
- Check scheduler type
- Replace tab-indent with space-indentHow about the patch?
Signed-off-by Michal Novotny <[email protected]>Signed-off-by Masaki Kanno <[email protected]>Best regards,
KanQuoted 44 lines · Michal Novotny
Hi Kan,
this is new version of my patch implementing check for bothCPU_CAPandCPU_WEIGHTand also considering int type for both (asserting it).Best regards,
MichalQuoted 30 lines · Masaki Kanno
Hi Michal,
Why does the patch implement only
CPU_CAP?
You should considerCPU_WEIGHTtoo.
And you should consider scheduler types too.Best regards,
KanQuoted 15 lines · Michal Novotny
Hi,
This patch implements check for valid
cpu_capvalue when creating domain ( in range 0 to VcpuCount * 100 as when changing scheduler parameters).Signed-off-by Michal Novotny <[email protected]>-------------------------------text/plain-------------------------------
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel-------------------------------text/plain-------------------------------
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel