Sys::Virt - Represent and manage a libvirt hypervisor connection
my $vmm = Sys::Virt->new(address => $addr); my @domains = $vmm->list_domains(); foreach my $dom (@domains) { print "Domain ", $dom->get_id, " ", $dom->get_name, "\n"; }
The Sys::Virt module provides a Perl XS binding to the libvirt virtual machine management APIs. This allows machines running within arbitrary virtualization containers to be managed with a consistent API.
Any operations in the Sys::Virt API which have failure scenarios will result in an instance of the Sys::Virt::Error module being thrown. To catch these errors, simply wrap the method in an eval block. For details of the information contained in the error objects, consult the Sys::Virt::Error manual page.
Attach to the virtual machine monitor with the address of address. The address parameter may be omitted, in which case the default connection made will be to the local Xen hypervisor. In the future it wil be possible to specify explicit addresses for other types of hypervisor connection. If the optional readonly parameter is supplied, then an unprivileged connection to the VMM will be attempted. If it is not supplied, then it defaults to making a fully privileged connection to the VMM. THis in turn requires that the calling application be running as root.
address
readonly
Create a new domain based on the XML description passed into the $xml parameter. The returned object is an instance of the Sys::Virt::Domain class. This method is not available with unprivileged connections to the VMM.
$xml
Defines, but does not start, a new domain based on the XML description passed into the $xml parameter. The returned object is an instance of the Sys::Virt::Domain class. This method is not available with unprivileged connections to the VMM. The define can be later started by calling the create method on the returned Sys::Virt::Domain object.
create
Sys::Virt::Domain
Return a list of all domains currently known to the VMM. The elements in the returned list are instances of the Sys::Virt::Domain class.
Return the domain with a name of $name. The returned object is an instance of the Sys::Virt::Domain class.
$name
Return the domain with a local id of $id. The returned object is an instance of the Sys::Virt::Domain class.
$id
Return the domain with a globally unique id of $uuid. The returned object is an instance of the Sys::Virt::Domain class.
$uuid
Recreate a domain from the saved state file given in the $savefile parameter.
$savefile
Return the type of virtualization backend accessed by this VMM object. Curently the only supported type is Xen.
Xen
Return the complete version number as a string encoded in the formula (major * 1000000) + (minor * 1000) + micro.
(major * 1000000) + (minor * 1000) + micro
Return the major version number of the libvirt library
Return the minor version number of the libvirt library
Return the micro version number of the libvirt library
Returns a hash reference summarising the capabilities of the host node. The elements of the hash ar
The amount of physical memory in the host
The model of the CPU, eg x86_64
The total number of logical CPUs
The peak MHZ of the CPU
The number of NUMA cells
The number of CPU sockets
The number of cores per socket
The number of threads per core
Hopefully none, but the XS code needs to be audited to ensure it is not leaking memory
Daniel P. Berrange <berrange@redhat.com>
Copyright (C) 2006 Red Hat
Sys::Virt is distributed under the terms of the GPLv2 or later
Sys::Virt::Domain, Sys::Virt::Error, http://libvirt.org
http://libvirt.org
To install Sys::Virt, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Sys::Virt
CPAN shell
perl -MCPAN -e shell install Sys::Virt
For more information on module installation, please visit the detailed CPAN module installation guide.