Bug 1146334

Summary: report error for invalid memAccess when parsing cpu
Product: Red Hat Enterprise Linux 7 Reporter: Jincheng Miao <jmiao>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1CC: dyuan, honzhang, jtomko, lcheng, mzhan, rbalakri
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-1.2.13-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 05:53:12 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:

Description Jincheng Miao 2014-09-25 03:25:26 UTC
description of problem:
libvirtd should report error for invalid memAccess when parsing cpu.

Version-Release number of selected component (if applicable):
libvirt-1.2.8-3.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. configure guest like this:
# virsh edit r7b
...
  <memory unit='KiB'>1048576</memory>
  <currentMemory unit='KiB'>1048576</currentMemory>
  <memoryBacking>
    <hugepages>
      <page size='2048' unit='KiB' nodeset='0'/>
    </hugepages>
  </memoryBacking>
...
  <vcpu placement='static'>4</vcpu>
  <cpu>
    <numa>
      <cell id='1' cpus='2-3' memory='524288'/>
      <cell id='0' cpus='0-1' memory='524288' memAccess='invalid'/>
    </numa>
  </cpu>
...

2. dumpxml guest
# virsh dumpxml r7b | grep memAccess
      <cell id='1' cpus='0-1' memory='524288' memAccess='(null)'/>

Expect result:
in step 1:
# virsh edit r7b
error: unsupported configuration: Invalid 'memAccess' attribute value 'invalid'

Comment 1 Ján Tomko 2015-01-26 16:51:56 UTC
Fixed upstream by:
commit e02908880259c2587c7ec42d5ab5d967a7daa0a1
Author:     Jincheng Miao <jmiao>
AuthorDate: 2014-09-25 19:28:33 +0800
Commit:     Martin Kletzander <mkletzan>
CommitDate: 2014-09-26 16:03:14 +0200

    conf: report error in virCPUDefParseXML
    
    When detected invalid 'memAccess', virCPUDefParseXML should report error.
    
    Resolves https://bugzilla.redhat.com/show_bug.cgi?id=1146334
    
    Signed-off-by: Jincheng Miao <jmiao>

git describe: v1.2.9-rc1-17-ge029088 contains: v1.2.9-rc2~4

Comment 2 lcheng 2015-04-21 10:39:59 UTC
Reproduced this bug with libvirt-1.2.8-16.el7.x86_64.

# rpm -q libvirt
libvirt-1.2.8-16.el7.x86_64

# virsh edit 7
...
  <memory unit='KiB'>1024000</memory>
  <currentMemory unit='KiB'>1024000</currentMemory>
  <memoryBacking>
    <hugepages>
      <page size='2048' unit='KiB' nodeset='0'/>
    </hugepages>
  </memoryBacking>
  <vcpu placement='static'>4</vcpu>
...
  <cpu>
    <numa>
      <cell id='0' cpus='0-1' memory='512000' unit='KiB' memAccess='invalid'/>
      <cell id='1' cpus='2-3' memory='512000' unit='KiB'/>
    </numa>
  </cpu>
...

# virsh dumpxml 7 | grep memAccess
      <cell id='0' cpus='0-1' memory='524288' memAccess='(null)'/>



Verified with libvirt-1.2.14-1.el7.x86_64. The bug is resolved. Move to VERIFIED.


1. Set memAccess='invalid'.

# cat 7.xml 
...
  <memory unit='KiB'>1024000</memory>
  <currentMemory unit='KiB'>1024000</currentMemory>
  <memoryBacking>
    <hugepages>
      <page size='2048' unit='KiB' nodeset='0'/>
    </hugepages>
  </memoryBacking>
  <vcpu placement='static'>4</vcpu>
...
  <cpu>
    <numa>
      <cell id='0' cpus='0-1' memory='512000' unit='KiB' memAccess='invalid'/>
      <cell id='1' cpus='2-3' memory='512000' unit='KiB'/>
    </numa>
  </cpu>
...


# virsh define 7.xml 
error: Failed to define domain from 7.xml
error: unsupported configuration: Invalid 'memAccess' attribute value 'invalid'

2. Change memAccess from 'invalid' to 'shared'.
# cat 7.xml 
...
  <memory unit='KiB'>1024000</memory>
  <currentMemory unit='KiB'>1024000</currentMemory>
  <memoryBacking>
    <hugepages>
      <page size='2048' unit='KiB' nodeset='0'/>
    </hugepages>
  </memoryBacking>
  <vcpu placement='static'>4</vcpu>
...
  <cpu>
    <numa>
      <cell id='0' cpus='0-1' memory='512000' unit='KiB' memAccess='shared'/>
      <cell id='1' cpus='2-3' memory='512000' unit='KiB'/>
    </numa>
  </cpu>
...


# virsh define 7.xml 
Domain 7 defined from 7.xml


3. Change memAccess from 'shared' to 'invalid'.
# virsh edit 7
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

Failed. Try again? [y,n,i,f,?]:

Comment 5 errata-xmlrpc 2015-11-19 05:53:12 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, 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://rhn.redhat.com/errata/RHBA-2015-2202.html