Bug 1980162

Summary: "cache=X" in <bandwidth> failed to do syntax validation
Product: Red Hat Enterprise Linux Advanced Virtualization Reporter: Jing Qi <jinqi>
Component: libvirtAssignee: Michal Privoznik <mprivozn>
Status: CLOSED ERRATA QA Contact: Jing Qi <jinqi>
Severity: low Docs Contact:
Priority: unspecified    
Version: 8.5CC: jdenemar, jsuchane, lmen, mprivozn, virt-maint, xuzhang
Target Milestone: rcKeywords: Triaged, Upstream
Target Release: 8.5Flags: pm-rhel: mirror+
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-7.6.0-1.module+el8.5.0+12097+2c77910b Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-16 07:55:01 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: 7.6.0
Embargoed:

Description Jing Qi 2021-07-08 00:48:52 UTC
Description of problem:

"cache=X" in <bandwidth> failed to do syntax validation 

Version-Release number of selected component (if applicable):
libvirt-daemon-7.5.0-1.module+el8.5.0+11664+59f87560.x86_64
qemu-kvm-6.0.0-21.module+el8.5.0+11555+e0ab0d09.x86_64

How reproducible:
Always

Steps to Reproduce:
1.
Below configuration can be saved in "virsh edit", 
        <bandwidth initiator='0' target='0' cache='1' type='access' value='208896' unit='KiB'/>
        <bandwidth initiator='0' target='0' cache='1' type='read' value='209920' unit='KiB'/>
        <bandwidth initiator='0' target='0' cache='1' type='write' value='210944' unit='KiB'/>

        <bandwidth initiator='0' target='1' cache='1' type='access' value='105472' unit='KiB'/>
        <bandwidth initiator='0' target='1' cache='1' type='read' value='106496' unit='KiB'/>
        <bandwidth initiator='0' target='1' cache='1' type='write' value='107520' unit='KiB'/>

error: XML document failed to validate against schema: Unable to validate doc against /usr/share/libvirt/schemas/domain.rng
Extra element cpu in interleave
Element domain failed to validate content


Actual results:

Failed to do syntax validation

Expected results:

passed

Additional info:

Comment 1 Michal Privoznik 2021-07-08 07:42:59 UTC
Patch posted to the list:

https://listman.redhat.com/archives/libvir-list/2021-July/msg00156.html

Comment 2 Michal Privoznik 2021-07-08 14:29:53 UTC
Merged upstream as:

commit 12f96b06118e5d9061cf94724666eb254a150f65
Author:     Michal Prívozník <mprivozn>
AuthorDate: Wed Jul 7 16:00:49 2021 +0200
Commit:     Michal Prívozník <mprivozn>
CommitDate: Thu Jul 8 16:28:30 2021 +0200

    schemas: Allow cache attribute for bandwidth element for HMAT
    
    Turns out, when introducing HMAT support in v6.6.0-rc1~249
    I've forgot to allow "cache" attribute for <bandwidth/> element
    in RNG. It's parsed and formatted, but schema does not allow it.
    
    Fixes: a89bbbac86383a10be0cec5a93feb7ed820871eb
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1980162
    Signed-off-by: Michal Privoznik <mprivozn>
    Reviewed-by: Pavel Hrdina <phrdina>

v7.5.0-32-g12f96b0611

Comment 3 Jing Qi 2021-07-28 05:32:27 UTC
Tested with libvirt upstream version v7.6.0-rc1 & qemu-6.0.0-11.fc35.x86_64

S1. Edit vm with adding HMAT configuration -
1. Edit vm with adding below xml part - 
<cpu mode='custom' match='exact' check='none'>
    <model fallback='forbid'>qemu64</model>
    <numa>
      <cell id='0' cpus='0-1' memory='2097152' unit='KiB' discard='yes'>
        <cache level='1' associativity='direct' policy='writeback'>
          <size value='10' unit='KiB'/>
          <line value='8' unit='B'/>
        </cache>
        <cache level='2' associativity='full' policy='writethrough'>
          <size value='128' unit='KiB'/>
          <line value='16' unit='B'/>
        </cache>
      </cell>
      <cell id='1' memory='512000' unit='KiB'>
        <cache level='1' associativity='direct' policy='writeback'>
          <size value='10' unit='KiB'/>
          <line value='8' unit='B'/>
        </cache>
      </cell>
      <interconnects>
        <latency initiator='0' target='0' type='access' value='5'/>
        <latency initiator='0' target='0' type='read' value='6'/>
        <latency initiator='0' target='0' type='write' value='7'/>
        <latency initiator='0' target='1' type='access' value='10'/>
        <latency initiator='0' target='1' type='read' value='11'/>
        <latency initiator='0' target='1' type='write' value='12'/>
        <bandwidth initiator='0' target='0' type='access' value='204800' unit='KiB'/>
        <bandwidth initiator='0' target='0' type='read' value='205824' unit='KiB'/>
        <bandwidth initiator='0' target='0' type='write' value='206848' unit='KiB'/>
        <bandwidth initiator='0' target='1' type='access' value='102400' unit='KiB'/>
        <bandwidth initiator='0' target='1' type='read' value='103424' unit='KiB'/>
        <bandwidth initiator='0' target='1' type='write' value='104448' unit='KiB'/>
        <bandwidth initiator='0' target='0' cache='1' type='access' value='208896' unit='KiB'/>
        <bandwidth initiator='0' target='0' cache='1' type='read' value='209920' unit='KiB'/>
        <bandwidth initiator='0' target='0' cache='1' type='write' value='210944' unit='KiB'/>
        <bandwidth initiator='0' target='1' cache='1' type='access' value='105472' unit='KiB'/>
        <bandwidth initiator='0' target='1' cache='1' type='read' value='106496' unit='KiB'/>
        <bandwidth initiator='0' target='1' cache='1' type='write' value='107520' unit='KiB'/>
      </interconnects>
    </numa>
  </cpu>

2. Save and start the vm -
# virsh start pc
Domain 'pc' started

Comment 4 Jing Qi 2021-08-03 02:17:27 UTC
Verified with libvirt-7.6.0-1.module+el8.5.0+12097+2c77910b.x86_64 & qemu-kvm-6.0.0-21.module+el8.5.0+11555+e0ab0d09.x86_64

Steps are the same with comment 3.

Comment 7 errata-xmlrpc 2021-11-16 07:55:01 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