RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1459785 - guest will have invalid config after use setvcpu to enable vcpu 0
Summary: guest will have invalid config after use setvcpu to enable vcpu 0
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.4
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Peter Krempa
QA Contact: yalzhang@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-06-08 07:48 UTC by Luyao Huang
Modified: 2018-04-10 10:48 UTC (History)
5 users (show)

Fixed In Version: libvirt-3.7.0-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-04-10 10:46:43 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2018:0704 0 None None None 2018-04-10 10:48:00 UTC

Description Luyao Huang 2017-06-08 07:48:31 UTC
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 12:26:57 UTC
Fixed upstream:

commit b183f17d76839587cbe411f4e12beca18d3ec702
Author: Peter Krempa <pkrempa>
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 08:03:03 UTC
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 11:29:09 UTC
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 08:11:44 UTC
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 10:46:43 UTC
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.