Hide Forgot
description of problem: Setting metadata with special character in key value caused guest failed to start and disappeared after restarting libvirtd. version: libvirt-1.2.8-2.el7.x86_64 qemu-kvm-1.5.3-60.el7.x86_64 How reproducible: 100% step to reproduce: 1. set metadata for a shutoff guest #virsh metadata virt-tests-vm1 "http://herp.derp/" "herp//" "<foo><bar>baz</bar></foo>" Metadata modified 2. check the metadata. # virsh metadata virt-tests-vm1 "http://herp.derp/" <foo> <bar>baz</bar> </foo> # virsh dumpxml virt-tests-vm1 | grep "metadata" -A 4 <metadata> <herp//:foo xmlns:herp//="http://herp.derp/"> <herp//:bar>baz</herp//:bar> </herp//:foo> </metadata> 3. start the guest. # virsh start virt-tests-vm1 error: Failed to start domain virt-tests-vm1 error: (domain_definition):5: error parsing attribute name <herp//:foo xmlns:herp//="http://herp.derp/"> ---------^ 4. restart libvirtd, the guest disappeared # service libvirtd restart Redirecting to /bin/systemctl restart libvirtd.service # virsh list --all Actual results: As described. Expect result: The guest should be started sucessfully and don't disappear after libvirtd restart..
Fixed upstream: commit 2c22954f99a70ed654e4116a18f433afa24d41c5 Author: Erik Skultety <eskultet> Date: Thu Dec 4 14:37:09 2014 +0100 util: check for an illegal character in a XML namespace prefix When user tries to insert element metadata providing a namespace declaration as well, currently we insert the element without any validation check for XML prefix (if provided). The next VM start would then fail with parse error. This patch fixes this issue by adding a call to xmlValidateNCName function to check for illegal characters in the prefix. v1.2.10-277-g2c22954
Verify this bug with libvirt-1.2.17-2.el7.x86_64: 1. # virsh metadata test4 "http://herp.derp/" "herp//" "<foo><bar>baz</bar></foo>" error: internal error: failed to validate prefix for a new XML namespace 2. test other # virsh metadata test4 "http://herp.derp/" "herp#" "<foo><bar>baz</bar></foo>" error: internal error: failed to validate prefix for a new XML namespace # virsh metadata test4 "http://herp.derp/" "herp@" "<foo><bar>baz</bar></foo>" error: internal error: failed to validate prefix for a new XML namespace # virsh metadata test4 "http://herp.derp/" "herp!" "<foo><bar>baz</bar></foo>" -bash: !": event not found # virsh metadata test4 "http://herp.derp/" "herp~" "<foo><bar>baz</bar></foo>" error: internal error: failed to validate prefix for a new XML namespace # virsh metadata test4 "http://herp.derp/" "herp?" "<foo><bar>baz</bar></foo>" error: internal error: failed to validate prefix for a new XML namespace # virsh metadata test4 "http://herp.derp/" "herp:" "<foo><bar>baz</bar></foo>" error: internal error: failed to validate prefix for a new XML namespace # virsh metadata test4 "http://herp.derp/" "herp}" "<foo><bar>baz</bar></foo>" error: internal error: failed to validate prefix for a new XML namespace # virsh metadata test4 "http://herp.derp/" "herp|" "<foo><bar>baz</bar></foo>" error: internal error: failed to validate prefix for a new XML namespace # virsh metadata test4 "http://herp.derp/" "herp|" "<foo><bar>baz</bar></foo>" error: internal error: failed to validate prefix for a new XML namespace
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. https://rhn.redhat.com/errata/RHBA-2015-2202.html