Commit Graph

55 Commits

Author SHA1 Message Date
Jim Meyering
0fa4d62986 python: let libvirt_virConnectDomainEventCallback indicate success
* python/libvir.c (libvirt_virConnectDomainEventCallback): Return 0
when successful, rather than always returning -1.
clang flagged this function for its dead-store of "ret=0".
Once "ret" was set to 0, it was never used, and
the function would always return -1.
2009-09-03 18:04:24 +02:00
Miloslav Trmač
9dc3b99345 Secret manipulation API docs refresh & wire up python generator
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

* python/generator.py: Add rules for virSecret APIs
* python/libvir.c, python/libvirt-python-api.xml: Manual impl of
  virSecretSetValue, virSecretGetValue$ and virConnectListSecrets APIs
* python/libvirt_wrap.h, python/types.c: Wrapper for virSecret objects
* docs/libvirt-api.xml, docs/libvirt-refs.xml,
  docs/html/libvirt-virterror.html, docs/html/libvirt-libvirt.html,
  docs/devhelp/libvirt-virterror.html, docs/devhelp/libvirt-libvirt.html:
  Re-generate with 'make api'
2009-09-01 18:27:06 +01:00
Daniel P. Berrange
7c99cb93c5 Fix python domain events example & binding 2009-05-28 11:02:11 +00:00
Daniel P. Berrange
554d82a200 Use global thread-local error for all python error reporting 2009-01-20 22:10:52 +00:00
Daniel P. Berrange
1eeceaa649 Support domain lifecycle events for Xen (Ben Guthro & Daniel Berrange) 2008-11-25 10:44:52 +00:00
Daniel P. Berrange
c673689430 Fix python bindings events code (David Lively) 2008-11-24 19:28:12 +00:00
Daniel P. Berrange
83928c2074 Python binding for node device APIs (David Lively) 2008-11-21 12:41:15 +00:00
Daniel P. Berrange
6d04effac7 Add a virFreeCallback to event loop APIs 2008-11-19 16:24:01 +00:00
Daniel P. Berrange
6d41cb87d3 Change public API for virEventAddHandle to allow multiple registrations per FD 2008-11-19 16:19:36 +00:00
Daniel P. Berrange
3d41e86534 Add a virFreeCallback to virDomainEventRegister (from David Lively) 2008-11-19 15:25:24 +00:00
Daniel P. Berrange
d3d54d2fc9 Add domain events detail information 2008-11-17 16:43:00 +00:00
Daniel P. Berrange
48e9d7b726 Fix domain events python thread safety & incorrect enum generation 2008-11-17 10:26:09 +00:00
Daniel Veillard
7b716fce8e * python/Makefile.am python/generator.py python/libvir.c
python/libvir.py python/libvirt_wrap.h python/types.c:
  adds support for events from the python bindings, also
  improves the generator allowing to embbed per function
  definition files, patch by Ben Guthro
* examples/domain-events/events-python/event-test.py: also
  adds a programming example
Daniel
2008-10-31 10:13:45 +00:00
Daniel Veillard
cb96ae2583 * python/generator.py python/libvir.c python/libvirt-python-api.xml:
Apply patch from Cole Robinson fixing UUIDString for python
Daniel
2008-06-10 15:20:25 +00:00
Jim Meyering
f41ba90c18 Work around Python.h name-space pollution.
* python/libvir.c (HAVE_PTHREAD_H): #undef.
Without this, we'd get a redefinition warning.
2008-04-18 18:07:40 +00:00
Jim Meyering
5bf824ea10 convert TAB-based indentation in C sources to use only spaces
Done using this command (also includes .c.in and .h.in files):
for i in $(g ls-files|grep -E '\.[ch](\.in)?$'|grep -v gnulib); do
  expand -i $i > j && mv j $i;done
