1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2024-10-26 07:55:06 +03:00
libvirt-python/examples
Ariel Otilibili 0904b90289 example/domstart.py: Removed useless brackets for tuple unpacking
Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
2024-08-08 17:45:01 +02:00
..
guest-vcpus examples: Fix white space 2020-08-05 07:43:02 +00:00
consolecallback.py examples: replace logging.warn with logging.warning 2024-05-01 08:09:53 +00:00
dhcpleases.py examples: Fix white space 2020-08-05 07:43:02 +00:00
dominfo.py examples: Fix white space 2020-08-05 07:43:02 +00:00
domipaddrs.py examples: Fix white space 2020-08-05 07:43:02 +00:00
domrestore.py examples: Replace sys.exit() with exit() 2020-08-05 07:43:02 +00:00
domsave.py examples: Replace sys.exit() with exit() 2020-08-05 07:43:02 +00:00
domstart.py example/domstart.py: Removed useless brackets for tuple unpacking 2024-08-08 17:45:01 +02:00
esxlist.py examples: Fix white space 2020-08-05 07:43:02 +00:00
event-test.py Add binding for network metadata events 2023-09-21 11:58:47 +01:00
nodestats.py examples/nodestat: Show memory pinning information again 2024-06-11 17:00:23 +03:00
README examples: remove docs about non-existent XML files 2020-05-14 14:03:59 +01:00
sparsestream.py examples: Fix white space 2020-08-05 07:43:02 +00:00
topology.py examples: Fix white space 2020-08-05 07:43:02 +00:00

Some simple examples on how to use the Python API for libvirt

The examples are:

dominfo.py  - print information about a running domU based on the results of
              virDomainGetInfo and virDomainGetXMLDesc
domstart.py - create a domU from an XML description if the domU isn't
              running yet
domsave.py  - save all running domU's into a directory
domrestore.py - restore domU's from their saved files in a directory
esxlist.py  - list active domains of an VMware ESX host and print some info.
              also demonstrates how to use the libvirt.openAuth() method
dhcpleases.py - list dhcp leases for a given virtual network
domipaddrs.py - list IP addresses for guest domains
guest-vcpus - two helpers to make the guest agent event useful with agent based
              vCPU state modification
nodestats.py - print total memory and free memory for each host NUMA node and
               the memory strictly bound to certain host nodes for each running
               domain.

Some additional notes for the esxlist.py example:

You may see remote errors complaining about missing certificates:

  Cannot access CA certificate '/usr/local/etc/pki/CA/cacert.pem': No such file
  or directory

This is expected, libvirt tries to find network and storage drivers for ESX,
but those are not implemented yet (November 2009). While searching for this
drivers, libvirt may try to start a local libvirtd instance, but fails because
of the missing certificates. It'll warn about that:

  Failed to find the network: Is the daemon running?

This is also expected and can be ignored.