Bug 1370043

Summary: vcpu order doesn't work as expected
Product: [Community] Virtualization Tools Reporter: Luyao Huang <lhuang>
Component: libvirtAssignee: Peter Krempa <pkrempa>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: libvirt-maint, pkrempa, rbalakri
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-08-26 15:37:53 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Luyao Huang 2016-08-25 07:05:37 UTC
Description of problem:
vcpu order doesn't work

Version-Release number of selected component (if applicable):
v2.1.0-209-ge3229f6

How reproducible:
100%

Steps to Reproduce:
1.
# virsh dumpxml r7 --inactive
<domain type='kvm'>
  <name>r7</name>
  <uuid>67c7a123-5415-4136-af62-a2ee098ba6cd</uuid>
  <maxMemory slots='16' unit='KiB'>15242882</maxMemory>
  <memory unit='KiB'>2228224</memory>
  <currentMemory unit='KiB'>2228224</currentMemory>
  <vcpu placement='static' current='1'>10</vcpu>
  <vcpus>
    <vcpu id='0' enabled='yes' hotpluggable='no' order='1'/>
    <vcpu id='1' enabled='no' hotpluggable='yes' order='8'/>
    <vcpu id='2' enabled='no' hotpluggable='yes' order='3'/>
    <vcpu id='3' enabled='no' hotpluggable='yes' order='4'/>
    <vcpu id='4' enabled='no' hotpluggable='yes' order='5'/>
    <vcpu id='5' enabled='no' hotpluggable='yes' order='6'/>
    <vcpu id='6' enabled='no' hotpluggable='yes' order='7'/>
    <vcpu id='7' enabled='no' hotpluggable='yes' order='2'/>
    <vcpu id='8' enabled='no' hotpluggable='yes' order='9'/>
    <vcpu id='9' enabled='no' hotpluggable='yes' order='10'/>
  </vcpus>


2. 

# virsh start r7
Domain r7 started


3. check xml and order disappear:

# virsh dumpxml r7
<domain type='kvm' id='18'>
  <name>r7</name>
  <uuid>67c7a123-5415-4136-af62-a2ee098ba6cd</uuid>
  <maxMemory slots='16' unit='KiB'>15243264</maxMemory>
  <memory unit='KiB'>2228224</memory>
  <currentMemory unit='KiB'>2228224</currentMemory>
  <vcpu placement='static' current='1'>10</vcpu>
  <vcpus>
    <vcpu id='0' enabled='yes' hotpluggable='no' order='1'/>
    <vcpu id='1' enabled='no' hotpluggable='yes'/>
    <vcpu id='2' enabled='no' hotpluggable='yes'/>
    <vcpu id='3' enabled='no' hotpluggable='yes'/>
    <vcpu id='4' enabled='no' hotpluggable='yes'/>
    <vcpu id='5' enabled='no' hotpluggable='yes'/>
    <vcpu id='6' enabled='no' hotpluggable='yes'/>
    <vcpu id='7' enabled='no' hotpluggable='yes'/>
    <vcpu id='8' enabled='no' hotpluggable='yes'/>
    <vcpu id='9' enabled='no' hotpluggable='yes'/>
  </vcpus>


4. hotplug vcpu:

# virsh setvcpus r7 2

5.

# virsh dumpxml r7
<domain type='kvm' id='18'>
  <name>r7</name>
  <uuid>67c7a123-5415-4136-af62-a2ee098ba6cd</uuid>
  <maxMemory slots='16' unit='KiB'>15243264</maxMemory>
  <memory unit='KiB'>2228224</memory>
  <currentMemory unit='KiB'>2228224</currentMemory>
  <vcpu placement='static' current='2'>10</vcpu>
  <vcpus>
    <vcpu id='0' enabled='yes' hotpluggable='no' order='1'/>
    <vcpu id='1' enabled='yes' hotpluggable='yes' order='2'/>
    <vcpu id='2' enabled='no' hotpluggable='yes'/>
    <vcpu id='3' enabled='no' hotpluggable='yes'/>
    <vcpu id='4' enabled='no' hotpluggable='yes'/>
    <vcpu id='5' enabled='no' hotpluggable='yes'/>
    <vcpu id='6' enabled='no' hotpluggable='yes'/>
    <vcpu id='7' enabled='no' hotpluggable='yes'/>
    <vcpu id='8' enabled='no' hotpluggable='yes'/>
    <vcpu id='9' enabled='no' hotpluggable='yes'/>
  </vcpus>


Actual results:
order disappear during guest start

Expected results:

from libvirt.org:

order allows to specify the order to add the vcpus. For hypervisors/platforms that require to insert multiple vcpus at once the order may be be duplicated accross all vcpus that need to be enabled at once. Specifying order is not necessary, vcpus are then added in an arbitrary order.

I cannot find why libvirt will ignore this configuration from the document

Additional info:

Comment 1 Peter Krempa 2016-08-26 15:37:53 UTC
I've clarified the upstream docs:

commit 54147fd9be31838904f6f2251510da91a1bd0ca7
Author: Peter Krempa <pkrempa>
Date:   Thu Aug 25 11:41:44 2016 -0400

    doc: clarify documentation for vcpu order
    
    Make it clear that vcpu order is valid for online vcpus only and state
    that it has to be specified for all vcpus or not provided at all.