summaryrefslogtreecommitdiffstats
path: root/generator.py
Commit message (Collapse)AuthorAgeFilesLines
...
* Support virDomain{Set, Get}BlockIoTune in the python APIv0.9.8-rc2v0.9.8-rc1Lei Li2011-11-301-3/+2
| | | | | | | | Python support for both setting and getting block I/O throttle. Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com> Signed-off-by: Eric Blake <eblake@redhat.com>
* Add new API virDomain{Set, Get}BlockIoTuneLei Li2011-11-291-0/+3
| | | | | | | | | This patch add new pulic API virDomainSetBlockIoTune and virDomainGetBlockIoTune. Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com> Signed-off-by: Eric Blake <eblake@redhat.com>
* snapshot: new virDomainSnapshotListChildrenNames APIEric Blake2011-10-101-0/+4
| | | | | | | | | | | | | | | | | | | | | | The previous API addition allowed traversal up the hierarchy; this one makes it easier to traverse down the hierarchy. In the python bindings, virDomainSnapshotNumChildren can be generated, but virDomainSnapshotListChildrenNames had to copy from the hand-written example of virDomainSnapshotListNames. * include/libvirt/libvirt.h.in (virDomainSnapshotNumChildren) (virDomainSnapshotListChildrenNames): New prototypes. (VIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS): New flag alias. * src/libvirt.c (virDomainSnapshotNumChildren) (virDomainSnapshotListChildrenNames): New functions. * src/libvirt_public.syms: Export them. * src/driver.h (virDrvDomainSnapshotNumChildren) (virDrvDomainSnapshotListChildrenNames): New callbacks. * python/generator.py (skip_impl, nameFixup): Update lists. * python/libvirt-override-api.xml: Likewise. * python/libvirt-override.c (libvirt_virDomainSnapshotListChildrenNames): New wrapper function.
* python: Fix bindings generated in VPATH buildv0.9.6v0.9.5-rc3v0.9.5Jiri Denemark2011-09-161-4/+4
|
* python: Fix libvirt.py generation to include virterror infoCole Robinson2011-09-151-2/+5
| | | | | Recent generator refactoring broke libvirt.py. With this patch, libvirt.py is generated exactly the same as before offending commit 9eba0d25.
* qemu_api: Update Py binding generator to generate files for QEMU APIsOsier Yang2011-09-141-69/+294
| | | | | | | | It will generate: libvirt-qemu.py libvirt-qemu.h libvirt-qemu.c libvirt-qemu-export.c
* latency: Expose the new API for Python bindingv0.9.5-rc1Osier Yang2011-09-061-0/+1
|
* Add public API for getting migration speedJim Fehlig2011-09-011-0/+1
| | | | | | | | | Includes impl of python binding since the generator was not able to cope. Note: Requires gendispatch.pl patch from Matthias Bolte https://www.redhat.com/archives/libvir-list/2011-August/msg01367.html
* python: add Python binding for virDomainGetVcpuPinInfo APITaku Izumi2011-07-251-0/+1
| | | | | | | This patch adds the Python bindings for virDomainGetVcpuPinInfo API. * python/generator.py: add it to generator skip list * python/libvirt-override-api.xml: provide an override description * python/libvirt-override.c: provide an override binding implementation
* python: add Python binding for virDomainPinVcpusFlags APITaku Izumi2011-07-251-0/+1
| | | | | | | This patch adds the Python bindings for virDomainPinVcpuFlags API. * python/generator.py: add it to the generator skip list * python/libvirt-override-api.xml: provide override description * python/libvirt-override.c: provide override bindings implementation
* Enable virDomainBlockPull in the python APIAdam Litke2011-07-221-1/+1
| | | | | | | | | virDomainGetBlockJobInfo requires manual override since it returns a custom type. * python/generator.py: reenable bindings for this entry point * python/libvirt-override-api.xml python/libvirt-override.c: manual overrides
* Add new API virDomainBlockPull* to headersAdam Litke2011-07-221-0/+2
| | | | | | | | | | | | | | | | 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 * docs/apibuild.py: Extend 'unsigned long' parameter exception to this * API
* Quieten build & ensure API build scripts exit with non-zero statusDaniel P. Berrange2011-07-191-6/+10
| | | | | | | | | | | | | | | | The current API build scripts will continue and exit with a zero status even if they find problems. This has been the cause of many build problems, or hidden build errors, in the past. Change the scripts so they always exit with a non-zero status for any problems they do not understand. Also turn off all debug output by default so they respect $(AM_V_GEN) * docs/Makefile.am: Use $(AM_V_GEN) for API/HTML scripts * docs/apibuild.py, python/generator.py: Exit with non-zero status if problems are found. Also be silent, not outputting any debug messages. * src/Makefile.am: Use $(AM_V_GEN) for ESX generator * python/Makefile.am: Tweak rule
* 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-241-2/+3
| | | | | | | | This reverts commit d74b86f5d6ecae3d18a391f90a918fcac75914db. Conflicts: python/generator.py
* 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: Add bindings for virEvent*Handle/TimeoutCole Robinson2011-06-211-9/+2
|
* 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-211-2/+2
| | | | | | | | 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-211-4/+5
| | | | | | | 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-201-4/+4
| | | | | v2: Don't generate virStreamFree
* python: generator: Don't print warning if nothing to warn aboutCole Robinson2011-06-201-3/+5
|
* Introduce virDomainGetControlInfo APIJiri Denemark2011-06-161-0/+1
| | | | | | 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.
* Enable virDomainBlockPull in the python API.Adam Litke2011-06-141-3/+2
| | | | | | | | | | | | | 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.
* 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: 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-161-0/+1
| | | | | 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.0CVE-2011-1486Jiri Denemark2011-03-141-1/+6
| | | | | | | | | | | | | | | | 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-101-0/+2
| | | | | | Add virDomainSetBlkioParameters virDomainGetBlkioParameters Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
* maint: Expand tabs in python codeJiri Denemark2011-02-181-289/+289
| | | | | Also cfg.mk is tweaked to force this for all future changes to *.py files.
* Use python discovered through env instead of hardcoding a pathv0.8.7v0.8.6Matthias Bolte2010-11-141-1/+1
| | | | | | | | 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.
* Adding structure and defines for virDomainSet/GetMemoryParametersNikunj A. Dadhania2010-10-121-0/+2
| | | | | | | | | | | | | | | | | | | | | 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.
* Fix up the python bindings for snapshotting.Chris Lalancette2010-05-201-3/+23
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* Implement python binding for virDomainGetBlockInfoDaniel P. Berrange2010-04-291-0/+1
| | | | | | | | | | | | | | | This binds the virDomainGetBlockInfo API to python's blockInfo method on the domain object >>> c = libvirt.openReadOnly('qemu:///session') >>> d = c.lookupByName('demo') >>> f = d.blockInfo("/dev/loop0", 0) >>> print f [1048576000L, 104857600L, 104857600L] * python/libvirt-override-api.xml: Define override signature * python/generator.py: Skip C impl generator for virDomainGetBlockInfo * python/libvirt-override.c: Manual impl of virDomainGetBlockInfo
* nwfilter: python bindings for nwfilterStefan Berger2010-04-291-4/+31
| | | | | I have primarily followed the pattern of the 'secret' driver to provide support for the missing python bindings for the network filter API.
* Fixup python binding for virDomainSnapshot APIsDaniel P. Berrange2010-04-201-1/+26
| | | | | | | | | | The generator code was totally wrong for the virDomainSnapshot APIs, not generating the wrapper class, and giving methods the wrong names * generator.py: Set metadata for virDomainSnapshot type & APIs * libvirt-override-api.xml, libvirt-override.c: Hand-code the virDomainSnapshotListNames glue layer
* Snapshot API framework.Chris Lalancette2010-04-051-0/+3
| | | | Signed-off-by: Chris Lalancette <clalance@redhat.com>
* Core driver implementation with ebtables supportStefan Berger2010-03-261-0/+2
| | | | | | | | | | | | | | This patch implements the core driver and provides - management functionality for managing the filter XMLs - compiling the internal filter representation into ebtables rules - applying ebtables rules on a network (tap,macvtap) interface - tearing down ebtables rules that were applied on behalf of an interface - updating of filters while VMs are running and causing the firewalls to be rebuilt - other bits and pieces Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
* Add domain events for graphics network clientsDaniel P. Berrange2010-03-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This introduces a new event type VIR_DOMAIN_EVENT_ID_GRAPHICS The same event can be emitted in 3 scenarios typedef enum { VIR_DOMAIN_EVENT_GRAPHICS_CONNECT = 0, VIR_DOMAIN_EVENT_GRAPHICS_INITIALIZE, VIR_DOMAIN_EVENT_GRAPHICS_DISCONNECT, } virDomainEventGraphicsPhase; Connect/disconnect are triggered at socket accept/close. The initialize phase is immediately after the protocol setup and authentication has completed. ie when the client is authorized and about to start interacting with the graphical desktop This event comes with *a lot* of potential information - IP address, port & address family of client - IP address, port & address family of server - Authentication scheme (arbitrary string) - Authenticated subject identity. A subject may have multiple identities with some authentication schemes. For example, vencrypt+sasl results in a x509dname and saslUsername identities. This results in a very complicated callback :-( typedef enum { VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_IPV4, VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_IPV6, } virDomainEventGraphicsAddressType; struct _virDomainEventGraphicsAddress { int family; const char *node; const char *service; }; typedef struct _virDomainEventGraphicsAddress virDomainEventGraphicsAddress; typedef virDomainEventGraphicsAddress *virDomainEventGraphicsAddressPtr; struct _virDomainEventGraphicsSubject { int nidentity; struct { const char *type; const char *name; } *identities; }; typedef struct _virDomainEventGraphicsSubject virDomainEventGraphicsSubject; typedef virDomainEventGraphicsSubject *virDomainEventGraphicsSubjectPtr; typedef void (*virConnectDomainEventGraphicsCallback)(virConnectPtr conn, virDomainPtr dom, int phase, virDomainEventGraphicsAddressPtr local, virDomainEventGraphicsAddressPtr remote, const char *authScheme, virDomainEventGraphicsSubjectPtr subject, void *opaque); The wire protocol is similarly complex struct remote_domain_event_graphics_address { int family; remote_nonnull_string node; remote_nonnull_string service; }; const REMOTE_DOMAIN_EVENT_GRAPHICS_IDENTITY_MAX = 20; struct remote_domain_event_graphics_identity { remote_nonnull_string type; remote_nonnull_string name; }; struct remote_domain_event_graphics_msg { remote_nonnull_domain dom; int phase; remote_domain_event_graphics_address local; remote_domain_event_graphics_address remote; remote_nonnull_string authScheme; remote_domain_event_graphics_identity subject<REMOTE_DOMAIN_EVENT_GRAPHICS_IDENTITY_MAX>; }; This is currently implemented in QEMU for the VNC graphics protocol, but designed to be usable with SPICE graphics in the future too. * daemon/remote.c: Dispatch graphics events to client * examples/domain-events/events-c/event-test.c: Watch for graphics events * include/libvirt/libvirt.h.in: Define new graphics event ID and callback signature * src/conf/domain_event.c, src/conf/domain_event.h, src/libvirt_private.syms: Extend API to handle graphics events * src/qemu/qemu_driver.c: Connect to the QEMU monitor event for VNC events and emit a libvirt graphics event * src/remote/remote_driver.c: Receive and dispatch graphics events to application * src/remote/remote_protocol.x: Wire protocol definition for graphics events * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h, src/qemu/qemu_monitor_json.c: Watch for VNC_CONNECTED, VNC_INITIALIZED & VNC_DISCONNETED events from QEMU monitor
* Add support for an explicit IO error eventDaniel P. Berrange2010-03-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This introduces a new event type VIR_DOMAIN_EVENT_ID_IO_ERROR This event includes the action that is about to be taken as a result of the watchdog triggering typedef enum { VIR_DOMAIN_EVENT_IO_ERROR_NONE = 0, VIR_DOMAIN_EVENT_IO_ERROR_PAUSE, VIR_DOMAIN_EVENT_IO_ERROR_REPORT, } virDomainEventIOErrorAction; In addition it has the source path of the disk that had the error and its unique device alias. It does not include the target device name (/dev/sda), since this would preclude triggering IO errors from other file backed devices (eg serial ports connected to a file) Thus there is a new callback definition for this event type typedef void (*virConnectDomainEventIOErrorCallback)(virConnectPtr conn, virDomainPtr dom, const char *srcPath, const char *devAlias, int action, void *opaque); This is currently wired up to the QEMU block IO error events * daemon/remote.c: Dispatch IO error events to client * examples/domain-events/events-c/event-test.c: Watch for IO error events * include/libvirt/libvirt.h.in: Define new IO error event ID and callback signature * src/conf/domain_event.c, src/conf/domain_event.h, src/libvirt_private.syms: Extend API to handle IO error events * src/qemu/qemu_driver.c: Connect to the QEMU monitor event for block IO errors and emit a libvirt IO error event * src/remote/remote_driver.c: Receive and dispatch IO error events to application * src/remote/remote_protocol.x: Wire protocol definition for IO error events * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h, src/qemu/qemu_monitor_json.c: Watch for BLOCK_IO_ERROR event from QEMU monitor
* Add support for an explicit watchdog eventDaniel P. Berrange2010-03-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This introduces a new event type VIR_DOMAIN_EVENT_ID_WATCHDOG This event includes the action that is about to be taken as a result of the watchdog triggering typedef enum { VIR_DOMAIN_EVENT_WATCHDOG_NONE = 0, VIR_DOMAIN_EVENT_WATCHDOG_PAUSE, VIR_DOMAIN_EVENT_WATCHDOG_RESET, VIR_DOMAIN_EVENT_WATCHDOG_POWEROFF, VIR_DOMAIN_EVENT_WATCHDOG_SHUTDOWN, VIR_DOMAIN_EVENT_WATCHDOG_DEBUG, } virDomainEventWatchdogAction; Thus there is a new callback definition for this event type typedef void (*virConnectDomainEventWatchdogCallback)(virConnectPtr conn, virDomainPtr dom, int action, void *opaque); * daemon/remote.c: Dispatch watchdog events to client * examples/domain-events/events-c/event-test.c: Watch for watchdog events * include/libvirt/libvirt.h.in: Define new watchdg event ID and callback signature * src/conf/domain_event.c, src/conf/domain_event.h, src/libvirt_private.syms: Extend API to handle watchdog events * src/qemu/qemu_driver.c: Connect to the QEMU monitor event for watchdogs and emit a libvirt watchdog event * src/remote/remote_driver.c: Receive and dispatch watchdog events to application * src/remote/remote_protocol.x: Wire protocol definition for watchdog events * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h, src/qemu/qemu_monitor_json.c: Watch for WATCHDOG event from QEMU monitor
* Add support for an explicit RTC change eventDaniel P. Berrange2010-03-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This introduces a new event type VIR_DOMAIN_EVENT_ID_RTC_CHANGE This event includes the new UTC offset measured in seconds. Thus there is a new callback definition for this event type typedef void (*virConnectDomainEventRTCChangeCallback)(virConnectPtr conn, virDomainPtr dom, long long utcoffset, void *opaque); If the guest XML configuration for the <clock> is set to offset='variable', then the XML will automatically be updated with the new UTC offset value. This ensures that during migration/save/restore the new offset is preserved. * daemon/remote.c: Dispatch RTC change events to client * examples/domain-events/events-c/event-test.c: Watch for RTC change events * include/libvirt/libvirt.h.in: Define new RTC change event ID and callback signature * src/conf/domain_event.c, src/conf/domain_event.h, src/libvirt_private.syms: Extend API to handle RTC change events * src/qemu/qemu_driver.c: Connect to the QEMU monitor event for RTC changes and emit a libvirt RTC change event * src/remote/remote_driver.c: Receive and dispatch RTC change events to application * src/remote/remote_protocol.x: Wire protocol definition for RTC change events * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h, src/qemu/qemu_monitor_json.c: Watch for RTC_CHANGE event from QEMU monitor
* Introduce a new public API for domain eventsDaniel P. Berrange2010-03-261-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current API for domain events has a number of problems - Only allows for domain lifecycle change events - Does not allow the same callback to be registered multiple times - Does not allow filtering of events to a specific domain This introduces a new more general purpose domain events API typedef enum { VIR_DOMAIN_EVENT_ID_LIFECYCLE = 0, /* virConnectDomainEventCallback */ ...more events later.. } int virConnectDomainEventRegisterAny(virConnectPtr conn, virDomainPtr dom, /* Optional, to filter */ int eventID, virConnectDomainEventGenericCallback cb, void *opaque, virFreeCallback freecb); int virConnectDomainEventDeregisterAny(virConnectPtr conn, int callbackID); Since different event types can received different data in the callback, the API is defined with a generic callback. Specific events will each have a custom signature for their callback. Thus when registering an event it is neccessary to cast the callback to the generic signature eg int myDomainEventCallback(virConnectPtr conn, virDomainPtr dom, int event, int detail, void *opaque) { ... } virConnectDomainEventRegisterAny(conn, NULL, VIR_DOMAIN_EVENT_ID_LIFECYCLE, VIR_DOMAIN_EVENT_CALLBACK(myDomainEventCallback) NULL, NULL); The VIR_DOMAIN_EVENT_CALLBACK() macro simply does a "bad" cast to the generic signature * include/libvirt/libvirt.h.in: Define new APIs for registering domain events * src/driver.h: Internal driver entry points for new events APIs * src/libvirt.c: Wire up public API to driver API for events APIs * src/libvirt_public.syms: Export new APIs * src/esx/esx_driver.c, src/lxc/lxc_driver.c, src/opennebula/one_driver.c, src/openvz/openvz_driver.c, src/phyp/phyp_driver.c, src/qemu/qemu_driver.c, src/remote/remote_driver.c, src/test/test_driver.c, src/uml/uml_driver.c, src/vbox/vbox_tmpl.c, src/xen/xen_driver.c, src/xenapi/xenapi_driver.c: Stub out new API entries