Bug 1143921 - Setting metadata with special character in key value caused guest failed to start and disappeared after restarting libvirtd.
Summary: Setting metadata with special character in key value caused guest failed to s...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.1
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Erik Skultety
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-09-18 09:18 UTC by Ruifeng
Modified: 2015-11-19 05:53 UTC (History)
6 users (show)

Fixed In Version: libvirt-1.2.13-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 05:53:03 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2202 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2015-11-19 08:17:58 UTC

Description Ruifeng 2014-09-18 09:18:58 UTC
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..

Comment 1 Erik Skultety 2014-12-10 09:31:39 UTC
Fixed upstream:

commit 2c22954f99a70ed654e4116a18f433afa24d41c5
Author: Erik Skultety <eskultet@redhat.com>
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

Comment 3 Luyao Huang 2015-07-14 03:04:04 UTC
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

Comment 5 errata-xmlrpc 2015-11-19 05:53:03 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.

https://rhn.redhat.com/errata/RHBA-2015-2202.html


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