Bug 828676

Summary: virt-xml-validate validate fails when xml contains kernel/initrd/cmdline elements
Product: Red Hat Enterprise Linux 6 Reporter: Min Zhan <mzhan>
Component: libvirtAssignee: Osier Yang <jyang>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.3CC: acathrow, bili, dallan, dyasny, dyuan, mzhan, rwu, ydu
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-0.9.13-3.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-21 07:16:25 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 Min Zhan 2012-06-05 07:47:14 UTC
Description of problem:
virt-xml-validate validate fails when xml contains kernel/initrd/cmdline elements

Version-Release number of selected component (if applicable):
libvirt-0.9.10-21.el6

How reproducible:
Always

Steps to Reproduce:
1. Prepare a guest xml contains kernel/initrd/cmdline elements to customize the own kernel parameters, for example.

# cat rhel63_before.xml 
<domain type='kvm' id='3'>
  <name>rhel63_new</name>
  <memory unit='KiB'>1048576</memory>
  <currentMemory unit='KiB'>1048576</currentMemory>
  <vcpu placement='static'>1</vcpu>
  <os>
    <type arch='x86_64' machine='rhel6.3.0'>hvm</type>
    <kernel>/var/lib/libvirt/boot/virtinst-vmlinuz.AI6hG7</kernel>
    <initrd>/var/lib/libvirt/boot/virtinst-initrd.img.m_fNbg</initrd>
    <cmdline>method=http://download.englab.nay.redhat.com/pub/rhel/rel-eng/RHEL6.3-20120531.0/6.3/Server/x86_64/os/</cmdline>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>destroy</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='none'/>
      <source file='/var/lib/libvirt/images/rhel63.img'/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </disk>
    <controller type='usb' index='0'>
      <alias name='usb0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <interface type='network'>
      <mac address='52:54:00:4d:f3:f2'/>
      <source network='default'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/1'/>
      <target port='0'/>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/1'>
      <source path='/dev/pts/1'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <input type='tablet' bus='usb'>
      <alias name='input0'/>
    </input>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='5900' autoport='yes'/>
    <sound model='ich6'>
      <alias name='sound0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </sound>
    <video>
      <model type='cirrus' vram='9216' heads='1'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </memballoon>
  </devices>
  <seclabel type='dynamic' model='selinux' relabel='yes'>
    <label>system_u:system_r:svirt_t:s0:c434,c616</label>
    <imagelabel>system_u:object_r:svirt_image_t:s0:c434,c616</imagelabel>
  </seclabel>
</domain>

2. # virsh define rhel63_before.xml 
Domain rhel63_new defined from rhel63_before.xml

3. # virt-xml-validate rhel63_before.xml 
rhel63_before.xml:7: element type: Relax-NG validity error : Error validating value 
rhel63_before.xml:8: element kernel: Relax-NG validity error : Expecting element boot, got kernel
Relax-NG validity error : Extra element kernel in interleave
rhel63_before.xml:8: element kernel: Relax-NG validity error : Element os failed to validate content
rhel63_before.xml:7: element type: Relax-NG validity error : Element type failed to validate content
rhel63_before.xml:1: element domain: Relax-NG validity error : Element domain failed to validate content
rhel63_before.xml fails to validate

Actual results:
As above

Expected results:
virt-xml-validate works well

Additional info:
When remove these 3 elements from xml, virt-xml-validate works well

Comment 1 Osier Yang 2012-06-15 13:59:50 UTC
Commit b34324fbf in upstream, move to POST.

Comment 3 yanbing du 2012-07-24 08:59:30 UTC
With libvirt-0.9.13-3.el6.x86_64, the bug can be verified.
Use the same XML file in bug description, and check it:
# virt-xml-validate rhel63.xml 
bug.xml validates

Comment 4 errata-xmlrpc 2013-02-21 07:16:25 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.

http://rhn.redhat.com/errata/RHSA-2013-0276.html