| 1 |
Some simple examples on how to use the Python API for libvirt |
| 2 |
|
| 3 |
The examples are: |
| 4 |
|
| 5 |
dominfo.py - print information about a running domU based on the results of |
| 6 |
virDomainGetInfo and virDomainGetXMLDesc |
| 7 |
domstart.py - create a domU from an XML description if the domU isn't |
| 8 |
running yet |
| 9 |
domsave.py - save all running domU's into a directory |
| 10 |
domrestore.py - restore domU's from their saved files in a directory |
| 11 |
esxlist.py - list active domains of an VMware ESX host and print some info. |
| 12 |
also demonstrates how to use the libvirt.openAuth() method |
| 13 |
dhcpleases.py - list dhcp leases for a given virtual network |
| 14 |
domipaddrs.py - list IP addresses for guest domains |
| 15 |
guest-vcpus - two helpers to make the guest agent event useful with agent based |
| 16 |
vCPU state modification |
| 17 |
nodestats.py - print total memory and free memory for each host NUMA node and |
| 18 |
the memory strictly bound to certain host nodes for each running |
| 19 |
domain. |
| 20 |
|
| 21 |
Some additional notes for the esxlist.py example: |
| 22 |
|
| 23 |
You may see remote errors complaining about missing certificates: |
| 24 |
|
| 25 |
Cannot access CA certificate '/usr/local/etc/pki/CA/cacert.pem': No such file |
| 26 |
or directory |
| 27 |
|
| 28 |
This is expected, libvirt tries to find network and storage drivers for ESX, |
| 29 |
but those are not implemented yet (November 2009). While searching for this |
| 30 |
drivers, libvirt may try to start a local libvirtd instance, but fails because |
| 31 |
of the missing certificates. It'll warn about that: |
| 32 |
|
| 33 |
Failed to find the network: Is the daemon running? |
| 34 |
|
| 35 |
This is also expected and can be ignored. |