[libvirt] [PATCH 10/20] Secret manipulation step 10: Add Python API

Daniel P. Berrange berrange at redhat.com
Thu Aug 27 16:16:30 UTC 2009


On Thu, Aug 20, 2009 at 08:18:08PM +0200, Miloslav Trma?? wrote:
> Sample session:
> 
> >>> import libvirt
> >>> c = libvirt.open('qemu:///session')
> 
> >>> c.listSecrets()
> ['12247729-47d2-a783-88ce-b329d4781cd3', 'reee', 'abc']
> 
> >>> s = c.secretDefineXML("<secret ephemeral='no' private='no'>\n<description>Something for use</description>\n<volume>/foo/bar</volume>\n</secret>\n")
> 
> >>> s.UUIDString()
> '340c2dfb-811b-eda8-da9e-25ccd7bfd650'
> 
> >>> s.XMLDesc()
> "<secret ephemeral='no' private='no'>\n  <uuid>340c2dfb-811b-eda8-da9e-25ccd7bfd650</uuid>\n  <description>Something for use</description>\n  <volume>/foo/bar</volume>\n</secret>\n"
> 
> >>> s.setValue('abc\0xx\xffx')
> 0
> 
> >>> s.value()
> 'abc\x00xx\xffx'
> 
> >>> s.undefine()
> 0
> 
> Changes since the third submission:
> - Add "flags" parameter to virSecretDefineXML(), virSecretGetXMLDesc(),
>   virSecretGetValue(), virSecretSetValue(), and all derived interfaces.
> - remove "get" prefix from method names of virSecret, to be more
>   consistent with other classes.
> ---
>  python/generator.py           |   31 +++++++++++--
>  python/libvir.c               |  100 +++++++++++++++++++++++++++++++++++++++++
>  python/libvirt-python-api.xml |   18 +++++++
>  python/libvirt_wrap.h         |    9 ++++
>  python/types.c                |   13 +++++
>  5 files changed, 167 insertions(+), 4 deletions(-)

ACK looks good.


Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list