1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2025-07-08 20:59:49 +03:00
Commit Graph

26 Commits

Author SHA1 Message Date
bedc937cce Don't hardcode interpreter path
This is particularly useful on operating systems that don't ship
Python as part of the base system (eg. FreeBSD) while still working
just as well as it did before on Linux.

Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
2017-11-30 08:48:36 +01:00
36430e115d Add details for shutdown event
In commit a8eba5036cb4b0e2ec827e9e6e019ce70e451377, libvirt added
support for two more details.  In python bindings it all worked fine
automagically except an example that was not updated.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1463188

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2017-06-20 16:31:14 +02:00
58c4c12ce6 event-test: add ability to run the asyncio event loop
The event test program '--loop' arg is modified to take the name
of an event loop impl to run. eg 'event-test.py --loop asyncio'

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-04-04 15:28:50 +01:00
1c6503b800 event-test: rename example event loop impl
Use the name 'Poll' instead of 'Pure' for the event loop demo,
since there's now a second pure python loop impl available.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-04-04 15:28:50 +01:00
4cb0508048 event-test: unregister callbacks & close conn on exit
In order to test cleanup code paths we must unregister all callbacks
and close the connection on shutdown. Since cleanup happens in the
background, we do a short sleep to allow the main loop to run its
cleanup too.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-04-04 15:28:50 +01:00
6c8d625676 event-test: add timeout to exit event loop
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-04-04 15:28:50 +01:00
1770fa45b4 event-test: free opaque data when removing callbacks
The pure python event loop impl has to call

  libvirt.virEventInvokeFreeCallback

to free the event opaque data from a clean stack context

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-04-04 15:28:50 +01:00
a927799334 event: Add handler for block threshold event
Unfortunately python doesn't generate those.
2017-03-29 16:59:39 +02:00
cc0adce95f examples: Update event-test.py
With recent changes there are new events known to libvirt.
Reflect those changes in our event-test.py example script.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2017-01-10 11:29:45 +01:00
0b050dd015 event-test: support node device update callback 2016-08-17 07:38:30 -04:00
8b2d5c0643 event-test: Add node device lifecycle event tests 2016-08-02 09:55:56 -04:00
a3a4425338 Fix crash in storage pool refresh callback
Fixes copy-paste typo introduced by commit cb84e36c.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1354271

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-07-23 20:30:05 +02:00
cb84e36cb3 Add support for storage pool refesh callback
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-06-24 21:49:09 +01:00
d42cb2b170 event-test: Add storage pool lifecycle event tests 2016-06-16 12:25:44 -04:00
1233645a28 event: Add support VIR_DOMAIN_EVENT_ID_DEVICE_REMOVAL_FAILED 2016-04-18 13:18:26 +02:00
3436387627 Add support for JOB_COMPLETED event
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-03-08 16:47:49 +01:00
3413cc44b2 Add support for MIGRATION_ITERATION event
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-01-18 15:52:01 +01:00
cd2d02ab0d Implement the DEVICE_ADDED event 2015-04-15 18:48:23 +02:00
39f19f0a2d fix examples
The dhcpleases example had an old usage of print function. The formating
of leases record was also wrong.

The event-test example had an old usage of exceptions.

It's mainly to make examples compatible with python3.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2014-12-01 17:34:31 +01:00
acc47bcb71 event: Add bindings for agent lifecycle event
Also add the example.
2014-11-24 17:53:12 +01:00
714aa155e8 implement new tunable event
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1147639

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2014-09-30 19:15:29 +02:00
87b0d97937 event-test: add missing events
Update the example to be able to trace all events.

* examples/event-test.py (main): Match full list of domain events.
(myDomainEventIOErrorReasonCallback)
(myDomainEventControlErrorCallback)
(myDomainEventBlockJobCallback, myDomainEventBlockJob2Callback)
(blockJobTypeToString, blockJobStatusToString): New functions.

Signed-off-by: Eric Blake <eblake@redhat.com>
2014-06-18 13:01:52 -06:00
44be62beee examples: demonstrate network events
Commit 6ea5be0 added network event callback support, so we might
as well demonstrate that it works by updating our example.

* examples/event-test.py: Add network event, fix typos.

Signed-off-by: Eric Blake <eblake@redhat.com>
2014-02-11 17:58:48 -07:00
b882ae9ecf examples: Ensure we write bytes to the self-pipe
Strings in python3 default to unicode, so when writing to
the self-pipe we must be sure to use bytes by calling the
encode() method.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-12-11 16:12:54 +00:00
3f4e32c6a1 examples: Invoke print("...") instead of print "..."
The 'print' method must be called as a function in python3,
ie with brackets.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-12-11 16:12:54 +00:00
34aa32ba8a Move python example programs into python/examples/ subdirectory
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-11-22 15:55:39 +00:00