summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* python: Fix bindings for virDomainSnapshotGet{Domain,Connect}v1.0.2-rc2v1.0.2CVE-2013-0170Jiri Denemark2013-01-242-1/+11
| | | | | | | | | | | | | | https://bugzilla.redhat.com/show_bug.cgi?id=895882 virDomainSnapshot.getDomain() and virDomainSnapshot.getConnect() wrappers around virDomainSnapshotGet{Domain,Connect} were not supposed to be ever implemented. The class should contain proper domain() and connect() accessors that fetch python objects stored internally within the class. While domain() was already provided, connect() was missing. This patch adds connect() method to virDomainSnapshot class and reimplements getDomain() and getConnect() methods as aliases to domain() and connect() for backward compatibility.
* Make python objects inherit from 'object' base classDaniel P. Berrange2013-01-241-1/+1
| | | | | | | | | | | | | As of python >= 2.2, it is recommended that all objects inherit from the 'object' base class. We already require python >= 2.3 for libvirt for thread macro support, so we should follow this best practice. See also http://stackoverflow.com/questions/4015417/python-class-inherits-object Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Introduce virTypedParamsClear public APIv1.0.2-rc1Jiri Denemark2013-01-182-39/+21
| | | | | The function is just a renamed public version of former virTypedParameterArrayClear.
* Add virTypedParams* APIsJiri Denemark2013-01-181-0/+19
| | | | | | | Working with virTypedParameters in clients written in C is ugly and requires all clients to duplicate the same code. This set of APIs makes this code for manipulating with virTypedParameters integral part of libvirt so that all clients may benefit from it.
* python: Avoid freeing uninitialized new_params pointerJiri Denemark2013-01-171-7/+7
|
* Fix build due to previous LXC patchDaniel P. Berrange2013-01-141-0/+1
| | | | | | Mark virDomainLxcEnterNamespace as skipped in python binding and remove reference to lxcDomainOpenNamespace which doesn't arrive until a later patch
* Introduce an LXC specific public API & libraryDaniel P. Berrange2013-01-144-6/+361
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch introduces support for LXC specific public APIs. In common with what was done for QEMU, this creates a libvirt_lxc.so library and libvirt/libvirt-lxc.h header file. The actual APIs are int virDomainLxcOpenNamespace(virDomainPtr domain, int **fdlist, unsigned int flags); int virDomainLxcEnterNamespace(virDomainPtr domain, unsigned int nfdlist, int *fdlist, unsigned int *noldfdlist, int **oldfdlist, unsigned int flags); which provide a way to use the setns() system call to move the calling process into the container's namespace. It is not practical to write in a generically applicable manner. The nearest that we could get to such an API would be an API which allows to pass a command + argv to be executed inside a container. Even if we had such a generic API, this LXC specific API is still useful, because it allows the caller to maintain the current process context, in particular any I/O streams they have open. NB the virDomainLxcEnterNamespace() API is special in that it runs client side, so does not involve the internal driver API. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* python: Adapt to virevent renameMichal Privoznik2012-12-281-1/+1
| | | | | | | | | | | | | | | | | | | With our recent renames under src/util/* we forgot to adapt python wrapper code generator. This results in some methods being not exposed: $ python examples/domain-events/events-python/event-test.py Using uri:qemu:///system Traceback (most recent call last): File "examples/domain-events/events-python/event-test.py", line 585, in <module> main() File "examples/domain-events/events-python/event-test.py", line 543, in main virEventLoopPureStart() File "examples/domain-events/events-python/event-test.py", line 416, in virEventLoopPureStart virEventLoopPureRegister() File "examples/domain-events/events-python/event-test.py", line 397, in virEventLoopPureRegister libvirt.virEventRegisterImpl(virEventAddHandleImpl, AttributeError: 'module' object has no attribute 'virEventRegisterImpl'
* Rename util.{c,h} to virutil.{c,h}Daniel P. Berrange2012-12-211-1/+1
|
* Rename memory.{c,h} to viralloc.{c,h}Daniel P. Berrange2012-12-212-2/+2
|
* Fix the indentionv1.0.1-rc2v1.0.1-rc1v1.0.1Osier Yang2012-12-041-1/+1
| | | | | Introduced by commit 1465876a, pushed under build-breaker && trivial rule.
* Bind connection close callback APIs to python bindingDaniel P. Berrange2012-12-043-2/+133
| | | | | | | | | Add code in the python binding to cope with the new APIs virConnectRegisterCloseCallback and virConnectUnregisterCloseCallback. Also demonstrate their use in the python domain events demo Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* python: Use virNodeGetCPUMap where possibleCVE-2012-3411Viktor Mihajlovski2012-11-151-35/+52
| | | | | | | | | Modified the places where virNodeGetInfo was used for the purpose of obtaining the maximum node CPU number. Transparently falling back to virNodeGetInfo in case of failure. Wrote a utility function getPyNodeCPUCount for that purpose. Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
* Remove spurious whitespace between function name & open bracketsDaniel P. Berrange2012-11-021-18/+18
| | | | | | | | The libvirt coding standard is to use 'function(...args...)' instead of 'function (...args...)'. A non-trivial number of places did not follow this rule and are fixed in this patch. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* maint: consistent whitespace after 'if'v1.0.0-rc3v1.0.0-rc2v1.0.0Eric Blake2012-10-251-27/+27
| | | | | | Noticed during the review of the previous patch. * python/libvirt-override.c: Use space between 'if ('.
* virNodeGetCPUMap: Add python bindingViktor Mihajlovski2012-10-252-0/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added a method getCPUMap to virConnect. It can be used as follows: import libvirt import sys import os conn = libvirt.openReadOnly(None) if conn == None: print 'Failed to open connection to the hypervisor' sys.exit(1) try: (cpus, cpumap, online) = conn.getCPUMap(0) except: print 'Failed to extract the node cpu map information' sys.exit(1) print 'CPUs total %d, online %d' % (cpus, online) print 'CPU map %s' % str(cpumap) del conn print "OK" sys.exit(0) Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com> Signed-off-by: Eric Blake <eblake@redhat.com>
* virNodeGetCPUMap: Define public API.v1.0.0-rc1Viktor Mihajlovski2012-10-231-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Adding a new API to obtain information about the host node's present, online and offline CPUs. int virNodeGetCPUMap(virConnectPtr conn, unsigned char **cpumap, unsigned int *online, unsigned int flags); The function will return the number of CPUs present on the host or -1 on failure; If cpumap is non-NULL virNodeGetCPUMap will allocate an array containing a bit map representation of the online CPUs. It's the callers responsibility to deallocate cpumap using free(). If online is non-NULL, the variable pointed to will contain the number of online host node CPUs. The variable flags has been added to support future extensions and must be set to 0. Extend the driver structure by nodeGetCPUMap entry in support of the new API virNodeGetCPUMap. Added implementation of virNodeGetCPUMap to libvirt.c Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com> Signed-off-by: Eric Blake <eblake@redhat.com>
* Add support for SUSPEND_DISK eventMartin Kletzander2012-10-152-0/+59
| | | | | | | | | This patch adds support for SUSPEND_DISK event; both lifecycle and separated. The support is added for QEMU, machines are changed to PMSUSPENDED, but as QEMU sends SHUTDOWN afterwards, the state changes to shut-off. This and much more needs to be done in order for libvirt to work with transient devices, wake-ups etc. This patch is not aiming for that functionality.
* Properly parse (unsigned) long longGuido Günther2012-10-131-2/+2
| | | | | This fixes problems on platforms where sizeof(long) != sizeof(long long) like ia32.
* python: keep consistent handling of Python integer conversionGuannan Ren2012-10-081-2/+6
| | | | | | | | | | | | | | | | | | | libvirt_ulonglongUnwrap requires the integer type of python obj. But libvirt_longlongUnwrap still could handle python obj of Pyfloat_type which causes the float value to be rounded up to an integer. For example >>> dom.setSchedulerParameters({'vcpu_quota': 0.88}) 0 libvirt_longlongUnwrap treats 0.88 as a valid value 0 However >>> dom.setSchedulerParameters({'cpu_shares': 1000.22}) libvirt_ulonglongUnwrap will throw out an error "TypeError: an integer is required" The patch make this consistent.
* python: cleanup vcpu related binding APIsGuannan Ren2012-10-081-42/+121
| | | | | | | | | | | | | | | | libvirt_virDomainGetVcpus: add error handling, return -1 instead of None libvirt_virDomainPinVcpu and libvirt_virDomainPinVcpuFlags: check the type of argument make use of libvirt_boolUnwrap Set bitmap according to these values which are contained in given argument of vcpu tuple and turn off these bit corresponding to missing vcpus in argument tuple The original way ignored the error info from PyTuple_GetItem if index is out of range. "IndexError: tuple index out of range" The error message will only be raised on next command in interactive mode.
* python: return error if PyObject obj is NULL for unwrapper helper functionsGuannan Ren2012-09-281-2/+41
| | | | | | | | | | The result is indeterminate for NULL argument to python functions as follows. It's better to return negative value in these situations. PyObject_IsTrue will segfault if the argument is NULL PyFloat_AsDouble(NULL) is -1.000000 PyLong_AsUnsignedLongLong(NULL) is 0.000000
* node_memory: Expose the APIs to Python bindingsv0.10.2-rc2v0.10.2-rc1v0.10.2Osier Yang2012-09-172-0/+138
| | | | | | * python/libvirt-override-api.xml: (Add document to describe the APIs). * python/libvirt-override.c: (Implement the API wrappers manually)
* node_memory: Define the APIs to get/set memory parametersOsier Yang2012-09-171-0/+2
| | | | | | | | * include/libvirt/libvirt.h.in: (Add macros for the param fields, declare the APIs). * src/driver.h: (New methods for the driver struct) * src/libvirt.c: (Implement the public APIs) * src/libvirt_public.syms: (Export the public symbols)
* list: Expose virConnectListAllSecrets to Python bindingOsier Yang2012-09-173-0/+66
| | | | | | | | | | | The implementation is done manually as the generator does not support wrapping lists of C pointers into Python objects. python/libvirt-override-api.xml: Document python/libvirt-override-virConnect.py: Implementation for listAllSecrets. python/libvirt-override.c: Implementation for the wrapper.
* list: Define new API virConnectListAllSecretsOsier Yang2012-09-171-0/+1
| | | | | | | | | | | | This is to list the secret objects. Supports to filter the secrets by its storage location, and whether it's private or not. include/libvirt/libvirt.h.in: Declare enum virConnectListAllSecretFlags and virConnectListAllSecrets. python/generator.py: Skip auto-generating src/driver.h: (virDrvConnectListAllSecrets) src/libvirt.c: Implement the public API src/libvirt_public.syms: Export the symbol to public
* list: Expose virConnectListAllNWFilters to Python bindingOsier Yang2012-09-173-0/+66
| | | | | | | | | | | | The implementation is done manually as the generator does not support wrapping lists of C pointers into Python objects. python/libvirt-override-api.xml: Document python/libvirt-override-virConnect.py: * Implementation for listAllNWFilters. python/libvirt-override.c: Implementation for the wrapper.
* list: Define new API virConnectListAllNWFiltersOsier Yang2012-09-171-0/+1
| | | | | | | | | | | This is to list the network filter objects. No flags are supported include/libvirt/libvirt.h.in: Declare enum virConnectListAllNWFilterFlags and virConnectListAllNWFilters. python/generator.py: Skip auto-generating src/driver.h: (virDrvConnectListAllNWFilters) src/libvirt.c: Implement the public API src/libvirt_public.syms: Export the symbol to public
* list: Expose virConnectListAllNodeDevices to Python bindingOsier Yang2012-09-173-0/+66
| | | | | | | | | | | | The implementation is done manually as the generator does not support wrapping lists of C pointers into Python objects. python/libvirt-override-api.xml: Document python/libvirt-override-virConnect.py: * Implementation for listAllNodeDevices. python/libvirt-override.c: Implementation for the wrapper.
* list: Define new API virConnectListAllNodeDevicesOsier Yang2012-09-171-0/+1
| | | | | | | | | | | | This is to list the node device objects, supports to filter the results by capability types. include/libvirt/libvirt.h.in: Declare enum virConnectListAllNodeDeviceFlags and virConnectListAllNodeDevices. python/generator.py: Skip auto-generating src/driver.h: (virDrvConnectListAllNodeDevices) src/libvirt.c: Implement the public API src/libvirt_public.syms: Export the symbol to public
* list: Expose virConnectListAllInterfaces to Python bindingCVE-2012-4423Osier Yang2012-09-123-0/+66
| | | | | | | | | | | | The implementation is done manually as the generator does not support wrapping lists of C pointers into Python objects. python/libvirt-override-api.xml: Document python/libvirt-override-virConnect.py: * New file, includes implementation of listAllInterfaces. python/libvirt-override.c: Implementation for the wrapper.
* list: Define new API virConnectListAllInterfacesOsier Yang2012-09-121-0/+1
| | | | | | | | | | | | This is to list the interface objects, supported filtering flags are: active|inactive. include/libvirt/libvirt.h.in: Declare enum virConnectListAllInterfaceFlags and virConnectListAllInterfaces. python/generator.py: Skip auto-generating src/driver.h: (virDrvConnectListAllInterfaces) src/libvirt.c: Implement the public API src/libvirt_public.syms: Export the symbol to public
* python: Initialize new_params in virDomainSetSchedulerParametersFederico Simoncelli2012-09-111-1/+1
| | | | | | | | The new_params variable must be initialized in case the virDomainGetSchedulerParameters call fails and we hit the cleanup section before actually allocating the new parameters. Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
* Check against python None type when filling in auth parametersDaniel P. Berrange2012-09-111-1/+2
| | | | | | | | When deciding whether to provide an auth function callback in openAuth(), credcb was checked against NULL, when it really needs to be checked against Py_None Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Print any exception that occurs in authentication callbackDaniel P. Berrange2012-09-111-1/+3
| | | | | | | | | If an exception occurs in the python callback for openAuth() the stack trace isn't seen by the apps, since this code is called from libvirt context. To aid diagnostics, print the error to stderr at least Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Fix crash passing an empty list to python openAuth() APIDaniel P. Berrange2012-09-111-0/+1
| | | | | | | | | If passing a 'credtype' parameter which was an empty list to the python openAuth() API, the 'credtype' field in the virConnectAuth struct would not be initialized. This lead to a crash when later trying to free that field. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* list: Expose virConnectListAllNetworks to Python bindingOsier Yang2012-09-113-0/+66
| | | | | | | | | | | The implementation is done manually as the generator does not support wrapping lists of C pointers into Python objects. python/libvirt-override-api.xml: Document python/libvirt-override-virConnect.py: Implement listAllNetworks. python/libvirt-override.c: Implementation for the wrapper.
* list: Define new API virConnectListAllNetworksOsier Yang2012-09-111-0/+1
| | | | | | | | | | | | This is to list the network objects, supported filtering flags are: active|inactive, persistent|transient, autostart|no-autostart. include/libvirt/libvirt.h.in: Declare enum virConnectListAllNetworkFlags and virConnectListAllNetworks. python/generator.py: Skip auto-generating src/driver.h: (virDrvConnectListAllNetworks) src/libvirt.c: Implement the public API src/libvirt_public.syms: Export the symbol to public
* list: Expose virStoragePoolListAllVolumes to Python bindingOsier Yang2012-09-103-1/+68
| | | | | | | | | | | | The implementation is done manually as the generator does not support wrapping lists of C pointers into Python objects. python/libvirt-override-api.xml: Document python/libvirt-override-virStoragePool.py: * New file, includes implementation of listAllVolumes. python/libvirt-override.c: Implementation for the wrapper.
* list: Define new API virStoragePoolListAllVolumesOsier Yang2012-09-101-0/+1
| | | | | | | | | | | | Simply returns the storage volume objects. No supported filter flags. include/libvirt/libvirt.h.in: Declare the API python/generator.py: Skip the function for generating. virStoragePool.py will be added in later patch. src/driver.h: virDrvStoragePoolListVolumesFlags src/libvirt.c: Implementation for the API. src/libvirt_public.syms: Export the symbol to public
* Fix PMSuspend and PMWakeup eventsJiri Denemark2012-09-071-2/+2
| | | | | | The unused reason parameter of PM{Suspend,Wakeup} event callbacks was completely ignored in lot of places and those events were not actually working at all.
* python: Expose virStorageListAllStoragePools to python bindingOsier Yang2012-09-063-0/+65
| | | | | | | | | The implementation is done manually as the generator does not support wrapping lists of C pointers into Python objects. python/libvirt-override-api.xml: Document python/libvirt-override-virConnect.py: Add listAllStoragePools python/libvirt-override.c: Implementation for the wrapper.
* list: Define new API virStorageListAllStoragePoolsOsier Yang2012-09-061-2/+3
| | | | | | | | | | | | | | | | | | | | This introduces a new API to list the storage pool objects, 4 groups of flags are provided to filter the returned pools: * Active or not * Autostarting or not * Persistent or not * And the pool type. include/libvirt/libvirt.h.in: New enum virConnectListAllStoragePoolFlags; Declare the API. python/generator.py: Skip the generating src/driver.h: (virDrvConnectListAllStoragePools) src/libvirt.c: Implementation for the API. src/libvirt_public.syms: Export the symbol.
* python: don't mask libvirt errorsEric Blake2012-08-311-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | A user reported this crash when using python bindings: File "/home/nox/workspace/NOX/src/NOX/hooks.py", line 134, in trigger hook.trigger(event) File "/home/nox/workspace/NOX/src/NOX/hooks.py", line 33, in trigger self.handlers[event]() File "/home/nox/workspace/NOX/hooks/volatility.py", line 81, in memory_dump for block in Memory(self.ctx): File "/home/see/workspace/NOX/src/NOX/lib/libtools.py", line 179, in next libvirt.VIR_MEMORY_PHYSICAL) File "/usr/lib/python2.7/dist-packages/libvirt.py", line 1759, in memoryPeek ret = libvirtmod.virDomainMemoryPeek(self._o, start, size, flags) SystemError: error return without exception set In the python bindings, returning NULL makes python think an exception was thrown, while returning the None object lets the wrappers know that a libvirt error exists. Reported by Nox DaFox, fix suggested by Dan Berrange. * python/libvirt-override.c (libvirt_virDomainBlockPeek) (libvirt_virDomainMemoryPeek): Return python's None object, so wrapper knows to check libvirt error.
* agent: add python module supportv0.10.1v0.10.0-rc2v0.10.0MATSUDA Daiki2012-08-232-0/+37
| | | | | | Add virDomainQemuAgentCommand() support function to python module. Signed-off-by: MATSUDA Daiki <matsudadik@intellilink.co.jp>
* agent: add virDrvDomainQemuAgentCommand prototype for drivers.MATSUDA Daiki2012-08-231-0/+1
| | | | | | | Add virDrvDomainQemuAgentCommand prototype for drivers. Add virDomainQemuAgentCommand() for virDrvDomainQemuAgentCommand. Signed-off-by: MATSUDA Daiki <matsudadik@intellilink.co.jp>
* Update the remote APIv0.10.0-rc1Marcelo Cerri2012-08-201-0/+1
| | | | | | | This patch updates libvirt's API to allow applications to inspect the full list of security labels of a domain. Signed-off-by: Marcelo Cerri <mhcerri@linux.vnet.ibm.com>
* python: Don't generate bodies for close callback functionsv0.10.0-rc0CVE-2012-3445Peter Krempa2012-07-301-0/+2
| | | | | | | Commit 6ed5a1b9bd6240b8f2736790e48dd1c284c2e0e1 adds close callback functions to the public API but doesn't add python implementation. This patch sets the function to be written manually (to fix the build), but doesn't implement them yet.
* Define public API for receiving guest memory balloon eventsDaniel P. Berrange2012-07-142-0/+59
| | | | | | | | | | | | | | | | | | | | | | | | When the guest changes its memory balloon applications may want to know what the new value is, without having to periodically poll on XML / domain info. Introduce a "balloon change" event to let apps see this * include/libvirt/libvirt.h.in: Define the virConnectDomainEventBalloonChangeCallback callback and VIR_DOMAIN_EVENT_ID_BALLOON_CHANGE constant * python/libvirt-override-virConnect.py, python/libvirt-override.c: Wire up helpers for new event * daemon/remote.c: Helper for serializing balloon event * examples/domain-events/events-c/event-test.c, examples/domain-events/events-python/event-test.py: Add example of balloon event usage * src/conf/domain_event.c, src/conf/domain_event.h: Handling of balloon events * src/remote/remote_driver.c: Add handler of balloon events * src/remote/remote_protocol.x: Define wire protocol for balloon events * src/remote_protocol-structs: Likewise. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* list: provide python bindings for snapshotsv0.9.13-rc2v0.9.13-rc1v0.9.13Eric Blake2012-06-195-2/+130
| | | | | | | | | | | | | | | | | This adds support for the new virDomainListAllSnapshots (a domain function) and virDomainSnapshotListAllChildren (a snapshot function) to the libvirt-python bindings. The implementation is done manually as the generator does not support wrapping lists of C pointers into python objects. * python/libvirt-override.c (libvirt_virDomainListAllSnapshots) (libvirt_virDomainSnapshotListAllChildren): New functions. * python/libvirt-override-api.xml: Document them. * python/libvirt-override-virDomain.py (listAllSnapshots): New file. * python/libvirt-override-virDomainSnapshot.py (listAllChildren): Likewise. * python/Makefile.am (CLASSES_EXTRA): Ship them.