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

23 Commits

Author SHA1 Message Date
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
51b841fa5b examples: small fix for nodestats.py example
Add nodestats.py in MANIFEST.in and add a
small description for nodestats.py in README

Signed-off-by: Luyao Huang <lhuang@redhat.com>
2015-08-26 18:02:44 -04:00
fa21f3d927 examples: Introduce nodestats example
So, this is an exercise to show libvirt capabilities. Firstly, for
each host NUMA nodes some statistics are printed out, i.e. total
memory and free memory. Then, for each running domain, that has memory
strictly bound to certain host nodes, a small statistics of how much
memory it takes is printed out too. For instance:

        # ./examples/nodestats.py
        NUMA stats
        NUMA nodes:     0       1       2       3
        MemTotal:       3950    3967    3937    3943
        MemFree:        66      56      42      41
        Domain 'fedora':
                Overall memory: 1536 MiB
        Domain 'fedora22':
                Overall memory: 2048 MiB
        Domain 'fedora21':
                Overall memory: 1024 MiB nodes 0-1
                Node 0: 1024 MiB nodes 0-1
        Domain 'gentoo':
                Overall memory: 4096 MiB nodes 0-3
                Node 0: 1024 MiB nodes 0
                Node 1: 1024 MiB nodes 1
                Node 2: 1024 MiB nodes 2
                Node 3: 1024 MiB nodes 3

We can see 4 host NUMA nodes, all of them having roughly 4GB of RAM.
Yeah, all of them has nearly all the memory consumed. Then, there are
four domains running. For instance, domain 'fedora' has 1.5GB memory
which is not pinned onto any specific host NUMA node. Domain 'gentoo' on
the other hand has 4GB memory and has 4 NUMA nodes which are pinned 1:1
to host nodes.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-07-17 11:42:44 +02:00
71c1cdb134 examples: Add example to make guest agent lifecycle event useful
This example allows to use the guest agent event and metadata to track
vCPU count set via the guest agent (agent-based onlining/offlining) and
keep it persistent accross domain restarts.

The daemon listens for the agent lifecycle event, and if it's received
it looks into doman's metadata to see whether a desired count was set
and issues the guest agent command.
2015-05-11 10:53:06 +02:00
cd2d02ab0d Implement the DEVICE_ADDED event 2015-04-15 18:48:23 +02:00
0be1f5e31a Expose virDomainInterfacesAddresses to python binding
examples/Makefile.am:
  * Add new file domipaddrs.py

examples/README:
  * Add documentation for the python example

libvirt-override-api.xml:
  * Add new symbol for virDomainInterfacesAddresses

libvirt-override.c:
  * Hand written python api

Example:
  $ python examples/domipaddrs.py qemu:///system f18
    Interface  MAC address          Protocol     Address
    vnet0      52:54:00:20:70:3d    ipv4         192.168.105.240/16

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-03-28 11:21:56 +01: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
bdb64c7641 Implement new virNetworkGetDHCPLeases API
This API returns a list of DHCP leases for all network interfaces
connected to the given virtual network or limited output just for one
interface if mac is specified.

Example Output:
[{'iface': 'virbr3', 'ipaddr': '192.168.150.181', 'hostname': 'ubuntu14',
    'expirytime': 1403737495L, 'prefix': 24, 'clientid': None,
    'mac': '52:54:00:e8:73:eb', 'iaid': None, 'type': 0},
 {'iface': 'virbr3', 'ipaddr': '2001:db8:ca2:2:1::bd', 'hostname': 'fedora20-test',
    'expirytime': 1403738587L, 'prefix': 64, 'clientid': '00:04:b1:d8:86:42:e1:6a:aa:cf:d5:86:94:23:6f:94:04:cd',
    'mac': '52:54:00:5b:40:98', 'iaid': '5980312', 'type': 1}]

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2014-06-27 10:39:19 +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
3f61b08d5b Remove obsolete Makefile.am
We are no longer using automake, so Makefile.am is obsolete

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-11-22 15:58:05 +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