[Kimchi-devel] [RFC] Allow user to specify max virtual cpus in template and guest

Lucio Correia luciojhc at linux.vnet.ibm.com
Wed Jan 13 17:48:36 UTC 2016


Current State
-------------
Currently we have the following values defined for a KVM guest created 
by Kimchi:

<vcpu placement='static' current='4'>252</vcpu>

<cpu>
     <topology sockets='63' cores='2' threads='2'/>
</cpu>

User specifies the processor topology (optional) and the number of 
virtual CPUs and sockets are calculated by Kimchi based on maximum 
supported by the hypervisor (varies with distro) this way:

maximum number of virtual cpus supported = 255 (taken from hypervisor)
processor topology: cores=2 , threads=2 (optionally specified by user)
number of virtual cpus per socket: cores * threads = 4 (from topology)
maximum number of sockets guest can have = int(255/4) = 63
maximum number of virtual cpus guest can use = 4 * 63 = 252


Proposal
--------
Allow user to specify the maximum number of virtual cpus for a template 
or guest (when this one is offline - not running).


Changes required
----------------
1) Backend

A) Add "maxvcpus" optional field to both template and guest APIs
Restrictions to be implemented on this value:
- must be a positive integer
- must be a multiple of (cores * threads)
- must be less than or equal the maximum number of virtual cpus 
supported by hypervisor

If not specified, the default value for maxvcpus will be the equivalent 
to one socket (that is, core * threads).


B) Change the way number of sockets is calculated:
maximum number of virtual cpus supported = 255 (taken from hypervisor)
topology: cores=2 , threads=2 (specified by user)
maximum number of virtual cpus guest can use = 100 (specified by user) 
number of virtual cpus per socket: cores * threads = 4 (from topology)
maximum number of sockets guest can have = int(100/4) = 25
maximum number of virtual cpus guest can use = 4 * 25 = 100

That would result in:
<vcpu placement='static' current='4'>100</vcpu>

<cpu>
<topology sockets='25' cores='2' threads='2'/>
</cpu>


C) Update/Add unit tests



2) Frontend

A) Edit Template, at "Processor" tab:
- change the current "CPU number" field to a -[]+ input field 
(increase/decrease)
- add a new -[]+ input field "Max CPU number" (increase/decrease) for 
user input of "max virtual CPUs". Restrictions from 1.A) apply here.

Despite it's in a different place, we may use a "More Options" artifact 
similar to the one proposed by Rodrigo Trujillo at "[RFC][Kimchi] Guest 
Max memory setup and update", to keep the same format.


B) Edit Guest, at "General" tab:
- add a new -[]+ input field "Max CPUs" (increase/decrease in terms of 
core * threads) for user input of "max virtual CPUs". This new field is 
only enabled if guest is not running. Restrictions from 1.A) apply here.


Let me know your thoughts.

Thanks,
-- 
Lucio Correia
Software Engineer
IBM LTC Brazil




More information about the Kimchi-devel mailing list