2008-04-10 16:54:54 +00:00
Jim Meyering
dc42a9d2de remove Vim and Emacs variable settings from C source files
Done with these commands:
git grep -l Local.variab|xargs \
  perl -0x3b -pi -e 's,\n+/\*\n \* vim:(.|\n)*,\n,'

git grep -l Local.variab|xargs \
  perl -0x3b -pi -e 's,\n+/\*\n \* Local variables:\n(.|\n)*,\n,'
2008-04-10 16:53:29 +00:00
Richard W.M. Jones
bb8340c18d Many typos fixed (Atsushi SAKAI). 2008-02-29 12:53:10 +00:00
Daniel P. Berrange
859679f72a Added python binding for storage APIs 2008-02-20 15:26:22 +00:00
Daniel Veillard
ecaf98fcc5 Python bindings return values fixes
* python/libvir.c: apply patch from Cole Robinson to provide
  return values for manulally written python bindings.
Daniel
2008-02-07 09:49:13 +00:00
Jim Meyering
e04912a9f0 Remove all trailing blanks; turn on the rule to detect them.
* Makefile.cfg (local-checks-to-skip): Remove sc_trailing_blank.
* .x-sc_trailing_blank: New file, to exempt the few binary files.
2008-02-05 19:27:37 +00:00
Jim Meyering
a378188194 Enable the <config.h>-requiring test; fix violations
Use <config.h>, not "config.h", per autoconf documentation.
* Makefile.cfg (local-checks-to-skip) [sc_require_config_h]: Enable.
* .x-sc_require_config_h: New file, to list exempted files.
* Makefile.am (EXTRA_DIST): Add .x-sc_require_config_h.
2008-01-29 18:15:54 +00:00
Daniel P. Berrange
c9b7eae903 Make python generator fail build on any missing APIs 2008-01-21 15:55:53 +00:00
Daniel P. Berrange
62094f72f6 Add missing vcpu/schedular APIs to python binding 2008-01-21 15:41:15 +00:00
Jim Meyering
02b98afe29 Handle PyTuple_New's malloc failure.
* python/libvir.c (libvirt_virDomainBlockStats): Handle a NULL
return from PyTuple_New.
(libvirt_virDomainInterfaceStats, libvirt_virGetLastError): Likewise.
(libvirt_virConnGetLastError): Likewise.
2008-01-17 22:14:57 +00:00
Jim Meyering
ec6e9b7865 Factor out some duplication.
* python/libvir.c (VIR_PY_NONE): New macro, to encapsulate
a common two-statement sequence.
Replace all such 2-stmt sequences.
2008-01-17 22:13:55 +00:00
Jim Meyering
49230350fa Use a variable name as sizeof argument, not a type name.
Given code like: T *var = calloc (n, sizeof (T));
Convert to this: T *var = calloc (n, sizeof (*var));
This first-cut change adjusts all malloc, calloc, and
realloc statements.

The only binary differences are in remote_internal.c
(due to the bug fix) and in xmlrpc.c (due to factorization).

