[libvirt] python setMetadata issue

Doug Goldstein cardoe at cardoe.com
Wed Dec 25 07:08:45 UTC 2013


On Dec 24, 2013, at 2:13 AM, Umar Draz <unix.co at gmail.com> wrote:
> 
> Hi
> 
> I am trying to set Metada of running virtual machine, but its giving me an error.

Thanks for taking the time to report a potential issue. When you report potential issues please make sure to include the version of libvirt you are using. 
> 
> Here is my code
> 
> import libvirt
> 
> conn = libvirt.open('qemu+tcp://10.0.128.12/system')
> dom = conn.lookupByName('virtspace')
> type = 'VIR_DOMAIN_METADATA_DESCRIPTION'

The type value is not a string, it should be libvirt.VIR_DOMAIN_METADATA_DESCRIPTION
> key = ''
> uri = ''

The above values must be set to None for when setting the description per the documentation.
> 
> dom.setMetadata(conn, type, 'myDescription', key, uri)
> 
> 
> and here is the error.
> 
> Traceback (most recent call last):
>   File "setMeta.py", line 11, in <module>
>     dom.setMetadata(conn, type, 'meta_test', key, uri)
>   File "/usr/lib64/python2.6/site-packages/libvirt.py", line 1460, in setMetadata
>     ret = libvirtmod.virDomainSetMetadata(self._o, type, metadata, key, uri, flags)
> AttributeError: virConnect instance has no attribute '__trunc__'

Definitely curious what version you used since we should not error like this despite the argument mix up.
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20131225/2c503406/attachment-0001.htm>


More information about the libvir-list mailing list