Bug 1223631

Summary: smbios, sysinfo, idmap, metadata will lose if we set a memory device in the xml
Product: Red Hat Enterprise Linux 7 Reporter: Luyao Huang <lhuang>
Component: libvirtAssignee: Peter Krempa <pkrempa>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.2CC: dyuan, fjin, honzhang, mzhan, pkrempa, rbalakri
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-1.2.16-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 06:31:22 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:
Embargoed:

Description Luyao Huang 2015-05-21 05:00:52 UTC
description of problem:
smbios, sysinfo, idmap, metadata will lose if we set a memory device in the xml

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

How reproducible:
100%

Steps to Reproduce:
1. edit a guest xml like this:
# virsh edit test3

  <maxMemory slots='16' unit='KiB'>2560000</maxMemory>
  <memory unit='KiB'>1536000</memory>
  <currentMemory unit='KiB'>1024000</currentMemory>
...
  <os>
    <type arch='x86_64' machine='pc-i440fx-rhel7.1.0'>hvm</type>
    <boot dev='hd'/>
    <smbios mode='sysinfo'/>
  </os>
...
  <cpu mode='host-model'>
    <model fallback='forbid'/>
    <numa>
      <cell id='0' cpus='0-1' memory='512000' unit='KiB'/>
      <cell id='1' cpus='2-3' memory='512000' unit='KiB'/>
    </numa>
  </cpu>
...
    <memory model='dimm'>
      <target>
        <size unit='KiB'>512000</size>
        <node>1</node>
      </target>
    </memory>

Domain test3 XML configuration not changed.

2. recheck the xml:
  <os>
    <type arch='x86_64' machine='pc-i440fx-rhel7.1.0'>hvm</type>
    <boot dev='hd'/>
  </os>



Actual results:
smbios, sysinfo, idmap, metadata will lose if we set a memory device in the xml

Expected results:
libvirt can parse smbios, sysinfo, idmap, metadata when set a memory device

infomation:

Additional info:

Comment 1 Luyao Huang 2015-05-21 05:10:17 UTC
Send a patch to upstream:

https://www.redhat.com/archives/libvir-list/2015-May/msg00674.html

Comment 2 Peter Krempa 2015-05-21 09:07:35 UTC
Fixed upstream:

commit aef2a0a26c42efeedd25ad570269f5f1cc9da6b5
Author: Luyao Huang <lhuang>
Date:   Thu May 21 13:08:12 2015 +0800

    conf: Restore the XML parser context in virDomainMemoryDefParseXML
    
    After parsing the memory device XML the function would not restore the
    XML parser context causing invalid XPath starting point for the rest of
    the elements. This is a regression since 3e4230d2.
    
    The test case addition uses the <idmap> element that is currently unused
    by qemu, but parsed after the memory device definition and formatted
    always.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1223631
    
    Signed-off-by: Luyao Huang <lhuang>
    Signed-off-by: Peter Krempa <pkrempa>

v1.2.15-119-gaef2a0a

Comment 4 Fangge Jin 2015-08-26 11:55:20 UTC
I can reproduce this bug on build libvirt-1.2.15-2.el7.x86_64

Verify this bug on build libvirt-1.2.17-6.el7.x86_64

Steps:
1.Edit a guest xml like this:
# virsh edit rhel7d1
...
  <maxMemory slots='16' unit='KiB'>2560000</maxMemory>
  <memory unit='KiB'>1024000</memory>
  <currentMemory unit='KiB'>1024000</currentMemory>
...
  <os>
    <type arch='x86_64' machine='pc-i440fx-rhel7.1.0'>hvm</type>
    <boot dev='hd'/>
    <boot dev='cdrom'/>
    <bootmenu enable='yes' timeout='3000'/>
    <bios useserial='yes' rebootTimeout='0'/>
    <smbios mode='sysinfo'/>
  </os>
  <sysinfo type='smbios'>
    <bios>
      <entry name='vendor'>LENOVO</entry>
    </bios>
  </sysinfo>
  <idmap>
    <uid start='0' target='1000' count='10'/>
    <gid start='0' target='1000' count='10'/>
  </idmap>
...
    <memory model='dimm'>
      <target>
        <size unit='KiB'>512000</size>
        <node>1</node>
      </target>
    </memory>
...
Domain rhel7d1 XML configuration edited.

2.Recheck the xml, all the attributes still exist.

Comment 6 errata-xmlrpc 2015-11-19 06:31:22 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