Bug 726771 - libvirt does not specify problem file if persistent xml is invalid
Summary: libvirt does not specify problem file if persistent xml is invalid
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.2
Hardware: All
OS: All
Target Milestone: rc
: ---
Assignee: Peter Krempa
QA Contact: Virtualization Bugs
Depends On:
TreeView+ depends on / blocked
Reported: 2011-07-29 18:38 UTC by Dave Allan
Modified: 2016-04-26 14:26 UTC (History)
5 users (show)

Fixed In Version: libvirt-0.9.9-1.el6
Doc Type: Bug Fix
Doc Text:
Libvirt made a lot of improvements in reporting errors in XML file parsing that make identifying error easier.
Clone Of:
Last Closed: 2012-06-20 06:29:43 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2012:0748 0 normal SHIPPED_LIVE Low: libvirt security, bug fix, and enhancement update 2012-06-19 19:31:38 UTC

Description Dave Allan 2011-07-29 18:38:48 UTC
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.

Comment 3 Peter Krempa 2011-09-06 14:56:46 UTC
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

Comment 6 yanbing du 2012-01-10 07:04:51 UTC
Test this bug on libvirt-0.9.9-1.el6.x86_64.
Edit the persistent XML file of a guest on disk, such as:

<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'/>

then restart libvirtd, the guest disappeared in virsh list, and we can find the following error message in libvirtd log:

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'/>


So move bug to VERIFIED

Comment 7 Peter Krempa 2012-05-02 13:49:23 UTC
    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.

Comment 9 errata-xmlrpc 2012-06-20 06:29:43 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.


Note You need to log in before you can comment on or make changes to this bug.