Bug 1459785 - guest will have invalid config after use setvcpu to enable vcpu 0
guest will have invalid config after use setvcpu to enable vcpu 0
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt (Show other bugs)
7.4
x86_64 Linux
medium Severity medium
: rc
: ---
Assigned To: Peter Krempa
yalzhang@redhat.com
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-06-08 03:48 EDT by Luyao Huang
Modified: 2018-04-10 06:48 EDT (History)
5 users (show)

See Also:
Fixed In Version: libvirt-3.7.0-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2018-04-10 06:46:43 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2018:0704 None None None 2018-04-10 06:48 EDT

  None (edit)
Description Luyao Huang 2017-06-08 03:48:31 EDT
Description of problem:
guest will have invalid config after use setvcpu to enable vcpu 0

Version-Release number of selected component (if applicable):
libvirt-3.2.0-9.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. prepare a inactive guest:

# virsh dumpxml r7
...
  <vcpu placement='static' current='1'>8</vcpu>
  <vcpus>
    <vcpu id='0' enabled='yes' hotpluggable='no'/>
    <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'/>
  </vcpus>
...

2. use setvcpu to enable vcpu 0 again:

# virsh setvcpu r7 0 --enable


3. recheck xml:
# virsh dumpxml r7
...
  <vcpu placement='static' current='1'>8</vcpu>
  <vcpus>
    <vcpu id='0' enabled='yes' hotpluggable='yes'/>
    <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'/>
  </vcpus>
...

4. restart libvirtd and guest will disappear:

# service libvirtd restart
Redirecting to /bin/systemctl restart libvirtd.service

# virsh dumpxml r7
error: failed to get domain 'r7'
error: Domain not found: no domain with matching name 'r7'

5. log:

libvirtd: 2017-06-08 07:45:01.078+0000: 16072: error : qemuDomainDefVcpusPostParse:2658 : unsupported configuration: vcpu0 can't be hotpluggable

Actual results:

guest disappear after restart libvirtd

Expected results:

don't create a invalid guest xml

Additional info:
Comment 2 Peter Krempa 2017-06-28 08:26:57 EDT
Fixed upstream:

commit b183f17d76839587cbe411f4e12beca18d3ec702
Author: Peter Krempa <pkrempa@redhat.com>
Date:   Wed Jun 28 10:42:49 2017 +0200

    qemu: hotplug: Disallow modification of vcpu 0 in inactive config
    
    vcpu 0 must be always enabled and non-hotpluggable, thus you can't
    modify it using the vcpu hotplug APIs. Disallow it so that users can't
    create invalid configurations.
Comment 4 yalzhang@redhat.com 2017-10-18 04:03:03 EDT
Reproduce the bug on libvirt-3.2.0-14.el7_4.3.x86_64, then update libvirt to libvirt-3.8.0-1.el7.x86_64, the result is as expected. 

But I have another question:
when set " <vcpu placement='static' current='9'>8</vcpu> " by virsh edit, the xml validation failed with 

# virsh edit rhel7.4
error: unsupported configuration: maxvcpus must not be less than current vcpus (9 < 8)
Failed. Try again? [y,n,i,f,?]: 
 
I'm not sure if the "(9 < 8)" is appropriate here, would you please help to confirm? Thank you!

Test steps:
1. prepare a inactive vm rhel7.4
# virsh dumpxml rhel7.4 | grep /vcpus -B10
  <vcpu placement='static' current='1'>8</vcpu>
  <vcpus>
    <vcpu id='0' enabled='yes' hotpluggable='no'/>
    <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'/>
  </vcpus>

2. # virsh setvcpu rhel7.4 0 --enable
error: invalid argument: vCPU '0' can't be modified

# virsh dumpxml rhel7.4 | grep /vcpus -B10
  <vcpu placement='static' current='1'>8</vcpu>
  <vcpus>
    <vcpu id='0' enabled='yes' hotpluggable='no'/>
    <vcpu id='1' enabled='no' hotpluggable='yes'/>
...
  </vcpus>

# grep error /var/log/libvirt/libvirtd.log
2017-10-18 07:39:21.758+0000: 8057: error : qemuDomainVcpuValidateConfig:5961 : invalid argument: vCPU '0' can't be modified

3. # virsh setvcpu rhel7.4 0 --disable
error: invalid argument: vCPU '0' can't be modified

# grep error /var/log/libvirt/libvirtd.log
2017-10-18 07:39:21.758+0000: 8057: error : qemuDomainVcpuValidateConfig:5961 : invalid argument: vCPU '0' can't be modified
2017-10-18 07:39:48.797+0000: 8056: error : qemuDomainVcpuValidateConfig:5961 : invalid argument: vCPU '0' can't be modified

# systemctl restart libvirtd
# virsh dumpxml rhel7.4 | grep /vcpus -B10
  <vcpu placement='static' current='1'>8</vcpu>
  <vcpus>
    <vcpu id='0' enabled='yes' hotpluggable='no'/>
    <vcpu id='1' enabled='no' hotpluggable='yes'/>
  ...
  </vcpus>

4. for running vm:
# virsh dumpxml rhel7.4 | grep /vcpus -B10
  <vcpu placement='static' current='1'>8</vcpu>
  <vcpus>
    <vcpu id='0' enabled='yes' hotpluggable='no' order='1'/>
    <vcpu id='1' enabled='no' hotpluggable='yes'/>
...
  </vcpus>

# virsh setvcpu rhel7.4 0 --disable
error: Operation not supported: vcpu '0' can't be unplugged

# virsh setvcpu rhel7.4 0 --enable
error: invalid argument: vcpu '0' is already in requested state

# grep error /var/log/libvirt/libvirtd.log
2017-10-18 07:40:31.830+0000: 8055: error : qemuDomainHotplugDelVcpu:5470 : Operation not supported: vcpu '0' can't be unplugged
2017-10-18 07:40:45.684+0000: 8053: error : qemuDomainFilterHotplugVcpuEntities:5899 : invalid argument: vcpu '0' is already in requested state
Comment 5 Peter Krempa 2017-10-30 07:29:09 EDT
Yes, looks like the two numbers are reversed. Also they don't make much sense in the format they are in. The message should be changed.
Comment 6 yalzhang@redhat.com 2017-11-03 04:11:44 EDT
Test on libvirt-3.9.0-1.el7.x86_64 with steps in comment 4, the result is as expected. And the issue talked in comment 5 will be tracked in bug 1509151
Comment 10 errata-xmlrpc 2018-04-10 06:46:43 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2018:0704

Note You need to log in before you can comment on or make changes to this bug.