Bug 1941594 - <cachetune id='' attribute is not documented and not covered by the XML schema
Summary: <cachetune id='' attribute is not documented and not covered by the XML schema
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux Advanced Virtualization
Classification: Red Hat
Component: libvirt
Version: 8.4
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: rc
: 8.4
Assignee: khanicov
QA Contact: Luyao Huang
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-03-22 13:05 UTC by Lili Zhu
Modified: 2021-11-16 08:23 UTC (History)
8 users (show)

Fixed In Version: libvirt-7.6.0-1.module+el8.5.0+12097+2c77910b
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-11-16 07:52:17 UTC
Type: Bug
Target Upstream Version: 7.6.0
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2021:4684 0 None None None 2021-11-16 07:52:47 UTC

Description Lili Zhu 2021-03-22 13:05:19 UTC
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:

Comment 1 Peter Krempa 2021-03-22 13:39:59 UTC
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.

Comment 2 Lili Zhu 2021-03-24 02:03:33 UTC
(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.

Comment 3 Peter Krempa 2021-03-24 08:02:51 UTC
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

Comment 4 khanicov 2021-07-16 10:17:57 UTC
Patches proposed on the list:
https://listman.redhat.com/archives/libvir-list/2021-July/msg00441.html

Comment 5 khanicov 2021-07-20 12:59:59 UTC
Patches v2 proposed on the list:
https://listman.redhat.com/archives/libvir-list/2021-July/msg00513.html

Comment 6 khanicov 2021-07-20 14:54:15 UTC
Merged upstream as:

b78bfd4c54 docs: Allow 'id' attribute for 'cachetune' element
b0b5820efe genericxml2xmltest: Modify cachetune test to include id

v7.5.0-131-gb0b5820efe

Comment 9 Luyao Huang 2021-08-20 06:28:27 UTC
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.
...

Comment 11 errata-xmlrpc 2021-11-16 07:52:17 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 (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


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