* python/libvir.c: As above.
* qemud/event.c: Likewise.
* qemud/mdns.c: Likewise.
* qemud/qemud.c: Likewise.
* qemud/remote.c: Likewise.
* src/bridge.c: Likewise.
* src/buf.c: Likewise.
* src/conf.c: Likewise.
* src/hash.c: Likewise.
* src/iptables.c: Likewise.
* src/openvz_conf.c: Likewise.
* src/qemu_conf.c: Likewise.
* src/qemu_driver.c: Likewise.
* src/test.c: Likewise.
* src/xen_internal.c: Likewise.
* src/xen_unified.c: Likewise.
* src/xm_internal.c: Likewise.
* src/xml.c: Likewise.
* tests/qemuxml2argvtest.c: Likewise.
* src/xmlrpc.c (xmlRpcValuePtr): Likewise, and minor factorization.
* src/remote_internal.c (remoteAuthMakeCredentials): Use the right
type when allocating space for an array of cred _pointers_.
2007-12-11 21:57:29 +00:00
Jim Meyering
4a2f8fc633 Include "config.h" in remaining non-generated files.
* proxy/libvirt_proxy.c: Likewise.
* python/libvir.c: Likewise.
* python/types.c: Likewise.
* src/event.c: Likewise.
* src/xm_internal.c: Likewise.
* tests/reconnect.c: Likewise.
* tests/testutils.c: Likewise.
2007-12-07 10:08:06 +00:00
Daniel Veillard
a56281c0a8 * python/generator.py python/libvir.c python/libvirt-python-api.xml:
add a python binding for virNodeGetCellsFreeMemory
Daniel
2007-12-07 08:41:01 +00:00
Daniel P. Berrange
5ab109f862 Add manual impl of virConnectOpenAuth python binding 2007-12-05 19:09:23 +00:00
Richard W.M. Jones
4bfdb77aae Wed Dec 5 13:48:00 UTC 2007 Richard W.M. Jones <rjones@redhat.com>
* python/libvir.c, python/libvirt_wrap.h, qemud/qemud.c,
        qemud/remote.c, src/internal.h, src/openvz_conf.c,
        src/openvz_driver.c, src/proxy_internal.h, src/qemu_conf.c,
        src/qemu_driver.c, src/remote_internal.h, src/test.h, src/util.c,
        src/xen_unified.c, src/xen_unified.h, tests/nodeinfotest.c,
        tests/qemuxml2argvtest.c, tests/qemuxml2xmltest.c, tests/reconnect.c,
        tests/sexpr2xmltest.c, tests/virshtest.c, tests/xencapstest.c,
        tests/xmconfigtest.c, tests/xml2sexprtest.c:
        Change #include <> to #include "" for local includes.
        Removed many includes from src/internal.h and put them in
        the C files which actually use them.
        Removed <ansidecl.h> - unused.
        Added a comment around __func__.
        Removed a clashing redefinition of VERSION symbol.
        All limits (PATH_MAX etc) now done in src/internal.h, so we
        don't need to include those headers in other files.
2007-12-05 13:56:22 +00:00
Richard W.M. Jones
2ac691d60e Fri Nov 30 11:04:00 GMT 2007 Richard W.M. Jones <rjones@redhat.com>
* python/libvir.c, python/libvir.py: Make Python aware that
	  the C bindings module is called cygvirtmod.dll when compiled
	  by CYGWIN.
	* python/Makefile.am: Remove symlink libvirtmod.dll -> cygvirtmod.dll
	  no longer necessary because of the above.
	* configure.in: Remove AM_CONDITIONAL(CYGWIN).
2007-11-30 11:10:53 +00:00
Daniel Veillard
795d920028 * python/generator.py python/libvir.c python/libvirt-python-api.xml:
provide bindings for block and interface statistics
Daniel
2007-09-30 20:52:13 +00:00
Richard W.M. Jones
3bcd26e6d2 +Tue May 29 15:56:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>
+
+       * python/generator.py, python/libvir.c, python/libvir.py:
+         Wrap the virGetVersion call as Python libvirt.getVersion.
+
+       * src/libvirt.c: Change virGetVersion so that the driver name
+         is case insensitive.
+
2007-05-29 14:58:27 +00:00
Daniel P. Berrange
7fd0878c40 Added vir*GetAutostart APIs to python 2007-04-10 23:15:58 +00:00
Daniel P. Berrange
6a66941843 Added python bindings for networking APIs 2007-03-09 15:42:50 +00:00
Daniel P. Berrange
d6db609d74 Fixed up numerous compiler warnings 2007-03-06 21:55:44 +00:00
Mark McLoughlin
6d153563be Mon Jan 23 14:36:18 IST 2007 Mark McLoughlin <markmc@redhat.com>
* include/libvirt/libvirt.h.in: add VIR_UUID_BUFLEN and
        VIR_UUID_STRING_BUFLEN

        * libvirt/proxy/libvirt_proxy.c, libvirt/src/hash.c,
        libvirt/src/internal.h, libvirt/src/libvirt.c,
        libvirt/src/proxy_internal.c, libvirt/src/test.c,
        libvirt/src/virsh.c, libvirt/src/xend_internal.c,
        libvirt/src/xm_internal.c, libvirt/src/xml.c,
        libvirt/python/libvir.c: use them
