[libvirt] [PATCH 19/27] conf: Add XML for individual vCPU hotplug

Pavel Hrdina phrdina at redhat.com
Fri Aug 12 08:29:53 UTC 2016

On Fri, Aug 05, 2016 at 03:56:15PM +0200, Peter Krempa wrote:
> Individual vCPU hotplug requires us to track the state of any vCPU. To
> allow this add the following XML:
> <domain>
>   ...
>   <vcpu current='1'>2</vcpu>
>   <vcpus>
>     <vcpu id='0' enabled='no' hotpluggable='yes'/>
>     <vcpu id='1' enabled='yes' hotpluggable='no' order='1'/>
>   </vcpus>
>   ...
> The 'enabled' attribute allows to control the state of the vcpu.
> 'hotpluggable' controls whether given vcpu can be hotplugged and 'order'
> allows to specify the order to add the vcpus.

Based on CPU arch there are some restriction how many vcpus must be plugged in
together, currently only for Power arch.  Based on configured topology we can
plug only whole cores, which means group of vcpus.  Because of this I would
suggest that we group those vcpus in the XML like this:

      <group id='1' enabled='yes' hotpluggable='no' order='1'>
        <vcpu id='0'/>
        <vcpu id='1'/>
      <group id='2' enabled='yes' hotpluggable='yes' order='2'>
        <vcpu id='2'/>
        <vcpu id='3'/>
      <group id='3' enabled='no' hotpluggable='yes'>
        <vcpu id='4'/>
        <vcpu id='5'/>
      <group id='4' enabled='no' hotpluggable='yes'>
        <vcpu id='6'/>
        <vcpu id='7'/>

we know the topology from XML and if none is provided the default is:

    <topology sockets='1' cores='n' threads='1'/>

If user changes the topology the vcpu configuration must be modified too and
this grouping would help to easily move/add/remove vcpus from groups or
add/remove the whole groups.


More information about the libvir-list mailing list