Bug 1115039

Summary: [vdsm] libvirtError: argument unsupported: QEMU driver does not support <metadata> element
Product: Red Hat Enterprise Linux 6 Reporter: Jiri Belka <jbelka>
Component: libvirtAssignee: Peter Krempa <pkrempa>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 6.5CC: bazulay, dyuan, fsimonce, gklein, iheim, jdenemar, lhuang, mgoldboi, mzhan, nicolas, pkrempa, rbalakri, s.kieske, ydu, yeylon, zhwang, zsong
Target Milestone: pre-dev-freezeKeywords: FutureFeature
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard: sla
Fixed In Version: libvirt-0.10.2-42.el6 Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-10-14 04:22:53 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1122205, 1122255    
Attachments:
Description Flags
sosreport-LogCollector-20140701150410.7z.001
none
sosreport-LogCollector-20140701150410.7z.002
none
i have used in comment 13 none

Description Jiri Belka 2014-07-01 13:08:07 UTC
Created attachment 913756 [details]
sosreport-LogCollector-20140701150410.7z.001

Description of problem:

Some errors in logs... No idea about impact.

~~~ vdsm.log ~~~
Thread-87::DEBUG::2014-07-01 14:55:37,982::libvirtconnection::143::root::(wrapper) Unknown libvirterror: ecode: 74 edom: 10 level: 2 message: arg
ument unsupported: QEMU driver does not support <metadata> element
Thread-87::ERROR::2014-07-01 14:55:37,982::vm::319::vm.Vm::(_sampleCpuTune) vmId=`3ad04fb4-5589-4a70-b240-3bccc48cd613`::Failed to retrieve QoS m
etadata
Traceback (most recent call last):
  File "/usr/share/vdsm/virt/vm.py", line 316, in _sampleCpuTune
    libvirt.VIR_DOMAIN_METADATA_ELEMENT, METADATA_VM_TUNE_URI, 0)
  File "/usr/share/vdsm/virt/vm.py", line 604, in f
    ret = attr(*args, **kwargs)
  File "/usr/lib64/python2.6/site-packages/vdsm/libvirtconnection.py", line 111, in wrapper
    ret = f(*args, **kwargs)
  File "/usr/lib64/python2.6/site-packages/libvirt.py", line 904, in metadata
    if ret is None: raise libvirtError ('virDomainGetMetadata() failed', dom=self)
libvirtError: argument unsupported: QEMU driver does not support <metadata> element
~~~

~~~ libvirtd.log ~~~
2014-07-01 12:54:22.914+0000: 12179: error : qemuDomainGetMetadata:14729 : argument unsupported: QEMU driver does not support <metadata> element
2014-07-01 12:54:37.927+0000: 12175: error : qemuDomainGetMetadata:14729 : argument unsupported: QEMU driver does not support <metadata> element
~~~

Version-Release number of selected component (if applicable):
libvirt-0.10.2-29.el6_5.9.x86_64
vdsm-python-4.16.0-3.git601f786.el6.x86_64
vdsm-python-zombiereaper-4.16.0-3.git601f786.el6.noarch
vdsm-xmlrpc-4.16.0-3.git601f786.el6.noarch
libvirt-lock-sanlock-0.10.2-29.el6_5.9.x86_64
vdsm-yajsonrpc-4.16.0-3.git601f786.el6.noarch
vdsm-4.16.0-3.git601f786.el6.x86_64
libvirt-client-0.10.2-29.el6_5.9.x86_64
libvirt-python-0.10.2-29.el6_5.9.x86_64
vdsm-jsonrpc-4.16.0-3.git601f786.el6.noarch
vdsm-cli-4.16.0-3.git601f786.el6.noarch

How reproducible:
???

Steps to Reproduce:
1. ???
2.
3.

Actual results:
just happens/appears

Expected results:
???

Additional info:

Comment 1 Jiri Belka 2014-07-01 13:09:09 UTC
Created attachment 913757 [details]
sosreport-LogCollector-20140701150410.7z.002

Comment 2 Martin Sivák 2014-07-02 09:21:26 UTC
As the metadata element support is publicly declared in the API I think this is a libvirt bug.

http://libvirt.org/hvsupport.html states that virDomainSetMetadata on qemu has been supported since 0.9.10

and http://libvirt.org/html/libvirt-libvirt.html#virDomainSetMetadata does not mention any version or limitation at all.

The impact is that half of the RHEV QoS feature won't work properly on CentOS and RHEL 6. This is a major feature for the upcoming release of RHEV 3.5.

(We can accept a fixed package in the EPEL repository if it is not possible to backport this to current RHEL 6 versions)

Comment 4 Peter Krempa 2014-07-02 09:32:46 UTC
Following commits add the functionality upstream:

$ git describe 935c031730d9ea83eba1b6a224176a932c6fb8c8 --match=v*
v1.1.2-158-g935c031
$ git describe 935c031730d9ea83eba1b6a224176a932c6fb8c8 --match=v* --contains
v1.1.3-rc1~119

commit 935c031730d9ea83eba1b6a224176a932c6fb8c8
Author: Peter Krempa <pkrempa>
Date:   Tue Sep 17 15:22:42 2013 +0200

    tests: metadatatest: Quiesce errors on expected paths
    
    Use the helper added in previous patch to quiesce errors from this test
    that was spamming logs on normal test runs.

commit 43f68a4f9e222d54cce7937890abe4f4453b921c
Author: Peter Krempa <pkrempa>
Date:   Tue Sep 17 15:20:24 2013 +0200

    test: Refactor setting of dummy error handlers
    
    Multiple tests need to register a function to quiesce errors from
    libvirt when using a connection and doing negative tests. Each of those
    tests had a static function to do so. This can be replaced by a utility
    function that enables the errors when debug is enabled.
    
    This patch adds virtTestQuiesceLibvirtErrors() and refactors test that
    use private handlers.

commit 6bf4c779841f858872003ffe6a97df395b2940e6
Author: Peter Krempa <pkrempa>
Date:   Tue Sep 17 13:40:08 2013 +0200

    virsh: Don't shadow global variable "remove" in cmdMetadata
    
    Some systems apparently have a global variable/function called remove
    and thus break compilation of virsh-domain.c. Rename the variable to
    avoid this.
    
    Reported by GuanQiang.

commit 0d4f469c871fb5997bb24f192924163263445980
Author: Peter Krempa <pkrempa>
Date:   Tue Sep 17 13:27:58 2013 +0200

    conf: Avoid false positive of uninitialized variable use
    
    GCC 4.8.0+ whines about variable "new" being uninitialized since
    commit 73bfac0e7182a3abd. This is a false positive as the
    xmlFreeNode(new) statement can be only reached if new was actually
    allocated successfully.
    
      CC       conf/libvirt_conf_la-domain_conf.lo
      conf/domain_conf.c: In function 'virDomainDefSetMetadata':
      conf/domain_conf.c:18650:24: error: 'new' may be used uninitialized in this function [-Werror=maybe-uninitialized]
                   xmlFreeNode(new);
    
    Reported independently by John Ferlan and Michal Privoznik.

commit 7655ed0802eecc3d8486a0360d2326ecd052e477
Author: Peter Krempa <pkrempa>
Date:   Tue Sep 17 11:16:30 2013 +0200

    conf: Don't corrupt metadata on OOM
    
    Eric Blake suggested that we could do a little better in case copying of
    the metadata to be set fails. With this patch, the old metadata is
    discarded after the new string is copied successfuly.

commit 2e23c77b0061c5f1b2fd5eeca79e3d6e963e7a2f
Author: Peter Krempa <pkrempa>
Date:   Mon Sep 9 19:22:19 2013 +0200

    tests: Add metadata tests
    
    This test exercises the virDomain[Get|Set]Metadata API and tests it for
    regressions