2007-01-23 14:39:45 +00:00
Daniel P. Berrange
a26b33cb15 Added binding for virConnectListDefinedDomains api 2006-11-16 00:17:10 +00:00
Daniel P. Berrange
a3cf19e62a Fix unsigned long wraparound in python binding 2006-11-15 19:40:00 +00:00
Daniel P. Berrange
e444b199db Propagate libvirt errors back with python exceptions 2006-11-07 23:18:56 +00:00
Daniel P. Berrange
9e5645393e Make python bindings threaded, by dropping/acquiring Python GIL where needed 2006-10-24 20:28:16 +00:00
Daniel Veillard
61e8450f25 * python/libvir.c: Pete Vetere pointed out a bug in string cast
when handling errors in Python
Daniel
2006-08-29 14:39:57 +00:00
Daniel Veillard
b62cdc1405 * configure.in libvirt.spec.in docs/examples/* include/Makefile.am
include/libvirt/virterror.h python/generator.py python/libvir.c
  python/libvirt_wrap.h src/driver.h src/internal.h src/test.h
  src/virsh.c src/virterror.c src/xend_internal.c src/xend_internal.h
  src/xml.c src/xml.h: moved the includes from include/ to
  include/libvirt to reflect the installed include tree. This
  avoid using "" in the includes themselves.
Daniel
2006-06-26 15:02:18 +00:00
Daniel Veillard
880f4e9ae2 * python/libvir.c: fixed a bug in the new wrapper
* python/tests/Makefile.am python/tests/node.py: added a new test for
  the new API
* python/tests/create.py: remove a debug
Daniel
2006-03-29 13:33:37 +00:00
Daniel Veillard
212eaea323 * include/libvirt.h[.in] include/virterror.h src/driver.h
src/internal.h src/libvirt_sym.version src/xen_internal.c
  src/xs_internal.c: added a new entry point to get node hardware
  informations virGetNodeInfo, and associated driver hook.
* src/xend_internal.c: implemented the node and version information
  hooks for the Xen Daemon
* python/libvir.c python/libvirt-python-api.xml python/generator.py:
  also added Python bindings for the new call
Daniel
2006-03-29 12:46:03 +00:00
Daniel Veillard
538686f9c0 * python/libvir.c: call the initialize entry point
* src/libvirt_sym.version: add initialize entry point
* src/libvirt.c: make sure we always initialize the lib
* python/tests/*.py: start updating exemple for exception
  handling as pointed by Jim Meyering
Daniel
2006-03-28 14:41:04 +00:00
Daniel Veillard
65bace1765 * TODO: updated
* python/Makefile.am python/generator.py python/libvir.c
  python/libvir.py: improved python binding, raise exception
  when an instance creation or lookup fails, and add support
  for the global error handler, per conn handler still needed
* python/tests/error.py python/tests/Makefile.am: adding a
  regression test
Daniel
2006-02-28 12:17:00 +00:00
Daniel Veillard
fd21f1b3ec * python/generator.py python/libvir.c python/libvirt-python-api.xml:
UUID strings can contain zeroes, so the autogenerated conversion
  functions don't work.
Daniel
2006-02-24 12:26:56 +00:00
Daniel Veillard
97f9566687 * src/libvirt.c: fixing a bug before the release of 0.0.5
* python/generator.py python/libvir.c python/libvirt-python-api.xml:
  also fixing the binding for getting a domain UUID
* python/tests/Makefile.am python/tests/uuid.py: added a test
  for the new UUID API
Daniel
2006-02-23 11:26:17 +00:00