Bug 813191
| Summary: | virt-xml-validate fail for pool, nodedev and capabilities | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 6 | Reporter: | dyuan |
| Component: | libvirt | Assignee: | Ján Tomko <jtomko> |
| Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> |
| Severity: | low | Docs Contact: | |
| Priority: | medium | ||
| Version: | 6.3 | CC: | acathrow, ajia, bili, dallan, dyasny, eblake, mzhan, rwu |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-0.10.0-0rc1.el6 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2013-02-21 07:11:44 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: | |||
| Bug Depends On: | 616721 | ||
| Bug Blocks: | |||
Upstream has also discussed the idea of adding an API to canonicalize and optionally validate XML; if that API is added, this bug becomes more important to fix (since we are then making it much easier to trigger validation). See bug 616721 for the normalization API proposal Upstream patch proposed: https://www.redhat.com/archives/libvir-list/2012-August/msg00028.html Fixed by commit 37a10129c24d7dcb05522d50a1f3039d338646ad
Update xml schemas according to libvirt source
Verified with : # vi network.xml Using the same as Description # virt-xml-validate network.xml network network.xml validates # vi pool.xml Using the same as Description # virt-xml-validate pool.xml storagepool pool.xml validates # vi vol.xml Using the same as Description # virt-xml-validate vol.xml storagevol vol.xml validates # vi nodedev.xml Using the same as Description # virt-xml-validate nodedev.xml nodedev nodedev.xml validates # vi capa.xml Using the same as Description # virt-xml-validate capa.xml capa.xml validates All validate successfully. Moving to VERIFIED. Hi jtomko,
I found that virt-xml-validate should fail when there is no <path> element in the xml, but it pass:
1.# cat pool.xml
<pool type='dir'>
<name>test</name>
<capacity unit='bytes'>82569920512</capacity>
<allocation unit='bytes'>22617657344</allocation>
<available unit='bytes'>59952263168</available>
<source>
</source>
<target>
<permissions>
<mode>0700</mode>
<owner>-1</owner>
<group>-1</group>
</permissions>
</target>
</pool>
2. # virt-xml-validate pool.xml
pool.xml validates
# echo $?
0
3. # virt-xml-validate pool.xml storagepool
pool.xml validates
# echo $?
0
Validate pass, however can not be defined successfully:
4. # virsh pool-define pool.xml
error: Failed to define pool from pool.xml
error: XML error: missing storage pool target path
# echo $?
1
Should I file another bug for it?
Thanks,
EricLee
And there is another problem of volume.xml:
do not add <source> element to vol.xml
# cat vol.xml
<volume>
<name>rhel6.img</name>
<capacity unit='bytes'>8589934592</capacity>
<allocation unit='bytes'>1043378176</allocation>
<target>
<permissions>
<mode>0600</mode>
<owner>0</owner>
<group>0</group>
<label>system_u:object_r:virt_image_t:s0</label>
</permissions>
</target>
</volume>
# virt-xml-validate vol.xml
vol.xml:3: element capacity: Relax-NG validity error : Did not expect element capacity there
vol.xml fails to validate
But can create a volume from that xml:
# virsh vol-create default vol.xml
Vol rhel6.img created from vol.xml
# virsh vol-list default
Name Path
-----------------------------------------
rhel6.img /var/lib/libvirt/images/rhel6.img
# virsh vol-dumpxml rhel6.img default
<volume>
<name>rhel6.img</name>
<key>/var/lib/libvirt/images/rhel6.img</key>
<source>
</source>
<capacity unit='bytes'>8589934592</capacity>
<allocation unit='bytes'>1044402176</allocation>
<target>
<path>/var/lib/libvirt/images/rhel6.img</path>
<format type='raw'/>
<permissions>
<mode>0600</mode>
<owner>0</owner>
<group>0</group>
<label>unconfined_u:object_r:virt_image_t:s0</label>
</permissions>
<timestamps>
<atime>1357610541</atime>
<mtime>1357610526</mtime>
<ctime>1357610526</ctime>
</timestamps>
</target>
</volume>
So virt-xml-validate should pass in this case.
And I also think this bug should not be fixed totally yet.
Yes, file another bug for this please. (In reply to comment #10) > Yes, file another bug for this please. Hi jtomko, Thanks for your reply. I have filed another bug for comment #8 : Bug 893273 - virt-xml-validate pass but pool can not be defined by the xml However, how about comment #9 's problem ? Thanks, EricLee I think that one can be added to bug 893273 as well. (In reply to comment #12) > I think that one can be added to bug 893273 as well. Okay, thanks for reply: https://bugzilla.redhat.com/show_bug.cgi?id=893273#c1. 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 |
Description of problem: According to the # man virt-xml-validate, valid schema names currently include domain, network, storagepool, storagevol, nodedev and capability. But I got some error for the pool, nodedev and capability, the xml files are correct for using. Version-Release number of selected component (if applicable): libvirt-0.9.10-11.el6 How reproducible: always Steps to Reproduce: # cat network.xml <network> <name>default</name> <uuid>12fd7429-889f-4023-a03a-b306dda7d027</uuid> <forward mode='nat'/> <bridge name='virbr0' stp='on' delay='0' /> <mac address='52:54:00:D9:E5:6B'/> <ip address='192.168.122.1' netmask='255.255.255.0'> <dhcp> <range start='192.168.122.2' end='192.168.122.254' /> </dhcp> </ip> </network> # virt-xml-validate network.xml network network.xml validates # cat pool.xml <pool type='dir'> <name>default</name> <capacity unit='bytes'>82569920512</capacity> <allocation unit='bytes'>22617657344</allocation> <available unit='bytes'>59952263168</available> <source> </source> <target> <path>/var/lib/libvirt/images</path> <permissions> <mode>0700</mode> <owner>-1</owner> <group>-1</group> </permissions> </target> </pool> # virt-xml-validate pool.xml storagepool pool.xml:6: element source: Relax-NG validity error : Expecting element target, got source pool.xml:9: element path: Relax-NG validity error : Element target has extra content: path pool.xml:5: element available: Relax-NG validity error : Expecting element target, got available pool.xml:1: element pool: Relax-NG validity error : Element pool failed to validate content pool.xml fails to validate # cat vol.xml <volume> <name>rhel62-1.img</name> <key>/var/lib/libvirt/images/rhel62-1.img</key> <source> </source> <capacity unit='bytes'>8589934592</capacity> <allocation unit='bytes'>1043378176</allocation> <target> <path>/var/lib/libvirt/images/rhel62-1.img</path> <format type='raw'/> <permissions> <mode>0600</mode> <owner>0</owner> <group>0</group> <label>system_u:object_r:virt_image_t:s0</label> </permissions> </target> </volume> # virt-xml-validate vol.xml storagevol vol.xml validates # cat nodedev.xml <device> <name>pci_0000_00_19_0</name> <parent>computer</parent> <driver> <name>e1000e</name> </driver> <capability type='pci'> <domain>0</domain> <bus>0</bus> <slot>25</slot> <function>0</function> <product id='0x10de'>82567LM-3 Gigabit Network Connection</product> <vendor id='0x8086'>Intel Corporation</vendor> <capability type='virt_functions'> </capability> </capability> </device> # virt-xml-validate nodedev.xml nodedev nodedev.xml:4: element driver: Relax-NG validity error : Did not expect element driver there nodedev.xml fails to validate # cat capa.xml <capabilities> <host> <uuid>00b93de4-2514-df11-a5bf-e6e0f0d5b33e</uuid> <cpu> <arch>x86_64</arch> <model>Penryn</model> <vendor>Intel</vendor> <topology sockets='1' cores='4' threads='1'/> <feature name='osxsave'/> <feature name='xsave'/> <feature name='pdcm'/> <feature name='xtpr'/> <feature name='tm2'/> <feature name='est'/> <feature name='smx'/> <feature name='vmx'/> <feature name='ds_cpl'/> <feature name='monitor'/> <feature name='dtes64'/> <feature name='pbe'/> <feature name='tm'/> <feature name='ht'/> <feature name='ss'/> <feature name='acpi'/> <feature name='ds'/> <feature name='vme'/> </cpu> <power_management> <suspend_mem/> <suspend_disk/> </power_management> <migration_features> <live/> <uri_transports> <uri_transport>tcp</uri_transport> </uri_transports> </migration_features> <topology> <cells num='1'> <cell id='0'> <cpus num='4'> <cpu id='0'/> <cpu id='1'/> <cpu id='2'/> <cpu id='3'/> </cpus> </cell> </cells> </topology> <secmodel> <model>selinux</model> <doi>0</doi> </secmodel> </host> <guest> <os_type>hvm</os_type> <arch name='i686'> <wordsize>32</wordsize> <emulator>/usr/libexec/qemu-kvm</emulator> <machine>rhel6.3.0</machine> <machine canonical='rhel6.3.0'>pc</machine> <machine>rhel6.2.0</machine> <machine>rhel6.1.0</machine> <machine>rhel6.0.0</machine> <machine>rhel5.5.0</machine> <machine>rhel5.4.4</machine> <machine>rhel5.4.0</machine> <domain type='qemu'> </domain> <domain type='kvm'> <emulator>/usr/libexec/qemu-kvm</emulator> </domain> </arch> <features> <cpuselection/> <deviceboot/> <pae/> <nonpae/> <acpi default='on' toggle='yes'/> <apic default='on' toggle='no'/> </features> </guest> <guest> <os_type>hvm</os_type> <arch name='x86_64'> <wordsize>64</wordsize> <emulator>/usr/libexec/qemu-kvm</emulator> <machine>rhel6.3.0</machine> <machine canonical='rhel6.3.0'>pc</machine> <machine>rhel6.2.0</machine> <machine>rhel6.1.0</machine> <machine>rhel6.0.0</machine> <machine>rhel5.5.0</machine> <machine>rhel5.4.4</machine> <machine>rhel5.4.0</machine> <domain type='qemu'> </domain> <domain type='kvm'> <emulator>/usr/libexec/qemu-kvm</emulator> </domain> </arch> <features> <cpuselection/> <deviceboot/> <acpi default='on' toggle='yes'/> <apic default='on' toggle='no'/> </features> </guest> </capabilities> # virt-xml-validate capa.xml capa.xml:79: element pae: Relax-NG validity error : Did not expect element pae there capa.xml:108: element acpi: Relax-NG validity error : Did not expect element acpi there capa.xml fails to validate Actual results: schema pool, nodedev and capability fail to validate the xml file which are correct for using. Expected results: validate pass. Additional info: Maybe we can use 1 bug to track the related issues if there is some other parts fail.