| 
    
 [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] changing vcpus on running domain
 Hi All,
xen-3.3-testing c/s 18434
I'm hoping someone can help me understand the behavior of changing
number of vcpus (e.g. "xm vcpu-set dom #") on a running domain.  I'm
quite confused by the code in tools/python/xen/xend/XendDomainInfo.py
    def setVCpuCount(self, vcpus):
        if vcpus <= 0:
            raise XendError('Invalid VCPUs')
       
The following bitmap will be problematic with Jan's work to increase
number of cpus supported but thats a different issue :-)
        self.info['vcpu_avail'] = (1 << vcpus) - 1
        if self.domid >= 0:
            self.storeVm('vcpu_avail', self.info['vcpu_avail'])
            # update dom differently depending on whether we are adjusting
            # vcpu number up or down, otherwise _vcpuDomDetails does not
            # disable the vcpus
            if self.info['VCPUs_max'] > vcpus:
                # decreasing
                self._writeDom(self._vcpuDomDetails())
                self.info['VCPUs_live'] = vcpus
            else:
                # same or increasing
                self.info['VCPUs_live'] = vcpus
                self._writeDom(self._vcpuDomDetails())
             ...
I'm not sure what the difference is between these two conditions? 
VCPUS_live is not used anywhere, so essentially you get the same
behavior regardless of the condition.  Further, according to comments
regarding VCPUs_max in XendConfig.py, increasing vcpus > VCPUs_max
should not be allowed.  Should the else simply be a failure?
I see strange results when attempting to decrease the number of vcpus
jjfehlig4:~ # xm li
Name                                        ID   Mem VCPUs      State  
Time(s)
Domain-0                                     0  1481     4     r-----   
372.2
test-pv                                           7   512     4    
r-----      2.0
fehlig4:~ # xm li -l test-pv | grep -i cpu
    (vcpus 4)
    (cpu_time 14.310619269)
    (online_vcpus 4)
OK, looks good.  Now decrease vcpus
jfehlig4:~ # xm vcpu-set test-pv 2
jfehlig4:~ # xm li
Name                                        ID   Mem VCPUs      State  
Time(s)
Domain-0                                     0  1481     4     r-----   
372.7
test-pv                                           7   512     3    
-b----      5.7
fehlig4:~ # xm li -l test-pv | grep -i cpu
    (vcpus 4)
    (cpu_time 14.689999154)
    (online_vcpus 3) 
Strange, why 3 vcpus when I decreased to 2?  BTW, this is always the
case - decrease vcpus to n and online_vcpus = n+1.
I'll continue digging but any insight as to how this code should work
would be appreciated :-).
Thanks,
Jim
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
  | 
  
![]()  | 
            
         Lists.xenproject.org is hosted with RackSpace, monitoring our  |