Bug 1459785
| Summary: | guest will have invalid config after use setvcpu to enable vcpu 0 | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Luyao Huang <lhuang> |
| Component: | libvirt | Assignee: | Peter Krempa <pkrempa> |
| Status: | CLOSED ERRATA | QA Contact: | yalzhang <yalzhang> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 7.4 | CC: | dyuan, pkrempa, rbalakri, xuzhang, yalzhang |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| 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 10:46:43 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: | |||
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.
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
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. 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 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 |
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: