Red Hat Bugzilla – Bug 868692
Libvirt: Double dash in VM causes it to disappear - bad parsing of XML
Last modified: 2013-02-21 02:10:45 EST
Created attachment 630989 [details] Relevant XML and log files for this bug Description of problem: OS: Scientific Linux 6.3 on x86-64 I came back after reboot to find a VM missing that I had been working on all night. After google-researching a few things, I found that the VM was not appearing in the VM list due to a double dash: # less /var/log/libvirt/libvirtd.log [[ 012-10-21 17:59:55.758+0000: 2877: error : catchXMLError:683 : /etc/libvirt/qemu/win7--64.xml:4: Comment not terminated <!-- WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES virsh edit win7--64 -----------------^ 2012-10-21 18:06:18.977+0000: 2873: error : remoteDispatchAuthPolkit:2559 : Policy kit denied action org.libvirt.unix.manage from pid 3984, uid 500: exit status 1 --- The kVM had been created as "win7--64" and ended up in /etc/libvirt/qemu as "win7--64.xml". Upon starting the ' virt-manager ', the VM was missing due to this bug because the XML parser couldn't detect that the double dash was part of the comment - not trying to end it. Version-Release number of selected component (if applicable): libvirt-0.9.10-21.el6_3.5.x86_64 kernel-2.6.32-279.el6.x86_64 How reproducible: Should be 100%, but the whole thing was working OK until I rebooted Steps to Reproduce: 1. See attachment - contains original .xml file, fixed .xml file, and relevant log files 2. 3. Actual results: Teh Craziness Happen(TM) Expected results: GUI should at least show some error messages as to why the kVM went missing :( Also, XML parser should either escape the double dash, or disallow it to be created in the 1st place when constructing a kVM. Additional info: # Workaround fix: o I was able to work around the problem by: # virsh edit win7--64 # did not happen - error: kvm error: Domain not found: no domain with matching name # nano /etc/libvirt/qemu/win7--64.xml # and removed double-dashes # mv /etc/libvirt/qemu/win7--64.xml win7-64.xml ' service libvirtd restart ' o After restarting ' virt-manager ', the missing VM turned up OK as "win7-64". I was able to boot it OK, but it did not resume from its Suspended (Saved) state. --- Refs: http://www.mentby.com/Group/scientific-linux-users/kvm-vms-disappeared.html http://permalink.gmane.org/gmane.linux.scientific.user/1778 http://wiki.libvirt.org/page/FAQ#My_VM_doesn.27t_show_up_with_.27virsh_list.27 --- note: I did search the bugzilla under libvirtd but did not find a matching bug: https://bugzilla.redhat.com/buglist.cgi?query_format=specific&order=relevance+desc&bug_status=__open__&product=Red+Hat+Enterprise+Linux+6&content=libvirt
It appears that a domain name with a double hyphen is causing libvirt to generate XML that does not comply with the W3C recommendation: For compatibility, the string " -- " (double-hyphen) MUST NOT occur within comments.] See: http://www.w3.org/TR/REC-xml/#sec-comments
I have proposed a patch upstream that prevents putting double hyphens in the comment: https://www.redhat.com/archives/libvir-list/2012-October/msg01268.html
Fixed upstream by: commit 9b704ab8235af010b1fda4886201aab02098b969 Author: Ján Tomko <jtomko@redhat.com> AuthorDate: Tue, 23 Oct 2012 14:16:44 +0200 Commit: Michal Privoznik <mprivozn@redhat.com> CommitDate: Tue, 23 Oct 2012 14:24:31 +0200 xml: omit domain name from comment if it contains double hyphen We put a comment containing "virsh edit <domain_name>" at the start of the XML. W3C recommendation forbids the use of "--" in comments [1] and libvirt can't parse it either. This patch omits the domain name if it contains a double hyphen. [1] http://www.w3.org/TR/REC-xml/#sec-comments Moving to POST: http://post-office.corp.redhat.com/archives/rhvirt-patches/2012-October/msg01132.html
This doesn't fix it for snapshots, as it only checks the snapshot name in that case, not the domain name: 2012-10-25 08:32:51.506+0000: 5460: error : catchXMLError:691 : (domain_snapshot):4: Double hyphen within comment: <!-- WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES virsh snapshot-edit free--dos 1351153952 --------------------------^ 2012-10-25 08:32:51.506+0000: 5460: error : qemuDomainSnapshotLoad:514 : Failed to parse snapshot XML from file '/var/lib/libvirt/qemu/snapshot/free--dos/1351153952.xml'
Back in POST: http://post-office.corp.redhat.com/archives/rhvirt-patches/2012-October/msg01198.html
Reproduce it with: libvirt-0.10.2-5.el6.x86_64 Test with: libvirt-0.10.2-6.el6.x86_64 define/save/restore/snapshot All passed. So it's VERIFIED.
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