commit f616fbf2a4a31a2f944aae0b75d6e2ab3bef3573
Author: Peter Krempa <pkrempa>
Date:   Mon Sep 9 18:02:59 2013 +0200

    test: Add <metadata> support into the test driver

commit f9c7b32e5de3fb0ccf2e0858716886bdb35a9913
Author: Peter Krempa <pkrempa>
Date:   Fri Sep 6 17:42:38 2013 +0200

    lxc: Add metadata modification APIs

commit 3b6784d119074e3be8861cc4c30630f299bde121
Author: Peter Krempa <pkrempa>
Date:   Tue Sep 10 11:25:55 2013 +0200

    lib: Don't force the key argument when deleting metadata
    
    virDomainSetMetadata when operating on the metadata element was
    requesting the @key argument to be passed even if @metadata was NULL
    used to delete the corresponding metadata element. This is not needed as
    the key is only used when adding the element and matching is done via
    the XML namespace.

commit 73bfac0e7182a3abde02304fd2f17845715a9a2e
Author: Peter Krempa <pkrempa>
Date:   Mon Sep 9 11:49:11 2013 +0200

    conf: allow to add XML metadata using the virDomainSetMetadata api
    
    The functionality wasn't originally implemented. This patch adds the
    ability to modify domain's XML metadata using the API.

commit ac38bff077642daa17f9a82480062ebef4c11a7b
Author: Peter Krempa <pkrempa>
Date:   Fri Sep 6 17:34:43 2013 +0200

    conf: Add support for requesting of XML metadata via the API
    
    The virDomainGetMetadata function was designed to support also retrieval
    of app specific metadata from the <metadata> element. This functionality
    was never implemented originally.

commit 01b03f59e76865feed3097cbe6dc0a809caccc14
Author: Peter Krempa <pkrempa>
Date:   Mon Sep 9 10:54:04 2013 +0200

    virsh-domain: Add command to allow modifications of XML metadata
    
    The metadata modification functions will support modification of the XML
    metadata. Add a virsh command to allow using this approach.

commit 3df33d7ad52d27bf9a41ab07e2c0ab631364ae04
Author: Peter Krempa <pkrempa>
Date:   Wed Sep 4 17:27:27 2013 +0200

    virsh-domain: use virXMLNodeToString instead of xmlNodeDump

commit be0f0c2292e3f171a031086f4d0a39b205c756a3
Author: Peter Krempa <pkrempa>
Date:   Wed Sep 4 16:49:40 2013 +0200

    util: Add helper to convert libxml2 nodes to a string

commit e9cb66f14e19935db16938ebdf1e407103b4de1e
Author: Peter Krempa <pkrempa>
Date:   Fri Sep 6 16:38:55 2013 +0200

    conf: Factor out setting of metadata to simplify code
    
    The code to set the metadata in a domain definition is common to live
    and inactive domains. Factor it out into a common func.

commit f87a7c67de946f941fddde44d5959baaac6c7de4
Author: Peter Krempa <pkrempa>
Date:   Tue Jun 11 15:45:05 2013 +0200

    qemu: Factor out body of qemuDomainSetMetadata for universal use
    
    The function implemented common behavior that can be reused for other
    hypervisor drivers that use the virDomainObj data structures. Factor out
    the core into a separate helper func.

commit 99c51af2ee42de980c258ecb52cf20f96c69ff83
Author: Peter Krempa <pkrempa>
Date:   Tue Jun 11 15:45:05 2013 +0200

    qemu: Factor out body of qemuDomainGetMetadata for universal use
    
    The function implemented common behavior that can be reused for other
    hypervisor drivers that use the virDomainObj data structures. Factor out
    the core into a separate helper func.

Comment 5 Martin Sivák 2014-07-02 10:04:24 UTC
*** Bug 1114968 has been marked as a duplicate of this bug. ***

