Description of problem: xml with host cache id in cachetune should be valid Version-Release number of selected component (if applicable): libvirt-daemon-7.0.0-10.module+el8.4.0+10417+37f6984d.x86_64 How reproducible: 100% Steps to Reproduce: 1. prepare a running guest # virsh list --all Id Name State --------------------------------- 1 avocado-vt-vm1 running 2. check its xml # virsh dumpxml avocado-vt-vm1 |grep '<vcpu' -A4 <vcpu placement='static' cpuset='0-2' current='2'>5</vcpu> <cputune> <vcpupin vcpu='0' cpuset='1,3-4'/> <cachetune vcpus='0-3' id='vcpus_0-3'> <monitor level='3' vcpus='0'/> </cachetune> </cputune> 3. dump the guest xml to a file # virsh dumpxml avocado-vt-vm1 > avocado-vt-vm1.xml 4. validate the xml # virt-xml-validate avocado-vt-vm1.xml Relax-NG validity error : Extra element cputune in interleave avocado-vt-vm1.xml:1: element domain: Relax-NG validity error : Invalid sequence in interleave avocado-vt-vm1.xml:1: element domain: Relax-NG validity error : Element domain failed to validate content avocado-vt-vm1.xml fails to validate Expected results: guest with such xml snippet can be defined and started, its xml should be valid, otherwise one can not edit the guest to add that xml snippet. Additional info:
The 'id' of <cachetune> seems to be an output-only element according to the code. Why are you trying to set it? There are other problems though. E.g. it's not documented at all.
(In reply to Peter Krempa from comment #1) > The 'id' of <cachetune> seems to be an output-only element according to the > code. Why are you trying to set it? Hi, I am a newbie to this part, when I try to edit the guest xml with host cache id following some document The doc: prepare a running guest, with the following xml: <cputune> <vcpupin vcpu='0' cpuset='1,3-4'/> <cachetune vcpus='0-3' id='vcpus_0-3'> <monitor level='3' vcpus='0'/> </cachetune> </cputune> When the guest is started, the xml is just as the above. But when I try to edit the guest with the xml, it can not work. I thought I can edit the guest according to the started guest xml, is it a misunderstanding? Thanks very much.
Well, with output-only elements it doesn't really matter what you set for it, it will be ignored when the XML is parsed. Nevertheless there are following problems: - cachentune 'id' attribute should be in schema even when it's output only - the attribute is not documented at all - it would be great to have a unit test in the libvirt codebase testing the output value
Patches proposed on the list: https://listman.redhat.com/archives/libvir-list/2021-July/msg00441.html
Patches v2 proposed on the list: https://listman.redhat.com/archives/libvir-list/2021-July/msg00513.html
Merged upstream as: b78bfd4c54 docs: Allow 'id' attribute for 'cachetune' element b0b5820efe genericxml2xmltest: Modify cachetune test to include id v7.5.0-131-gb0b5820efe
Verify this bug with libvirt-daemon-7.6.0-2.module+el8.5.0+12219+a5ea13d2.x86_64: 1. prepare a xml file which include cachetune element with id: # cat vm1.xml ... <vcpu placement='static' cpuset='0-2' current='2'>5</vcpu> <cputune> <vcpupin vcpu='0' cpuset='1,3-4'/> <cachetune vcpus='0-3' id='vcpus_0-3'> <monitor level='3' vcpus='0'/> </cachetune> </cputune> ... 2. use virt-xml-validate validate xml: # virt-xml-validate vm1.xml vm1.xml validates 3. check document in /usr/share/doc/libvirt-docs/html/formatdomain.html ... The optional, output only <span class="docutils literal">id</span> attribute identifies cache uniquely. ...
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 (virt:av 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-2021:4684