Red Hat Bugzilla – Bug 726771
libvirt does not specify problem file if persistent xml is invalid
Last modified: 2016-04-26 10:26:42 EDT
If a user mistakenly edits the persistent XML on disk instead of using API editing commands, it's possible for the persistent XML on disk to become invalid. Of course, users should not be editing the XML on disk, so this situation should not happen(™). Since users frequently do edit the on disk XML, we should try to let them know what they broke. Currently if I break the XML for a qemu domain, the result in /var/log/libvirt/libvirtd.log is: 10:53:14.690: 793: error : catchXMLError:653 : at line 28: Opening and ending tag mismatch: memory line 11 and domain which is great if I know what I'm looking for, because it tells me what's wrong with the XML. However, if all I know is that my VM suddenly vanished, it doesn't help me much in figuring out why. I would like to see additionally an error message along the lines of: failed to parse domain [or network, etc] XML from /etc/libvirt/qemu/goat.xml which would tell me what file is broken.
Fixed in upstream: commit 9fd3bb7a88bd41a5cf4830529b3b3c87260be62e Author: Peter Krempa <pkrempa@redhat.com> Date: Tue Sep 6 15:48:22 2011 +0800 XML: Improve XML parsing error messages
Test this bug on libvirt-0.9.9-1.el6.x86_64. Edit the persistent XML file of a guest on disk, such as: ----<snip>---- <disk type='file' device='disk'> <driver name='qemu' type='qcow2' cache='none'/> <source file='/var/lib/libvirt/images/rhel6_x86_64_qcow2.img --->here, delete the end tag(" '/> "). <target dev='vda' bus='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> </disk> ----</snip>---- then restart libvirtd, the guest disappeared in virsh list, and we can find the following error message in libvirtd log: ----<snip>---- 2012-01-10 07:02:26.415+0000: 9309: error : virCommandWait:2271 : internal error Child process (/sbin/iscsiadm --mode session) status unexpected: exit status 21 2012-01-10 07:02:26.773+0000: 9309: error : catchXMLError:711 : /etc/libvirt/qemu/test.xml:32: Unescaped '<' not allowed in attributes values <target dev='vda' bus='virtio'/> ------^ ----</snip>---- So move bug to VERIFIED
Technical note added. If any revisions are required, please edit the "Technical Notes" field accordingly. All revisions will be proofread by the Engineering Content Services team. New Contents: Libvirt made a lot of improvements in reporting errors in XML file parsing that make identifying error easier.
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-2012-0748.html