Comment 11 Eric Blake 2014-07-22 19:13:05 UTC
This patch also needs the fix for bug 1122205 for metadata changes to survive a libvirtd restart.

Comment 12 Peter Krempa 2014-07-30 08:43:11 UTC
*** Bug 1124740 has been marked as a duplicate of this bug. ***

Comment 13 Luyao Huang 2014-09-05 07:40:43 UTC
I can reproduce it with libvirt-python-0.10.2-29.el6_5.9.x86_64
libvirt-0.10.2-29.el6_5.9.x86_64.
steps for reproduce:

# python testmetadata.py -n r6 -o set -t 2 -u "http://herp.derp/" -k test -m "<foo><bar fooish='blurb'>baz</bar></foo>" 
libvir: QEMU Driver error : argument unsupported: QEmu driver does not support modifying <metadata> element
Traceback (most recent call last):
  File "testmetadata.py", line 85, in <module>
    main()
  File "testmetadata.py", line 78, in main
    do_set(dom, mtype, metadata, key, uri, flags)
  File "testmetadata.py", line 9, in do_set
    if dom.setMetadata(mtype, metadata, key, uri, flags):
  File "/usr/lib64/python2.6/site-packages/libvirt.py", line 1461, in setMetadata
    if ret == -1: raise libvirtError ('virDomainSetMetadata() failed', dom=self)
libvirt.libvirtError: argument unsupported: QEmu driver does not support modifying <metadata> element

/var/log/libvirt/libvirtd.log

2014-09-05 07:15:37.441+0000: 9376: info : libvirt version: 0.10.2, package: 29.el6_5.9 (Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>, 2014-05-29-05:18:21, x86-022.build.eng.bos.redhat.com)
2014-09-05 07:15:37.441+0000: 9376: error : qemuDomainSetMetadata:14633 : argument unsupported: QEmu driver does not support modifying <metadata> element

Verified it with libvirt-0.10.2-45.el6.x86_64
libvirt-python-0.10.2-45.el6.x86_64

Steps:


1.# python testmetadata.py -n test6 -o set -t 2 -u "http://herp.derp/" -k test -m "<foo><bar fooish='blurb'>baz</bar></foo>"
Okay
2.# python testmetadata.py -n test6 -o get -t 2 -u "http://herp.derp/"
<foo>
  <bar fooish="blurb">baz</bar>
</foo>
3.# virsh dumpxml test6

  <metadata>
    <test:foo xmlns:test="http://herp.derp/">
      <test:bar fooish="blurb">baz</test:bar>
    </test:foo>
  </metadata>


4.# python testmetadata.py -n vm1 -o remove -t 2 -u "http://herp.derp/"
Okay
5.# # virsh dumpxml test6

  <metadata/>

Also can use a rhel7 client to connect rhel6 libvirtd to use virsh command test it:

1.virsh -c qemu://rhel6/system

2.virsh # metadata r6 --uri http://herp.derp/ --key herp --set  "<derp xmlns:foobar='http://foo.bar/'></derp>"
Metadata modified

3.virsh # metadata r6 --uri http://herp.derp/ 
<derp xmlns:foobar="http://foo.bar/"/>

4.virsh # dumpxml r6

  <metadata>
    <herp:derp xmlns:foobar="http://foo.bar/" xmlns:herp="http://herp.derp/"/>
  </metadata>

5.virsh # metadata r6 --uri http://herp.derp/ --remove
Metadata removed

6.virsh # metadata r6 --uri http://herp.derp/ 
error: metadata not found: Requested metadata element is not present

7.virsh # dumpxml r6

  <metadata/>

Comment 14 Luyao Huang 2014-09-05 07:52:12 UTC
Created attachment 934697 [details]
i have used in comment 13

Comment 16 errata-xmlrpc 2014-10-14 04:22:53 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.

http://rhn.redhat.com/errata/RHBA-2014-1374.html