Bug 2121627
| Summary: | define vm with invalid pcie-root-target chassis -1 should failed | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 9 | Reporter: | zhentang <zhetang> |
| Component: | libvirt | Assignee: | Peter Krempa <pkrempa> |
| libvirt sub component: | General | QA Contact: | Meina Li <meili> |
| Status: | CLOSED ERRATA | Docs Contact: | |
| Severity: | unspecified | ||
| Priority: | unspecified | CC: | jdenemar, lmen, meili, pkrempa, virt-maint, xuzhang, yalzhang |
| Version: | unspecified | Keywords: | Regression, Triaged |
| Target Milestone: | rc | Flags: | pm-rhel:
mirror+
|
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-8.8.0-1.el9 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2023-05-09 07:27:05 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: | 8.8.0 |
| Embargoed: | |||
The root cause is that the '-1' value is internally used to signify that the 'chassis' (and 'chassisnNr') field was not specified by the user and a default should be filled in. The validator is unable to distinguish those cases so we'll probably ned to handle negative values in the parser. Fixed upstream:
commit 03c908bf9cd34a7ef8c46db0d29cf1750b682d4a
Author: Peter Krempa <pkrempa>
Date: Fri Aug 26 14:02:52 2022 +0200
virDomainControllerDefParseXML: Reject '-1' for PCI controller target properties
All of the properties use '-1' as default and the code omits formatting
them when the property is '-1'. Additionally subsequent validation code
rejects all other negative values anyways.
Since we've never formatted '-1' into an XML formatted by libvirt we can
make the parser more strict, as we will never fail to parse existing
on-disk libvirt-owned XMLs.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2121627
Signed-off-by: Peter Krempa <pkrempa>
Reviewed-by: Ján Tomko <jtomko>
v8.7.0-37-g03c908bf9c
Test Version:
libvirt-8.8.0-1.el9.x86_64
Test Step:
1. Edit a guest with chassis='-1':
......
<controller type='pci' index='1' model='pcie-root-port'>
<model name='pcie-root-port'/>
<target chassis='-1' port='0x10'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0' multifunction='on'/>
</controller>
......
2. Save and get an expected error:
# virsh edit rhel
error: XML document failed to validate against schema: Unable to validate doc against /usr/share/libvirt/schemas/domain.rng
Extra element devices in interleave
Element domain failed to validate content
avocado-vt-vm1
Failed. Try again? [y,n,i,f,?]:
error: XML error: Invalid value for attribute 'chassis' in element 'target': '-1'. Expected non-negative value
Test Version: libvirt-8.9.0-2.el9.x86_64 qemu-kvm-7.1.0-4.el9.x86_64 Test Steps: 1. Prepare pcie-root-port, pcie-expander-bus, pcie-to-pci-bridge and pci-bridge controller. 2. Define the guest with invalid value. # virsh define test.xml error: Failed to define domain from test.xml error: XML error: Invalid value for attribute 'chassis' in element 'target': '-1'. Expected non-negative value # virsh define test.xml error: Failed to define domain from test.xml error: XML error: Invalid value for attribute 'port' in element 'target': '-1'. Expected non-negative value # virsh define test.xml error: Failed to define domain from test.xml error: XML error: Invalid value for attribute 'busNr' in element 'target': '-1'. Expected non-negative value # virsh define test.xml error: Failed to define domain from test.xml error: XML error: Invalid value for attribute 'chassisNr' in element 'target': '-1'. Expected non-negative value 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 (libvirt bug fix and enhancement update), 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/RHBA-2023:2171 |
Description of problem: define vm with invalid pcie-root-target chassis -1 should failed Version-Release number of selected component (if applicable): libvirt-8.5.0-5.el9 How reproducible: 100% Steps to Reproduce: 1. prepare guest xml ... <controller type='pci' index='1' model='pcie-root-port'> <model name='pcie-root-port'/> <target chassis='-1' port='0x10'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x00' function='0x0' multifunction='on'/> </controller> ... 2. devine vm # virsh define pcitest.xml Domain 'rhel9.0-2' defined from pcitest.xml # virsh dumpxml rhel9.0-2 ... <controller type='pci' index='1' model='pcie-root-port'> <model name='pcie-root-port'/> <target chassis='1' port='0x10'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x6'/> </controller> ... Actual results: VM define successful which is unexpected Expected results: VM define should fail with error message error: XML error: PCI controller chassis '-1' out of range - must be 0-255 Additional info: when define with chassis='-2', it would be failed with error message as expected ... <controller type='pci' index='1' model='pcie-root-port'> <model name='pcie-root-port'/> <target chassis='-2' port='0x10'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x00' function='0x0' multifunction='on'/> </controller> ... # virsh define pcitest.xml error: Failed to define domain from pcitest.xml error: unsupported configuration: PCI controller chassis '-2' out of range - must be 0-255