summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* python: Don't declare Py_ssize_t for Python 2.6v0.9.3-rc2v0.9.3-rc1Matthias Bolte2011-06-241-1/+1
| | | | | | | | Commit cd48c3f4e95597 added a Py_ssize_t typedef for Python < 2.7. But Py_ssize_t was added in Python 2.5. This makes the build fail for Python 2.6. Adjust the check to match Python < 2.5 to fix this.
* Revert "Add new API virDomainBlockPull* to headers"Eric Blake2011-06-241-3/+0
| | | | | | | | | This reverts commit 7d56a16d036d9aa7292e10e884c129742036f8a7. Conflicts: python/generator.py src/libvirt_public.syms
* Revert "Enable virDomainBlockPull in the python API."Eric Blake2011-06-243-69/+3
| | | | | | | | This reverts commit d74b86f5d6ecae3d18a391f90a918fcac75914db. Conflicts: python/generator.py
* Revert "Asynchronous event for BlockPull completion"Eric Blake2011-06-242-60/+0
| | | | | | | | | | This reverts commit 12cd77a0c58a80179182f7d09e8e73f9f66b4677. Conflicts: python/libvirt-override-virConnect.py python/libvirt-override.c src/remote/remote_protocol.x
* build: avoid python 2.4 build failureEric Blake2011-06-241-1/+6
| | | | | | | | I'm not sure when Py_ssize_t was introduced; but Fedora 14 Python 2.7 has it, while RHEL 5 Python 2.4 lacks it. It should be easy enough to adjust if someone runs into problems. * python/typewrappers.h (Py_ssize_t): Define for older python.
* build: avoid python 2.4 build failureEric Blake2011-06-231-2/+2
| | | | | | | | | | | | | On RHEL 5, I got: /usr/bin/python ./generator.py /usr/bin/python File "./generator.py", line 427 "virStreamFree", # Needed in custom virStream __del__, but free shouldn't ^ SyntaxError: invalid syntax * python/generator.py (function_skip_python_impl): Use same syntax as other skip lists.
* python: Generate virStreamFree but don't expose in bindingsCole Robinson2011-06-231-1/+10
| | | | | | Turns out I was right in removing this the first time :) This is needed in our custom __del__ function, but the C code wasn't being generated. Add new infrastructure to do what we want
* python: Mark event callback wrappers as privateCole Robinson2011-06-214-73/+59
| | | | | | | | These functions aren't intended to be called directly by users, so mark them as private. While we're at it, remove unneeded exception handling, and break some long lines.
* python: events: Fix C->Python handle callback prototypeCole Robinson2011-06-211-2/+24
| | | | | | | | | | | | | | | If registering our own event loop implementation written in python, any handles or timeouts callbacks registered by libvirt C code must be wrapped in a python function. There is some argument trickery that makes this all work, by wrapping the user passed opaque value in a tuple, along with the callback function. Problem is, the current setup requires the user's event loop to know about this trickery, rather than just treating the opaque value as truly opaque. Fix this in a backwards compatible manner, and adjust the example python event loop to do things the proper way.
* python: Add bindings for virEvent*Handle/TimeoutCole Robinson2011-06-213-36/+221
|
* Promote virEvent*Handle/Timeout to public APICole Robinson2011-06-211-0/+8
| | | | | | | | | | Since we virEventRegisterDefaultImpl is now a public API, callers need a way to invoke the default registered Handle and Timeout functions. We already have general functions for these internally, so promote them to the public API. v2: Actually add APIs to libvirt.h
* python: Implement virStreamSend/RecvAll helpersCole Robinson2011-06-212-2/+66
| | | | | | | | Pure python implementation. The handler callbacks have been altered a bit compared to the C API: RecvAll doesn't pass length of the data read since that can be trivially obtained from python string objects, and SendAll requires the handler to return the string data to send rather than store the data in a string pointer.
* python: Implement virStreamSend/RecvCole Robinson2011-06-215-4/+117
| | | | | | | The return values for the python version are different that the C version of virStreamSend: on success we return a string, an error raises an exception, and if the stream would block we return int(-2). We need to do this since strings aren't passed by reference in python.
* python: Implement bindings for virStreamEventAddCallbackCole Robinson2011-06-204-14/+100
| | | | | v2: Don't generate virStreamFree
* python: generator: Don't print warning if nothing to warn aboutCole Robinson2011-06-201-3/+5
|
* python: libvirt-override: use simpler debugCole Robinson2011-06-201-104/+57
| | | | | | | | In a couple instances we have to mark a debug variable as ATTRIBUTE_UNUSED to avoid warnings. v2: Use #if 0 to comment out debug define
* Introduce virDomainGetControlInfo APIJiri Denemark2011-06-163-0/+34
| | | | | | The API can be used to query current state of an interface to VMM used to control a domain. In QEMU world this translates into monitor connection.
* Asynchronous event for BlockPull completionAdam Litke2011-06-142-0/+63
| | | | | | | | | | | | | | | | | | | | | When an operation started by virDomainBlockPullAll completes (either with success or with failure), raise an event to indicate the final status. This allows an API user to avoid polling on virDomainBlockPullInfo if they would prefer to use the event mechanism. * daemon/remote.c: Dispatch events to client * include/libvirt/libvirt.h.in: Define event ID and callback signature * src/conf/domain_event.c, src/conf/domain_event.h, src/libvirt_private.syms: Extend API to handle the new event * src/qemu/qemu_driver.c: Connect to the QEMU monitor event for block_stream completion and emit a libvirt block pull event * src/remote/remote_driver.c: Receive and dispatch events to application * src/remote/remote_protocol.x: Wire protocol definition for the event * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h, src/qemu/qemu_monitor_json.c: Watch for BLOCK_STREAM_COMPLETED event from QEMU monitor Signed-off-by: Adam Litke <agl@us.ibm.com>
* Enable virDomainBlockPull in the python API.Adam Litke2011-06-143-3/+69
| | | | | | | | | | | | | virDomainBlockPullAll and virDomainBlockPullAbort are handled automatically. virDomainBlockPull and virDomainBlockPullInfo require manual overrides since they return a custom type. * python/generator.py: reenable bindings for this entry point * python/libvirt-override-api.xml python/libvirt-override.c: manual overrides Signed-off-by: Adam Litke <agl@us.ibm.com> Acked-by: Daniel P. Berrange <berrange@redhat.com>
* Add new API virDomainBlockPull* to headersAdam Litke2011-06-141-0/+3
| | | | | | | | | | | | | | Set up the types for the block pull functions and insert them into the virDriver structure definition. Symbols are exported in this patch to prevent documentation compile failures. * include/libvirt/libvirt.h.in: new API * src/driver.h: add the new entry to the driver structure * python/generator.py: fix compiler errors, the actual python bindings are implemented later * src/libvirt_public.syms: export symbols Signed-off-by: Adam Litke <agl@us.ibm.com>
* virNodeGetMemoryStats: Expose new APIMinoru Usui2011-06-141-0/+1
| | | | Signed-off-by: Minoru Usui <usui@mxm.nes.nec.co.jp>
* virNodeGetCPUStats: Expose new APIMinoru Usui2011-06-141-0/+1
| | | | Signed-off-by: Minoru Usui <usui@mxm.nes.nec.co.jp>
* send-key: Defining the public APILai Jiangshan2011-06-141-0/+1
| | | | | | | | | | Add public virDomainSendKey() and enum libvirt_keycode_set for the @codeset. Python version of virDomainSendKey() has not been implemented yet, it will be done soon. Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
* Deprecate several CURRENT/LIVE/CONFIG enumsHu Tao2011-06-131-0/+6
| | | | | | | | | | | | | | | | | This patch deprecates following enums: VIR_DOMAIN_MEM_CURRENT VIR_DOMAIN_MEM_LIVE VIR_DOMAIN_MEM_CONFIG VIR_DOMAIN_VCPU_LIVE VIR_DOMAIN_VCPU_CONFIG VIR_DOMAIN_DEVICE_MODIFY_CURRENT VIR_DOMAIN_DEVICE_MODIFY_LIVE VIR_DOMAIN_DEVICE_MODIFY_CONFIG And modify internal codes to use virDomainModificationImpact.
* python: avoid unlikely sign extension bugEric Blake2011-06-081-1/+1
| | | | | | | | | | | | | | | | | Detected by Coverity. cpumap was allocated with a value of (unsigned short)*(int), which is an int computation, and then promotes to size_t. On a 64-bit platform, this fails if bit 32 of the product is set (because of sign extension giving a HUGE value to malloc), even though a naive programmer would assume that since the first value is unsigned, the product is also unsigned and at most 4GB would be allocated. Won't bite in practice (the product should never be that large), but worth using the right types to begin with, so that we are now computing (unsigned short)*(size_t). * python/libvirt-override.c (libvirt_virDomainGetVcpus): Use correct type.
* Introduce a new event emitted when a virtualization failure occursv0.9.2CVE-2011-2178Daniel P. Berrange2011-05-291-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This introduces a new domain VIR_DOMAIN_EVENT_ID_CONTROL_ERROR Which uses the existing generic callback typedef void (*virConnectDomainEventGenericCallback)(virConnectPtr conn, virDomainPtr dom, void *opaque); This event is intended to be emitted when there is a failure in some part of the domain virtualization system. Whether the domain continues to run/exist after the failure is an implementation detail specific to the hypervisor. The idea is that with some types of failure, hypervisors may prefer to leave the domain running in a "degraded" mode of operation. For example, if something goes wrong with the QEMU monitor, it is possible to leave the guest OS running quite happily. The mgmt app will simply loose the ability todo various tasks. The mgmt app can then choose how/when to deal with the failure that occured. * daemon/remote.c: Dispatch of new event * examples/domain-events/events-c/event-test.c: Demo catch of event * include/libvirt/libvirt.h.in: Define event ID and callback * src/conf/domain_event.c, src/conf/domain_event.h: Internal event handling * src/remote/remote_driver.c: Receipt of new event from daemon * src/remote/remote_protocol.x: Wire protocol for new event * src/remote_protocol-structs: add new event for checks
* sched: introduce virDomainGetSchedulerParametersFlagsEric Blake2011-05-291-0/+1
| | | | | | | | | | | | | | | | | If we can choose live or config when setting, then we need to be able to choose which one we are querying. Also, make the documentation clear that set must use a non-empty subset (some of the hypervisors fail if params is NULL). * include/libvirt/libvirt.h.in (virDomainGetSchedulerParametersFlags): New prototype. * src/libvirt.c (virDomainGetSchedulerParametersFlags): Implement it. * src/libvirt_public.syms: Export it. * python/generator.py (skip_impl): Don't auto-generate. * src/driver.h (virDrvDomainGetSchedulerParametersFlags): New callback.
* libvirt.h: avoid regression, and document preferred nameEric Blake2011-05-291-14/+14
| | | | | | | | | | | | | | | | | | Commit 824dcaff was a regression (thankfully unreleased) for any client code that used 'struct _virSchedParameter' directly rather than the preferred virSchedParameter typedef. Adding a #define avoids even that API change, while rearranging the file makes it clear what the old vs. new API is. * include/libvirt/libvirt.h.in: Rearrange older names to the bottom and improve documentation on preferred names. (virDomainGetSchedulerParameters, virDomainSetSchedulerParameters) (virDomainSetSchedulerParametersFlags) (virDomainSetBlkioParameters, virDomainGetBlkioParameters) (virDomainSetMemoryParameters, virDomainGetMemoryParameters): Use newer type names. * python/libvirt-override.c: Adjust code generation to cope. Suggested by Daniel P. Berrange.
* python: Don't free must-not-free variablesMichal Privoznik2011-05-241-8/+3
| | | | | | py_str() function call PyString_AsString(). As written in documentation, the caller must not free the returned value, because it points to some internal structures.
* python: Fix typo in bindingsMichal Privoznik2011-05-231-1/+1
| | | | This typo caused a bug in which we wanted to free() invalid pointer.
* libvirt.h: consolidate typed parameter handlingEric Blake2011-05-181-0/+12
| | | | | | | | | | | | | | | | | | | | | | The new type is identical to the three old types that it replaces, and by creating a common type, this allows future patches to share common code that manipulates typed parameters. This change is backwards-compatible in API (recompilation works without any edits) and ABI (an older client that has not been recompiled uses the same layout) for code using only public names; only code using private names (those beginning with _) will have to adapt. * include/libvirt/libvirt.h.in (virTypedParameterType) (VIR_TYPED_PARAM_FIELD_LENGTH, _virTypedParameter): New enum, macro, and type. (virSchedParameter, virBlkioParameter, virMemoryParameter): Rewrite in terms of a common type, while keeping all old public names for backwards compatibility. (struct _virSchedParameter, struct _virBlkioParameter) (struct _virMemoryParameter): Delete - these are private names. * python/generator.py (enum): Cope with the refactoring.
* introduce virDomainSetSchedulerParametersFlagsHu Tao2011-05-171-0/+1
| | | | | This new function allows aditional flags to be passed into from the virsh command line.
* virDomainGetState public APIJiri Denemark2011-05-163-0/+37
| | | | | This API is supposed to replace virDomainGetInfo when the only purpose of calling it is getting current domain status.
* python: Use hardcoded python path in libvirt.pyv0.9.1v0.9.0libvirt-0.9.1-1.el6CVE-2011-1486Jiri Denemark2011-03-143-7/+7
| | | | | | | | | | | | | | | | This partially reverts (and fixes that part in a different way) commit e4384459c93e3e786aa483c7f077d1d22148f689, which replaced ``/usr/bin/python'' with ``/usr/bin/env python'' in all examples or scripts used during build to generate other files. However, python bindings module is compiled and linked against a specific python discovered or explicitly provided in configure phase. Thus libvirt.py, which is generated and installed into the system, should use the same python binary for which the module has been built. The hunk in Makefile.am replaces $(srcdir) with $(PYTHON), which might seem wrong but it is not. generator.py didn't use any of its command line arguments so passing $(srcdir) to it was redundant.
* libvirt: add virDomain{Get,Set}BlkioParametersCVE-2011-1146Gui Jianfeng2011-03-103-1/+34
| | | | | | Add virDomainSetBlkioParameters virDomainGetBlkioParameters Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
* maint: fix grammar in error messageEric Blake2011-02-211-2/+2
| | | | * python/tests/create.py: Use correct wording.
* maint: Expand tabs in python codeJiri Denemark2011-02-182-293/+293
| | | | | Also cfg.mk is tweaked to force this for all future changes to *.py files.
* python: Use PyCapsule API if availablev0.8.8Cole Robinson2011-01-101-39/+50
| | | | | | | | | | On Fedore 14, virt-manager spews a bunch of warnings to the console: /usr/lib64/python2.7/site-packages/libvirt.py:1781: PendingDeprecationWarning: The CObject type is marked Pending Deprecation in Python 2.7. Please use capsule objects instead. Have libvirt use the capsule API if available. I've verified this compiles fine on older python (2.6 in RHEL6 which doesn't have capsules), and virt-manager seems to function fine.
* Use python discovered through env instead of hardcoding a pathv0.8.7v0.8.6libvirt-0.8.7-9.el6libvirt-0.8.7-8.el6libvirt-0.8.7-7.el6libvirt-0.8.7-6.el6libvirt-0.8.7-5.el6libvirt-0.8.7-11.el6libvirt-0.8.7-10.el6Matthias Bolte2010-11-142-1/+6
| | | | | | | | This is more flexible regarding the location of the python binary but doesn't allow to pass the -u flag. The -i flag can be passed from inside the script using the PYTHONINSPECT env variable. This fixes a problem with the esx_vi_generator.py on FreeBSD.
* Fix several minor problems introduced by the memtune seriesv0.8.5Matthias Bolte2010-10-121-2/+4
| | | | | | | | | | | | | | Add proper documentation to the new VIR_DOMAIN_MEMORY_* macros in libvirt.h.in to placate apibuild.py. Mark args as unused in for libvirt_virDomain{Get,Set}MemoryParameters in the Python bindings and add both to the libvirtMethods array. Update remote_protocol-structs to placate make syntax-check. Undo unintended modifications in vboxDomainGetInfo. Update the function table of the VirtualBox and XenAPI drivers.
* Adding structure and defines for virDomainSet/GetMemoryParametersNikunj A. Dadhania2010-10-123-0/+28
| | | | | | | | | | | | | | | | | | | | | This patch adds a structure virMemoryParameter, it contains the name of the parameter and the type of the parameter along with a union. dv: + rename enums to VIR_DOMAIN_MEMORY_PARAM_* + remove some extraneous tabs v4: + Add unsigned int flags to the public api for future extensions v3: + Protoype for virDomainGetMemoryParameters and dummy python binding. v2: + Includes dummy python bindings for the library to build cleanly. + Define string constants like "hard_limit", etc. + re-order this patch.
* python: drop unnecessary conn assignmentDan Kenigsberg2010-09-271-9/+0
| | | | | | Since 554d82a200289938d5639a782a9f12e3e2e968f0, conn is unused. Let's drop it - but keep the signature of the constructor for backward compatibility.
* Fix SEGV on exit after domainEventDeregister()v0.8.4v0.8.3Philipp Hahn2010-07-231-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When the last callback is removed using domainEventDeregister(), the events dispatcher is deregistered from the C-library, but domainEventsCallbacks is still an empty list. On shutdown __del__() deregisters the dispatacher again, which SEGVs # You need the event-loop implementation from the Python examples; # give the file a name which is importable by Python. ln examples/domain-events/events-python/event-test.py eloop.py python -c 'from eloop import * import sys def dump(*args): print " ".join(map(str, args)) virEventLoopPureStart() c = libvirt.open("xen:///") c.domainEventRegister(dump, None) c.domainEventDeregister(dump) sys.exit(0)' domainEventDeregister() needs to delete domainEventCallbacks so subsequent calls to __del__() and domainEventRegister() choose the right code paths. Setting it to None is not enough, since calling domainEventRegiser() again would trigger an TypeError. Signed-off-by: Philipp Hahn <hahn@univention.de>
* python: Fix IOErrorReasonCallback bindingsCole Robinson2010-07-141-1/+1
| | | | | A copy and paste error was causing us to dispatch the incorrect routine. Spotted by Dan Kenigsberg.
* Ensure we return the callback ID in python events bindingDaniel P. Berrange2010-07-121-0/+1
| | | | | | | | | A missing return statement in the python binding meant that the callers could not get the callback ID, and thus not be able to unregister event callbacks * python/libvirt-override-virConnect.py: Add missing return statement
* Add missing parameter in python Disk IO error callbackv0.8.2libvirt-0.8.2-9.el5libvirt-0.8.2-8.el5libvirt-0.8.2-7.el5libvirt-0.8.2-6.el5libvirt-0.8.2-4.el5libvirt-0.8.2-3.el5libvirt-0.8.2-29.el5_9.1libvirt-0.8.2-29.el5libvirt-0.8.2-28.el5libvirt-0.8.2-27.el5libvirt-0.8.2-26.el5libvirt-0.8.2-25.el5libvirt-0.8.2-24.el5libvirt-0.8.2-23.el5libvirt-0.8.2-22.el5libvirt-0.8.2-21.el5libvirt-0.8.2-20.el5libvirt-0.8.2-2.el5libvirt-0.8.2-19.el5libvirt-0.8.2-18.el5libvirt-0.8.2-17.el5libvirt-0.8.2-16.el5libvirt-0.8.2-15.el5_6.5libvirt-0.8.2-15.el5_6.4libvirt-0.8.2-15.el5_6.3libvirt-0.8.2-15.el5_6.1libvirt-0.8.2-15.el5libvirt-0.8.2-14.el5libvirt-0.8.2-13.el5libvirt-0.8.2-12.el5libvirt-0.8.2-11.el5libvirt-0.8.2-10.el5libvirt-0.8.2-1.el5git-init-libvirtRHEL-5.6Daniel P. Berrange2010-06-251-1/+1
| | | | | | | | The IO error callback was forgetting to pass the action parameter, causing a stack trace when IO errors arrive * python/libvirt-override-virConnect.py: Add missing action parameter in IO error callback
* Fix description of virStorageVolGetInfo()Philipp Hahn2010-06-181-1/+1
| | | | | | | | Probably a copy-paste-bug in python/libvirt-override-api.xml: virStorageVolGetInfo() extracts information about a "storage volume", not the "storage pool" as virStoragePoolGetInfo() does. Signed-off-by: Philipp Hahn <hahn@univention.de>
* maint: simplify some ignore filesEric Blake2010-06-151-2/+0
| | | | | | | | | | | | | | * .hgignore: Delete, no longer used. * examples/python/.gitignore: Delete, covered globally. * include/.gitignore: Likewise. * python/tests/.gitignore: Likewise. * docs/schemas/.gitignore: Likewise. * tests/xml2sexprdata/.gitignore: Likewise. * tests/sexpr2xmldata/.gitignore: Likewise. * tests/confdata/.gitignore: Likewise. * tests/xencapsdata/.gitignore: Likewise. * tests/xmconfigdata/.gitignore: Likewise. * tests/xml2sexprdata/.gitignore: Likewise.
* Fix up the python bindings for snapshotting.Chris Lalancette2010-05-203-3/+53
| | | | | | | | | | | | | | | | | | | | | | | | This involved a few fixes. To start with, an virDomainSnapshot object is really tied to a domain, not a connection, so we have to generate a slightly different object so that we can get at self._dom for the object. Next, we had to "dummy" up an override piece of XML with a bogus argument that the function doesn't actually take. That's so that the generator places virDomainRevertToSnapshot underneath the correct class (namely, the virDomain class). Finally, we had to hand-implement the virDomainRevertToSnapshot implementation, ignoring the bogus pointer we are being passed. With all of this in place, I was able to successfully take a snapshot and revert to it using only the Python bindings. Signed-off-by: Chris Lalancette <clalance@redhat.com>
* python: don't ignore virInitialize failure in module initializationJim Meyering2010-05-181-1/+2
| | | | | * python/libvirt-override.c (initlibvirtmod): Upon virInitialize failure, skip the Py_InitModule call.