summaryrefslogtreecommitdiffstats
path: root/generator.py
Commit message (Collapse)AuthorAgeFilesLines
* python: Actually implement list*Interfaces bindingsv0.7.4v0.7.3Cole Robinson2009-11-201-2/+2
| | | | | | * python/generator.py python/libvirt-override-api.xml python/libvirt-override.c: implement the bindings for virConnectListInterfaces() and virConnectListDefinedInterfaces()
* Add virConnectGetLibvirtVersion APICole Robinson2009-11-121-0/+1
| | | | | | There is currently no way to determine the libvirt version of a remote libvirtd we are connected to. This is a useful piece of data to enable feature detection.
* python: Add a newline after custom classesv0.7.2Cole Robinson2009-10-051-0/+1
| | | | | In the generated bindings, custom classes are squashed against the following class, which hurts readability.
* python: Fix generated virInterface method namesCole Robinson2009-10-051-2/+5
| | | | | | | | | | | A mistake in the generator was causing virInterface methods to be generated with unpredicatable names ('ceUndefine', instead of just 'undefine'). This fixes the method names to match existing convention. Does anyone care if we are breaking API compat? My guess is that no one is using the python interface bindings yet. Signed-off-by: Cole Robinson <crobinso@redhat.com>
* python: Use a pure python implementation of 'vir*GetConnect'Cole Robinson2009-10-051-0/+21
| | | | | | | | The API docs explictly warn that we shouldn't use the C vir*GetConnect calls in bindings: doing so can close the internal connection pointer and cause things to get screwy. Implement these calls in python. Signed-off-by: Cole Robinson <crobinso@redhat.com>
* python: Don't generate bindings for vir*RefCole Robinson2009-10-051-0/+10
| | | | | | | They are only for use in implementing the bindings, so shouldn't be exposed to regular API users. Signed-off-by: Cole Robinson <crobinso@redhat.com>
* python: Don't generate conflicting conn.createXML functions.Cole Robinson2009-10-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A special case in the generator wasn't doing its job, and duplicate conn.createXML functions were being generated. The bindings diff is: @@ -1079,14 +1079,6 @@ class virConnect: return __tmp def createXML(self, xmlDesc, flags): - """Create a new device on the VM host machine, for example, - virtual HBAs created using vport_create. """ - ret = libvirtmod.virNodeDeviceCreateXML(self._o, xmlDesc, flags) - if ret is None:raise libvirtError('virNodeDeviceCreateXML() failed', conn=self) - __tmp = virNodeDevice(self, _obj=ret) - return __tmp - - def createXML(self, xmlDesc, flags): """Launch a new guest domain, based on an XML description similar to the one returned by virDomainGetXMLDesc() This function may requires privileged access to the hypervisor. @@ -1327,6 +1319,14 @@ class virConnect: __tmp = virNetwork(self, _obj=ret) return __tmp + def nodeDeviceCreateXML(self, xmlDesc, flags): + """Create a new device on the VM host machine, for example, + virtual HBAs created using vport_create. """ + ret = libvirtmod.virNodeDeviceCreateXML(self._o, xmlDesc, flags) + if ret is None:raise libvirtError('virNodeDeviceCreateXML() failed', conn=self) + __tmp = virNodeDevice(self, _obj=ret) + return __tmp + def nodeDeviceLookupByName(self, name): """Lookup a node device by its name. """ ret = libvirtmod.virNodeDeviceLookupByName(self._o, name) Signed-off-by: Cole Robinson <crobinso@redhat.com>
* python: Remove use of xmllib in generator.pyCole Robinson2009-10-051-14/+9
| | | | | | | xmllib has been deprecated since python 2.0, and running the generator throws a warning. Move to using xml.sax Signed-off-by: Cole Robinson <crobinso@redhat.com>
* python: Remove FastParser from generator.Cole Robinson2009-10-051-50/+3
| | | | | | | | | FastParser uses sgmlop, a non-standard python module meant as a replacement for xmllib (which is deprecated since python 2.0). Fedora doesn't even carry this module, and the generator doesn't have high performance requirements, so just rip the code out. Signed-off-by: Cole Robinson <crobinso@redhat.com>
* Add public API definition for data stream handlingDaniel P. Berrange2009-09-291-4/+28
| | | | | | | | | | | | | | | | | | | * include/libvirt/libvirt.h.in: Public API contract for virStreamPtr object * src/libvirt_public.syms: Export data stream APIs * src/libvirt_private.syms: Export internal helper APIs * src/libvirt.c: Data stream API driver dispatch * src/datatypes.h, src/datatypes.c: Internal helpers for virStreamPtr object * src/driver.h: Define internal driver API for streams * .x-sc_avoid_write: Ignore src/libvirt.c because it trips up on comments including write() * python/Makefile.am: Add libvirt-override-virStream.py * python/generator.py: Add rules for virStreamPtr class * python/typewrappers.h, python/typewrappers.c: Wrapper for virStreamPtr * docs/libvirt-api.xml, docs/libvirt-refs.xml: Regenerate with new APIs
* Fix API doc extractor to stop munging comment formattingDaniel P. Berrange2009-09-281-12/+13
| | | | | | | | | | | | | | | | | | | | | The python method help docs are copied across from the C funtion comments, but in the process all line breaks and indentation was being lost. This made the resulting text and code examples completely unreadable. Both the API doc extractor and the python generator were destroying whitespace & this fixes them to preserve it exactly. * docs/apibuild.py: Preserve all whitespace when extracting function comments. Print function comment inside a <![CDATA[ section to fully preserve all whitespace. Look for the word 'returns' to describe return values, instead of 'return' to avoid getting confused with code examples including the C 'return' statement. * python/generator.py: Preserve all whitespace when printing function help docs * src/libvirt.c: Change any return parameter indicated by 'return' to be 'returns', to avoid confusing the API extractor * docs/libvirt-api.xml: Re-build for fixed descriptions
* Re-arrange python generator to make it clear what's auto-generatedDaniel P. Berrange2009-09-211-32/+32
| | | | | | | | | | | | | | * README: New file describing what each file is used for * livvirt-override.c, libvirt-override.py, libvirt-override-api.xml, libvirt-override-virConnect.py: Manually written code overriding the generator * typewrappers.c, typewrappers.h: Data type wrappers * generator.py: Automatically pre-prend contents of libvirt-override.py to generated libvirt.py. Output into libvirt.py directly instead of libvirtclass.py. Don't generate libvirtclass.txt at all. Write C files into libvirt.c/.h directly * Makefile.am: Remove rule for creating libvirt.py from libvirt-override.py and libvirtclass.py, since generator.py does it directly
* Add usage type/id as a public API property of virSecretv0.7.1Daniel P. Berrange2009-09-141-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | * include/libvirt/libvirt.h, include/libvirt/libvirt.h.in: Add virSecretGetUsageType, virSecretGetUsageID and virLookupSecretByUsage * python/generator.py: Mark virSecretGetUsageType, virSecretGetUsageID as not throwing exceptions * qemud/remote.c: Implement dispatch for virLookupSecretByUsage * qemud/remote_protocol.x: Add usage type & ID as attributes of remote_nonnull_secret. Add RPC calls for new public APIs * qemud/remote_dispatch_args.h, qemud/remote_dispatch_prototypes.h, qemud/remote_dispatch_ret.h, qemud/remote_dispatch_table.h, qemud/remote_protocol.c, qemud/remote_protocol.h: Re-generate * src/datatypes.c, src/datatypes.h: Add usageType and usageID as properties of virSecretPtr * src/driver.h: Add virLookupSecretByUsage driver entry point * src/libvirt.c: Implement virSecretGetUsageType, virSecretGetUsageID and virLookupSecretByUsage * src/libvirt_public.syms: Export virSecretGetUsageType, virSecretGetUsageID and virLookupSecretByUsage * src/remote_internal.c: Implement virLookupSecretByUsage entry * src/secret_conf.c, src/secret_conf.h: Remove the virSecretUsageType enum, now in public API. Make volume path mandatory when parsing XML * src/secret_driver.c: Enforce usage uniqueness when defining secrets. Implement virSecretLookupByUsage api method * src/virsh.c: Include usage for secret-list command
* Fix UUID handling in secrets/storage encryption APIsDaniel P. Berrange2009-09-141-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Convert all the secret/storage encryption APIs / wire format to handle UUIDs in raw format instead of non-canonical printable format. Guarentees data format correctness. * docs/schemas/storageencryption.rng: Make UUID mandatory for a secret and validate fully * docs/schemas/secret.rng: Fully validate UUID * include/libvirt/libvirt.h, include/libvirt/libvirt.h.in, Add virSecretLookupByUUID and virSecretGetUUID. Make virSecretGetUUIDString follow normal API design pattern * python/generator.py: Skip generation of virSecretGetUUID, virSecretGetUUIDString and virSecretLookupByUUID * python/libvir.c, python/libvirt-python-api.xml: Manual impl of virSecretGetUUID,virSecretGetUUIDString and virSecretLookupByUUID * qemud/remote.c: s/virSecretLookupByUUIDString/virSecretLookupByUUID/ Fix get_nonnull_secret/make_nonnull_secret to use unsigned char * qemud/remote_protocol.x: Fix remote_nonnull_secret to use a remote_uuid instead of remote_nonnull_string for UUID field. Rename REMOTE_PROC_SECRET_LOOKUP_BY_UUID_STRING to REMOTE_PROC_SECRET_LOOKUP_BY_UUID_STRING and make it take an remote_uuid value * qemud/remote_dispatch_args.h, qemud/remote_dispatch_prototypes.h, qemud/remote_dispatch_ret.h, qemud/remote_dispatch_table.h, qemud/remote_protocol.c, qemud/remote_protocol.h: Re-generate * src/datatypes.h, src/datatypes.c: Store UUID in raw format instead of printable. Change virGetSecret to use raw format UUID * src/driver.h: Rename virDrvSecretLookupByUUIDString to virDrvSecretLookupByUUID and use raw format UUID * src/libvirt.c: Add virSecretLookupByUUID and virSecretGetUUID and re-implement virSecretLookupByUUIDString and virSecretGetUUIDString in terms of those * src/libvirt_public.syms: Add virSecretLookupByUUID and virSecretGetUUID * src/remote_internal.c: Rename remoteSecretLookupByUUIDString to remoteSecretLookupByUUID. Fix typo in args for remoteSecretDefineXML impl. Use raw UUID format for get_nonnull_secret and make_nonnull_secret * src/storage_encryption_conf.c, src/storage_encryption_conf.h: Storage UUID in raw format, and require it to be present in XML. Use UUID parser to validate. * secret_conf.h, secret_conf.c: Generate a UUID if none is provided. Storage UUID in raw format. * src/secret_driver.c: Adjust to deal with raw UUIDs. Save secrets in a filed with printable UUID, instead of base64 UUID. * src/virsh.c: Adjust for changed public API contract of virSecretGetUUIDString. * src/storage_Backend.c: DOn't undefine secret we just generated upon successful volume creation. Fix to handle raw UUIDs. Generate a non-clashing UUID * src/qemu_driver.c: Change to use lookupByUUID instead of lookupByUUIDString
* Secret manipulation API docs refresh & wire up python generatorMiloslav Trmač2009-09-011-4/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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'
* python: Raise exceptions if virDomain*Stats fail.v0.7.0Cole Robinson2009-07-261-1/+4
| | | | | The generator couldn't tell that the stats return values were pointers. Stick a white list in the function which tries to make this distinction.
* Add virInterface APIs to python code generatorDaniel P. Berrange2009-05-211-3/+42
|
* Fix crash after calling virConnectClosev0.6.3v0.6.2Daniel P. Berrange2009-04-011-0/+3
|
* Fix generation of networkCreateXML and storagePoolCreateXMLDaniel P. Berrange2009-04-011-0/+6
|
* Internal driver API for sVirt support (James Morris & Dan Walsh)Daniel P. Berrange2009-03-031-0/+2
|
* Fix building python bindings: Skip bindings for virSaveLastError andCole Robinson2009-02-161-0/+2
| | | | virFreeError
* Python binding for node device APIs (David Lively)Daniel P. Berrange2008-11-211-3/+23
|
* * python/Makefile.am python/generator.py python/libvir.cDaniel Veillard2008-10-311-4/+15
| | | | | | | | | | 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
* Massive patch adding event APIs by Ben GuthroDaniel Veillard2008-10-231-0/+3
| | | | | | | | | | | | | | | | | | | | | | * include/libvirt/libvirt.h include/libvirt/libvirt.h.in src/libvirt.c src/libvirt_sym.version: new libvirt event entry points, big patch provided by Ben Guthro * Makefile.am configure.in src/driver.h src/event.c src/event.h src/internal.h src/libvirt.c src/libvirt_sym.version src/lxc_driver.c src/openvz_driver.c src/qemu_conf.h src/qemu_driver.c src/remote_internal.c src/storage_backend_fs.c src/test.c qemud/event.c qemud/event.h qemud/mdns.c qemud/qemud.c qemud/qemud.h qemud/remote.c qemud/remote_dispatch_localvars.h qemud/remote_dispatch_proc_switch.h qemud/remote_dispatch_prototypes.h qemud/remote_protocol.c qemud/remote_protocol.h qemud/remote_protocol.x proxy/Makefile.am python/generator.py: Not much is left untouched by the patch adding the events support * docs/libvirt-api.xml docs/libvirt-refs.xml docs/html/libvirt-libvirt.html: regenerated the docs * examples/domain-events/events-c/Makefile.am examples/domain-events/events-c/event-test.c: a test example * AUTHORS: added Ben Guthro daniel
* Fix connection lookup in python storage instancesDaniel Veillard2008-08-121-1/+5
| | | | | | * python/generator.py: patch from Cole Robinson trying to fix problem of connection lookup when creating storage instances Daniel
* Skip python bindings for virDomainBlockPeek and virDomainMemoryPeekDaniel Veillard2008-07-251-0/+2
| | | | | | * python/generator.py: skip generation for virDomainBlockPeek and virDomainMemoryPeek as they break the build Daniel
* * python/generator.py python/libvir.c python/libvirt-python-api.xml:Daniel Veillard2008-06-101-2/+3
| | | | | Apply patch from Cole Robinson fixing UUIDString for python Daniel
* Don't free C object after destroy method in pythonDaniel P. Berrange2008-05-211-6/+1
|
* Fix potential infinite loop in python generatorv0.4.2Daniel Veillard2008-04-081-0/+3
| | | | | * python/generator.py: fix an infinite loop bug Daniel
* Added python binding for storage APIsDaniel P. Berrange2008-02-201-3/+88
|
* Remove all trailing blanks; turn on the rule to detect them.Jim Meyering2008-02-051-4/+4
| | | | | * Makefile.cfg (local-checks-to-skip): Remove sc_trailing_blank. * .x-sc_trailing_blank: New file, to exempt the few binary files.
* Given code like if (foo) free (foo); remove the useless "if (foo) " part.Jim Meyering2008-01-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Likewise, given if (foo != NULL) free (foo); remove the useless "if" test. * proxy/libvirt_proxy.c: Remove unnecessary "if" test before free. * python/generator.py: Likewise. * qemud/qemud.c: Likewise. * src/buf.c: Likewise. * src/conf.c: Likewise. * src/hash.c: Likewise. * src/iptables.c: Likewise. * src/libvirt.c: Likewise. * src/openvz_conf.c: Likewise. * src/qemu_conf.c: Likewise. * src/qemu_driver.c: Likewise. * src/remote_internal.c: Likewise. * src/test.c: Likewise. * src/virsh.c: Likewise. * src/virterror.c: Likewise. * src/xen_internal.c: Likewise. * src/xen_unified.c: Likewise. * src/xend_internal.c: Likewise. * src/xm_internal.c: Likewise. * src/xml.c: Likewise. * src/xmlrpc.c: Likewise. * src/xs_internal.c: Likewise. * tests/testutils.c: Likewise. * tests/xencapstest.c: Likewise. * tests/xmconfigtest.c: Likewise.
* Make python generator fail build on any missing APIsDaniel P. Berrange2008-01-211-17/+33
|
* Add missing vcpu/schedular APIs to python bindingDaniel P. Berrange2008-01-211-0/+6
|
* * python/generator.py python/libvir.c python/libvirt-python-api.xml:Daniel Veillard2007-12-071-0/+1
| | | | | add a python binding for virNodeGetCellsFreeMemory Daniel
* * python/generator.py python/libvir.c python/libvirt-python-api.xml:v0.3.3Daniel Veillard2007-09-301-0/+2
| | | | | provide bindings for block and interface statistics Daniel
* * libvirt.spec.in NEWS docs/* po/*: preparing release 0.3.1v0.3.2v0.3.1Daniel Veillard2007-07-241-4/+0
| | | | | | * src/libvirt.c python/generator.py: some cleanup and warnings from Richard W.M. Jones Daniel
* Mon Jun 25 16:55:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>Richard W.M. Jones2007-06-251-0/+4
| | | | | | | * include/libvirt/libvirt.h.in, src/libvirt.c, src/libvirt_sym.version, python/generator.py: Added virDomainGetConnect and virNetworkGetConnect to allow us to get the "hidden" connection associated with each domain or network.
* +Tue May 29 15:56:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>v0.2.3Richard W.M. Jones2007-05-291-0/+2
| | | | | | | | | | + + * 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. +
* Fixed exception reporting for domain/network operationsv0.2.2Daniel P. Berrange2007-04-161-16/+34
|
* * python/generator.py: Python bindings now throw exceptionsRichard W.M. Jones2007-03-281-9/+121
| | | | | in almost all cases where an error is encountered in the underlying libvirt code.
* * python/generator.py: patch from Tatsuro Enokura to fixv0.2.1Daniel Veillard2007-03-161-2/+5
| | | | | virNetworkDefine binding Daniel
* * python/generator.py: fix the python binding generation forDaniel Veillard2007-03-151-0/+4
| | | | | | | virNetworkLookup...() functions, which were clashing with equivalent virConnLookup...() equivalents, as reported by Tatsuro Enokura Daniel
* Added python bindings for networking APIsDaniel P. Berrange2007-03-091-1/+24
|
* Blacklist vshRunConsole from pythonv0.2.0Daniel P. Berrange2007-02-141-1/+2
|
* Added binding for virConnectListDefinedDomains apiv0.1.9v0.1.11v0.1.10Daniel P. Berrange2006-11-161-0/+1
|
* * python/generator.py: changed the generator to generate a referenceDaniel Veillard2006-11-091-0/+10
| | | | | | | from Domain class instances to the Connect they were issued from should fix rhbz#204490 * docs//*: rebuilt Daniel
* Propagate libvirt errors back with python exceptionsDaniel P. Berrange2006-11-071-2/+13
|
* Make python bindings threaded, by dropping/acquiring Python GIL where neededDaniel P. Berrange2006-10-241-2/+4
|
* * python/generator.py: fix the generator when handling long integersv0.1.4Daniel Veillard2006-08-041-2/+2
| | | | | | Dan Berrange reported problems due to this when using virDomainSetMemory bindings Daniel