Skip to contentSkip to conversation

Fix xm vcpu-set command for when wrong number of VCPU is given

PATCH Superseded Masaki Kanno 1 participant 1 message Feb 17, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix xm vcpu-set command for when wrong number of VCPU is given

Hi,

The xm vcpu-set command is able to set zero to the number of VCPU of a domain. Therefore I think that it is a natural result that the xm start command fails. But I think that a xm vcpu-set command must fail usually.

# xm list
Name                                      ID   Mem VCPUs      State   Time(s)
Domain-0                                   0   942     2     r-----     75.2
vm1                                            256     2                 0.0
# xm vcpu-set vm1 0
# xm list
Name                                      ID   Mem VCPUs      State   Time(s)
Domain-0                                   0   942     2     r-----     76.2
vm1                                            256     0                 0.0
# xm start vm1
Error: (1, 'Internal error', 'launch_vm: SETVCPUCONTEXT failed (rc=-1)\n')
Usage: xm start <DomainName>

Start a Xend managed domain
-p, --paused Do not unpause domain after starting it

This patch checks the number of VCPU given by the xm vcpu-set command.

# xm list
Name                                      ID   Mem VCPUs      State   Time(s)
Domain-0                                   0   942     2     r-----     71.2
vm1                                            256     2                 0.0
# xm vcpu-set vm1 0
Error: Invalid VCPUs
Usage: xm vcpu-set <Domain> <vCPUs>

Set the number of active VCPUs for allowed for the domain.

Best regards,
Kan

tools/python/xen/xend/XendDomainInfo.py +3 -0
diff -r 32a059913591 tools/python/xen/xend/XendDomainInfo.py
@@ -913,6 +913,9 @@ class XendDomainInfo:
         return self.info['vcpus_number']
 
     def setVCpuCount(self, vcpus):
+        if vcpus <= 0:
+            raise XendError('Invalid VCPUs')
+        
         self.info['vcpu_avail'] = (1 << vcpus) - 1
         if self.domid >= 0:
             self.storeVm('vcpu_avail', self.info['vcpu_avail'])

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel