.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Sys::Virt 3pm" .TH Sys::Virt 3pm 2024-01-21 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Sys::Virt \- Represent and manage a libvirt hypervisor connection .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& my $conn = Sys::Virt\->new(uri => $uri); \& \& my @domains = $conn\->list_domains(); \& \& foreach my $dom (@domains) { \& print "Domain ", $dom\->get_id, " ", $dom\->get_name, "\en"; \& } .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" 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. .SH "CALLBACK HANDLING" .IX Header "CALLBACK HANDLING" Each callback registration routine returns a \f(CW$callbackID\fR (except for \&\f(CW\*(C`domain_event_register\*(C'\fR and \f(CW\*(C`register_close_callback\*(C'\fR). This return value must be retained and used for callback deregistration. .PP \&\fBIMPORTANT:\fR All callbacks must be deregistered (including the ones registered using \f(CW\*(C`domain_event_register\*(C'\fR and \f(CW\*(C`register_close_callback\*(C'\fR); failing to do so prevents the \f(CW\*(C`Sys::Virt\*(C'\fR object from being garbage collected and the connection to \f(CW\*(C`libvirtd\*(C'\fR from being closed. .SH "ERROR HANDLING" .IX Header "ERROR HANDLING" 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: .PP .Vb 4 \& eval { my $conn = Sys::Virt\->new(uri => $uri); }; \& if ($@) { \& print STDERR "Unable to open connection to $addr" . $@\->message . "\en"; \& } .Ve .PP For details of the information contained in the error objects, consult the Sys::Virt::Error manual page. .SH METHODS .IX Header "METHODS" .ie n .IP "my $conn = Sys::Virt\->new(uri => $uri, readonly => $ro, flags => $flags);" 4 .el .IP "my \f(CW$conn\fR = Sys::Virt\->new(uri => \f(CW$uri\fR, readonly => \f(CW$ro\fR, flags => \f(CW$flags\fR);" 4 .IX Item "my $conn = Sys::Virt->new(uri => $uri, readonly => $ro, flags => $flags);" Attach to the virtualization host identified by \f(CW\*(C`uri\*(C'\fR. The \&\f(CW\*(C`uri\*(C'\fR parameter may be omitted, in which case the default connection made will be to the local Xen hypervisor. Some example URIs include: .RS 4 .IP xen:/// 4 .IX Item "xen:///" Xen on the local machine .IP test:///default 4 .IX Item "test:///default" Dummy "in memory" driver for test suites .IP qemu:///system 4 .IX Item "qemu:///system" System-wide driver for QEMU / KVM virtualization .IP qemu:///session 4 .IX Item "qemu:///session" Per-user driver for QEMU virtualization .IP qemu+tls://somehost/system 4 .IX Item "qemu+tls://somehost/system" System-wide QEMU driver on \f(CW\*(C`somehost\*(C'\fR using TLS security .IP xen+tcp://somehost/ 4 .IX Item "xen+tcp://somehost/" Xen driver on \f(CW\*(C`somehost\*(C'\fR using TCP / SASL security .RE .RS 4 .Sp For further details consult \f(CW\*(C`http://libvirt.org/uri.html\*(C'\fR .Sp If the optional \f(CW\*(C`readonly\*(C'\fR parameter is supplied, then an unprivileged connection to the hypervisor will be attempted. If it is not supplied, then it defaults to making a fully privileged connection to the hypervisor. If the calling application is not running as root, it may be necessary to provide authentication callbacks. .Sp If the optional \f(CW\*(C`auth\*(C'\fR parameter is set to a non-zero value, authentication will be enabled during connection, using the default set of credential gathering callbacks. The default callbacks prompt for credentials on the console, so are not suitable for graphical applications. For such apps a custom implementation should be supplied. The \f(CW\*(C`credlist\*(C'\fR parameter should be an array reference listing the set of credential types that will be supported. The credential constants in this module can be used as values in this list. The \f(CW\*(C`callback\*(C'\fR parameter should be a subroutine reference containing the code necessary to gather the credentials. When invoked it will be supplied with a single parameter, an array reference of requested credentials. The elements of the array are hash references, with keys \f(CW\*(C`type\*(C'\fR giving the type of credential, \f(CW\*(C`prompt\*(C'\fR giving a user descriptive user prompt, \f(CW\*(C`challenge\*(C'\fR giving name of the credential required. The answer should be collected from the user, and returned by setting the \f(CW\*(C`result\*(C'\fR key. This key may already be set with a default result if applicable .Sp As a simple example returning hardcoded credentials .Sp .Vb 3 \& my $uri = "qemu+tcp://192.168.122.1/system"; \& my $username = "test"; \& my $password = "123456"; \& \& my $con = Sys::Virt\->new(uri => $uri, \& auth => 1, \& credlist => [ \& Sys::Virt::CRED_AUTHNAME, \& Sys::Virt::CRED_PASSPHRASE, \& ], \& callback => \& sub { \& my $creds = shift; \& \& foreach my $cred (@{$creds}) { \& if ($cred\->{type} == Sys::Virt::CRED_AUTHNAME) { \& $cred\->{result} = $username; \& } \& if ($cred\->{type} == Sys::Virt::CRED_PASSPHRASE) { \& $cred\->{result} = $password; \& } \& } \& return 0; \& }); .Ve .Sp For backwards compatibility with earlier releases, the \f(CW\*(C`address\*(C'\fR parameter is accepted as a synonym for the \f(CW\*(C`uri\*(C'\fR parameter. The use of \f(CW\*(C`uri\*(C'\fR is recommended for all newly written code. .RE .ie n .IP "$conn\->set_identity($identity, $flags=0)" 4 .el .IP "\f(CW$conn\fR\->set_identity($identity, \f(CW$flags\fR=0)" 4 .IX Item "$conn->set_identity($identity, $flags=0)" Change the identity that is used for access control over the connection. Normally the remote daemon will use the identity associated with the UNIX domain socket that the app opens. Only a privileged client is usually able to override this. The \f(CW$identity\fR should be a hash reference whose keys are one of the IDENTITY constants. The \f(CW$flags\fR parameter is currently unused, and defaults to 0 if omitted. .ie n .IP "my $st = $conn\->new_stream($flags)" 4 .el .IP "my \f(CW$st\fR = \f(CW$conn\fR\->new_stream($flags)" 4 .IX Item "my $st = $conn->new_stream($flags)" Create a new stream, with the given flags .ie n .IP "my $dom = $conn\->create_domain($xml, $flags=0);" 4 .el .IP "my \f(CW$dom\fR = \f(CW$conn\fR\->create_domain($xml, \f(CW$flags\fR=0);" 4 .IX Item "my $dom = $conn->create_domain($xml, $flags=0);" Create a new domain based on the XML description passed into the \f(CW$xml\fR parameter. The returned object is an instance of the Sys::Virt::Domain class. This method is not available with unprivileged connections to the hypervisor. The \f(CW$flags\fR parameter accepts one of the DOMAIN CREATION constants documented in Sys::Virt::Domain, and defaults to 0 if omitted. .ie n .IP "my $dom = $conn\->create_domain_with_files($xml, $fds, $flags=0);" 4 .el .IP "my \f(CW$dom\fR = \f(CW$conn\fR\->create_domain_with_files($xml, \f(CW$fds\fR, \f(CW$flags\fR=0);" 4 .IX Item "my $dom = $conn->create_domain_with_files($xml, $fds, $flags=0);" Create a new domain based on the XML description passed into the \f(CW$xml\fR parameter. The returned object is an instance of the Sys::Virt::Domain class. This method is not available with unprivileged connections to the hypervisor. The \f(CW$fds\fR parameter is an array of UNIX file descriptors which will be passed to the init process of the container. This is only supported with container based virtualization. The \f(CW$flags\fR parameter accepts one of the DOMAIN CREATION constants documented in Sys::Virt::Domain, and defaults to 0 if omitted. .ie n .IP "my $dom = $conn\->define_domain($xml, $flags=0);" 4 .el .IP "my \f(CW$dom\fR = \f(CW$conn\fR\->define_domain($xml, \f(CW$flags\fR=0);" 4 .IX Item "my $dom = $conn->define_domain($xml, $flags=0);" Defines, but does not start, a new domain based on the XML description passed into the \f(CW$xml\fR parameter. The returned object is an instance of the Sys::Virt::Domain class. This method is not available with unprivileged connections to the hypervisor. The defined domain can be later started by calling the \f(CW\*(C`create\*(C'\fR method on the returned \f(CW\*(C`Sys::Virt::Domain\*(C'\fR object. The \f(CW$flags\fR parameter accepts one of the DOMAIN DEFINE constants documented in Sys::Virt::Domain, and defaults to 0 if omitted. .ie n .IP "my $net = $conn\->create_network($xml, $flags=0);" 4 .el .IP "my \f(CW$net\fR = \f(CW$conn\fR\->create_network($xml, \f(CW$flags\fR=0);" 4 .IX Item "my $net = $conn->create_network($xml, $flags=0);" Create a new network based on the XML description passed into the \f(CW$xml\fR parameter. The returned object is an instance of the Sys::Virt::Network class. This method is not available with unprivileged connections to the hypervisor. The \f(CW$flags\fR parameter accepts one of the NETWORK CREATION constants documented in Sys::Virt::Network, and defaults to 0 if omitted. .ie n .IP "my $net = $conn\->define_network($xml, $flags=0);" 4 .el .IP "my \f(CW$net\fR = \f(CW$conn\fR\->define_network($xml, \f(CW$flags\fR=0);" 4 .IX Item "my $net = $conn->define_network($xml, $flags=0);" Defines, but does not start, a new network based on the XML description passed into the \f(CW$xml\fR parameter. The returned object is an instance of the Sys::Virt::Network class. This method is not available with unprivileged connections to the hypervisor. The defined network can be later started by calling the \f(CW\*(C`create\*(C'\fR method on the returned \f(CW\*(C`Sys::Virt::Network\*(C'\fR object. The \f(CW$flags\fR parameter accepts one of the NETWORK DEFINE constants documented in Sys::Virt::Network, and defaults to 0 if omitted. .ie n .IP "my $nwfilter = $conn\->define_nwfilter($xml, $flags=0);" 4 .el .IP "my \f(CW$nwfilter\fR = \f(CW$conn\fR\->define_nwfilter($xml, \f(CW$flags\fR=0);" 4 .IX Item "my $nwfilter = $conn->define_nwfilter($xml, $flags=0);" Defines a new network filter based on the XML description passed into the \f(CW$xml\fR parameter. The returned object is an instance of the Sys::Virt::NWFilter class. This method is not available with unprivileged connections to the hypervisor. The \f(CW$flags\fR parameter accepts one of the NWFILTER DEFINE constants documented in Sys::Virt::NWFilter, and defaults to 0 if omitted. .ie n .IP "my $binding = $conn\->create_nwfilter_binding($xml, $flags=0);" 4 .el .IP "my \f(CW$binding\fR = \f(CW$conn\fR\->create_nwfilter_binding($xml, \f(CW$flags\fR=0);" 4 .IX Item "my $binding = $conn->create_nwfilter_binding($xml, $flags=0);" Create a new network filter binding based on the XML description passed into the \f(CW$xml\fR parameter. The returned object is an instance of the Sys::Virt::NWFilterBinding class. The \f(CW$flags\fR parameter accepts one of the NETWORK FILTER BINDING CREATION constants documented in Sys::Virt::NWFilterBinding, and defaults to 0 if omitted. .ie n .IP "my $secret = $conn\->define_secret($xml, $flags=0);" 4 .el .IP "my \f(CW$secret\fR = \f(CW$conn\fR\->define_secret($xml, \f(CW$flags\fR=0);" 4 .IX Item "my $secret = $conn->define_secret($xml, $flags=0);" Defines a new secret based on the XML description passed into the \f(CW$xml\fR parameter. The returned object is an instance of the Sys::Virt::Secret class. This method is not available with unprivileged connections to the hypervisor. The \f(CW$flags\fR parameter accepts one of the SECRET DEFINE constants documented in Sys::Virt::Secret, and defaults to 0 if omitted. .ie n .IP "my $pool = $conn\->create_storage_pool($xml);" 4 .el .IP "my \f(CW$pool\fR = \f(CW$conn\fR\->create_storage_pool($xml);" 4 .IX Item "my $pool = $conn->create_storage_pool($xml);" Create a new storage pool based on the XML description passed into the \f(CW$xml\fR parameter. The returned object is an instance of the Sys::Virt::StoragePool class. This method is not available with unprivileged connections to the hypervisor. .ie n .IP "my $pool = $conn\->define_storage_pool($xml, $flags=0);" 4 .el .IP "my \f(CW$pool\fR = \f(CW$conn\fR\->define_storage_pool($xml, \f(CW$flags\fR=0);" 4 .IX Item "my $pool = $conn->define_storage_pool($xml, $flags=0);" Defines, but does not start, a new storage pol based on the XML description passed into the \f(CW$xml\fR parameter. The returned object is an instance of the Sys::Virt::StoragePool class. This method is not available with unprivileged connections to the hypervisor. The defined pool can be later started by calling the \f(CW\*(C`create\*(C'\fR method on the returned \f(CW\*(C`Sys::Virt::StoragePool\*(C'\fR object. The \f(CW$flags\fR parameter accepts one of the STORAGE POOL DEFINE constants documented in Sys::Virt::StoragePool, and defaults to 0 if omitted. .ie n .IP "my $pool = $conn\->create_interface($xml);" 4 .el .IP "my \f(CW$pool\fR = \f(CW$conn\fR\->create_interface($xml);" 4 .IX Item "my $pool = $conn->create_interface($xml);" Create a new interface based on the XML description passed into the \f(CW$xml\fR parameter. The returned object is an instance of the Sys::Virt::Interface class. This method is not available with unprivileged connections to the hypervisor. .ie n .IP "my $iface = $conn\->define_interface($xml, $flags=0);" 4 .el .IP "my \f(CW$iface\fR = \f(CW$conn\fR\->define_interface($xml, \f(CW$flags\fR=0);" 4 .IX Item "my $iface = $conn->define_interface($xml, $flags=0);" Defines, but does not start, a new interface based on the XML description passed into the \f(CW$xml\fR parameter. The returned object is an instance of the Sys::Virt::Interface class. This method is not available with unprivileged connections to the hypervisor. The defined interface can be later started by calling the \f(CW\*(C`create\*(C'\fR method on the returned \f(CW\*(C`Sys::Virt::Interface\*(C'\fR object. The \f(CW$flags\fR parameter accepts one of the INTERFACE DEFINE constants documented in Sys::Virt::Interface, and defaults to 0 if omitted. .ie n .IP "my $dev = $conn\->create_node_device($xml, $flags=0);" 4 .el .IP "my \f(CW$dev\fR = \f(CW$conn\fR\->create_node_device($xml, \f(CW$flags\fR=0);" 4 .IX Item "my $dev = $conn->create_node_device($xml, $flags=0);" Create a new virtual node device based on the XML description passed into the \&\f(CW$xml\fR parameter. The returned object is an instance of the Sys::Virt::NodeDevice class. This method is not available with unprivileged connections to the hypervisor. The \f(CW$flags\fR parameter accepts one of the NODE DEVICE CREATION constants documented in Sys::Virt::NodeDevice, and defaults to 0 if omitted. .ie n .IP "my $dev = $conn\->define_node_device($xml, $flags=0);" 4 .el .IP "my \f(CW$dev\fR = \f(CW$conn\fR\->define_node_device($xml, \f(CW$flags\fR=0);" 4 .IX Item "my $dev = $conn->define_node_device($xml, $flags=0);" Defines, but does not start, a new node dev based on the XML description passed into the \f(CW$xml\fR parameter. The returned object is an instance of the Sys::Virt::NodeDevice class. This method is not available with unprivileged connections to the hypervisor. The defined node device can be later started by calling the \f(CW\*(C`create\*(C'\fR method on the returned \&\f(CW\*(C`Sys::Virt::NodeDevice\*(C'\fR object. The \f(CW$flags\fR parameter accepts one of the NODE DEVICE DEFINE constants documented in Sys::Virt::NodeDevice, and defaults to 0 if omitted. .ie n .IP "my @doms = $conn\->\fBlist_domains()\fR" 4 .el .IP "my \f(CW@doms\fR = \f(CW$conn\fR\->\fBlist_domains()\fR" 4 .IX Item "my @doms = $conn->list_domains()" Return a list of all running domains currently known to the hypervisor. The elements in the returned list are instances of the Sys::Virt::Domain class. This method requires O(n) RPC calls, so the \f(CW\*(C`list_all_domains\*(C'\fR method is recommended as a more efficient alternative. .ie n .IP "my $nids = $conn\->\fBnum_of_domains()\fR" 4 .el .IP "my \f(CW$nids\fR = \f(CW$conn\fR\->\fBnum_of_domains()\fR" 4 .IX Item "my $nids = $conn->num_of_domains()" Return the number of running domains known to the hypervisor. This can be used as the \f(CW\*(C`maxids\*(C'\fR parameter to \f(CW\*(C`list_domain_ids\*(C'\fR. .ie n .IP "my @domIDs = $conn\->list_domain_ids($maxids)" 4 .el .IP "my \f(CW@domIDs\fR = \f(CW$conn\fR\->list_domain_ids($maxids)" 4 .IX Item "my @domIDs = $conn->list_domain_ids($maxids)" Return a list of all domain IDs currently known to the hypervisor. The IDs can be used with the \f(CW\*(C`get_domain_by_id\*(C'\fR method. .ie n .IP "my @doms = $conn\->\fBlist_defined_domains()\fR" 4 .el .IP "my \f(CW@doms\fR = \f(CW$conn\fR\->\fBlist_defined_domains()\fR" 4 .IX Item "my @doms = $conn->list_defined_domains()" Return a list of all domains defined, but not currently running, on the hypervisor. The elements in the returned list are instances of the Sys::Virt::Domain class. This method requires O(n) RPC calls, so the \&\f(CW\*(C`list_all_domains\*(C'\fR method is recommended as a more efficient alternative. .ie n .IP "my $ndoms = $conn\->\fBnum_of_defined_domains()\fR" 4 .el .IP "my \f(CW$ndoms\fR = \f(CW$conn\fR\->\fBnum_of_defined_domains()\fR" 4 .IX Item "my $ndoms = $conn->num_of_defined_domains()" Return the number of running domains known to the hypervisor. This can be used as the \f(CW\*(C`maxnames\*(C'\fR parameter to \f(CW\*(C`list_defined_domain_names\*(C'\fR. .ie n .IP "my @names = $conn\->list_defined_domain_names($maxnames)" 4 .el .IP "my \f(CW@names\fR = \f(CW$conn\fR\->list_defined_domain_names($maxnames)" 4 .IX Item "my @names = $conn->list_defined_domain_names($maxnames)" Return a list of names of all domains defined, but not currently running, on the hypervisor. The names can be used with the \f(CW\*(C`get_domain_by_name\*(C'\fR method. .ie n .IP "my @doms = $conn\->list_all_domains($flags)" 4 .el .IP "my \f(CW@doms\fR = \f(CW$conn\fR\->list_all_domains($flags)" 4 .IX Item "my @doms = $conn->list_all_domains($flags)" Return a list of all domains currently known to the hypervisor, whether running or shutoff. The elements in the returned list are instances of the Sys::Virt::Domain class. The \f(CW$flags\fR parameter can be used to filter the list of returned domains. .ie n .IP "my @nets = $conn\->\fBlist_networks()\fR" 4 .el .IP "my \f(CW@nets\fR = \f(CW$conn\fR\->\fBlist_networks()\fR" 4 .IX Item "my @nets = $conn->list_networks()" Return a list of all networks currently known to the hypervisor. The elements in the returned list are instances of the Sys::Virt::Network class. This method requires O(n) RPC calls, so the \f(CW\*(C`list_all_networks\*(C'\fR method is recommended as a more efficient alternative. .ie n .IP "my $nnets = $conn\->\fBnum_of_networks()\fR" 4 .el .IP "my \f(CW$nnets\fR = \f(CW$conn\fR\->\fBnum_of_networks()\fR" 4 .IX Item "my $nnets = $conn->num_of_networks()" Return the number of running networks known to the hypervisor. This can be used as the \f(CW\*(C`maxids\*(C'\fR parameter to \f(CW\*(C`list_network_ids\*(C'\fR. .ie n .IP "my @netNames = $conn\->list_network_names($maxnames)" 4 .el .IP "my \f(CW@netNames\fR = \f(CW$conn\fR\->list_network_names($maxnames)" 4 .IX Item "my @netNames = $conn->list_network_names($maxnames)" Return a list of all network names currently known to the hypervisor. The names can be used with the \f(CW\*(C`get_network_by_name\*(C'\fR method. .ie n .IP "my @nets = $conn\->\fBlist_defined_networks()\fR" 4 .el .IP "my \f(CW@nets\fR = \f(CW$conn\fR\->\fBlist_defined_networks()\fR" 4 .IX Item "my @nets = $conn->list_defined_networks()" Return a list of all networks defined, but not currently running, on the hypervisor. The elements in the returned list are instances of the Sys::Virt::Network class. This method requires O(n) RPC calls, so the \&\f(CW\*(C`list_all_networks\*(C'\fR method is recommended as a more efficient alternative. .ie n .IP "my $nnets = $conn\->\fBnum_of_defined_networks()\fR" 4 .el .IP "my \f(CW$nnets\fR = \f(CW$conn\fR\->\fBnum_of_defined_networks()\fR" 4 .IX Item "my $nnets = $conn->num_of_defined_networks()" Return the number of running networks known to the host. This can be used as the \f(CW\*(C`maxnames\*(C'\fR parameter to \f(CW\*(C`list_defined_network_names\*(C'\fR. .ie n .IP "my @names = $conn\->list_defined_network_names($maxnames)" 4 .el .IP "my \f(CW@names\fR = \f(CW$conn\fR\->list_defined_network_names($maxnames)" 4 .IX Item "my @names = $conn->list_defined_network_names($maxnames)" Return a list of names of all networks defined, but not currently running, on the host. The names can be used with the \f(CW\*(C`get_network_by_name\*(C'\fR method. .ie n .IP "my @nets = $conn\->list_all_networks($flags)" 4 .el .IP "my \f(CW@nets\fR = \f(CW$conn\fR\->list_all_networks($flags)" 4 .IX Item "my @nets = $conn->list_all_networks($flags)" Return a list of all networks currently known to the hypervisor, whether running or shutoff. The elements in the returned list are instances of the Sys::Virt::Network class. The \f(CW$flags\fR parameter can be used to filter the list of returned networks. .ie n .IP "my @pools = $conn\->\fBlist_storage_pools()\fR" 4 .el .IP "my \f(CW@pools\fR = \f(CW$conn\fR\->\fBlist_storage_pools()\fR" 4 .IX Item "my @pools = $conn->list_storage_pools()" Return a list of all storage pools currently known to the host. The elements in the returned list are instances of the Sys::Virt::StoragePool class. This method requires O(n) RPC calls, so the \f(CW\*(C`list_all_storage_pools\*(C'\fR method is recommended as a more efficient alternative. .ie n .IP "my $npools = $conn\->\fBnum_of_storage_pools()\fR" 4 .el .IP "my \f(CW$npools\fR = \f(CW$conn\fR\->\fBnum_of_storage_pools()\fR" 4 .IX Item "my $npools = $conn->num_of_storage_pools()" Return the number of running storage pools known to the hypervisor. This can be used as the \f(CW\*(C`maxids\*(C'\fR parameter to \f(CW\*(C`list_storage_pool_names\*(C'\fR. .ie n .IP "my @poolNames = $conn\->list_storage_pool_names($maxnames)" 4 .el .IP "my \f(CW@poolNames\fR = \f(CW$conn\fR\->list_storage_pool_names($maxnames)" 4 .IX Item "my @poolNames = $conn->list_storage_pool_names($maxnames)" Return a list of all storage pool names currently known to the hypervisor. The IDs can be used with the \f(CW\*(C`get_network_by_id\*(C'\fR method. .ie n .IP "my @pools = $conn\->\fBlist_defined_storage_pools()\fR" 4 .el .IP "my \f(CW@pools\fR = \f(CW$conn\fR\->\fBlist_defined_storage_pools()\fR" 4 .IX Item "my @pools = $conn->list_defined_storage_pools()" Return a list of all storage pools defined, but not currently running, on the host. The elements in the returned list are instances of the Sys::Virt::StoragePool class. This method requires O(n) RPC calls, so the \&\f(CW\*(C`list_all_storage_pools\*(C'\fR method is recommended as a more efficient alternative. .ie n .IP "my $npools = $conn\->\fBnum_of_defined_storage_pools()\fR" 4 .el .IP "my \f(CW$npools\fR = \f(CW$conn\fR\->\fBnum_of_defined_storage_pools()\fR" 4 .IX Item "my $npools = $conn->num_of_defined_storage_pools()" Return the number of running networks known to the host. This can be used as the \f(CW\*(C`maxnames\*(C'\fR parameter to \f(CW\*(C`list_defined_storage_pool_names\*(C'\fR. .ie n .IP "my @names = $conn\->list_defined_storage_pool_names($maxnames)" 4 .el .IP "my \f(CW@names\fR = \f(CW$conn\fR\->list_defined_storage_pool_names($maxnames)" 4 .IX Item "my @names = $conn->list_defined_storage_pool_names($maxnames)" Return a list of names of all storage pools defined, but not currently running, on the host. The names can be used with the \f(CW\*(C`get_storage_pool_by_name\*(C'\fR method. .ie n .IP "my @pools = $conn\->list_all_storage_pools($flags)" 4 .el .IP "my \f(CW@pools\fR = \f(CW$conn\fR\->list_all_storage_pools($flags)" 4 .IX Item "my @pools = $conn->list_all_storage_pools($flags)" Return a list of all storage pools currently known to the hypervisor, whether running or shutoff. The elements in the returned list are instances of the Sys::Virt::StoragePool class. The \f(CW$flags\fR parameter can be used to filter the list of returned pools. .ie n .IP "my @devs = $conn\->list_node_devices($capability)" 4 .el .IP "my \f(CW@devs\fR = \f(CW$conn\fR\->list_node_devices($capability)" 4 .IX Item "my @devs = $conn->list_node_devices($capability)" Return a list of all devices currently known to the host OS. The elements in the returned list are instances of the Sys::Virt::NodeDevice class. The optional \f(CW\*(C`capability\*(C'\fR parameter allows the list to be restricted to only devices with a particular capability type. This method requires O(n) RPC calls, so the \f(CW\*(C`list_all_node_devices\*(C'\fR method is recommended as a more efficient alternative. .ie n .IP "my $ndevs = $conn\->num_of_node_devices($capability[, $flags])" 4 .el .IP "my \f(CW$ndevs\fR = \f(CW$conn\fR\->num_of_node_devices($capability[, \f(CW$flags\fR])" 4 .IX Item "my $ndevs = $conn->num_of_node_devices($capability[, $flags])" Return the number of host devices known to the hypervisor. This can be used as the \f(CW\*(C`maxids\*(C'\fR parameter to \f(CW\*(C`list_node_device_names\*(C'\fR. The \f(CW\*(C`capability\*(C'\fR parameter allows the list to be restricted to only devices with a particular capability type, and should be left as \f(CW\*(C`undef\*(C'\fR if the full list is required. The optional parameter is currently unused and defaults to 0 if omitted. .ie n .IP "my @devNames = $conn\->list_node_device_names($capability, $maxnames[, $flags])" 4 .el .IP "my \f(CW@devNames\fR = \f(CW$conn\fR\->list_node_device_names($capability, \f(CW$maxnames\fR[, \f(CW$flags\fR])" 4 .IX Item "my @devNames = $conn->list_node_device_names($capability, $maxnames[, $flags])" Return a list of all host device names currently known to the hypervisor. The names can be used with the \f(CW\*(C`get_node_device_by_name\*(C'\fR method. The \f(CW\*(C`capability\*(C'\fR parameter allows the list to be restricted to only devices with a particular capability type, and should be left as \f(CW\*(C`undef\*(C'\fR if the full list is required. The optional parameter is currently unused and defaults to 0 if omitted. .ie n .IP "my @devs = $conn\->list_all_node_devices($flags)" 4 .el .IP "my \f(CW@devs\fR = \f(CW$conn\fR\->list_all_node_devices($flags)" 4 .IX Item "my @devs = $conn->list_all_node_devices($flags)" Return a list of all node devices currently known to the hypervisor. The elements in the returned list are instances of the Sys::Virt::NodeDevice class. The \f(CW$flags\fR parameter can be used to filter the list of returned devices. .ie n .IP "my @ifaces = $conn\->\fBlist_interfaces()\fR" 4 .el .IP "my \f(CW@ifaces\fR = \f(CW$conn\fR\->\fBlist_interfaces()\fR" 4 .IX Item "my @ifaces = $conn->list_interfaces()" Return a list of all network interfaces currently known to the hypervisor. The elements in the returned list are instances of the Sys::Virt::Interface class. This method requires O(n) RPC calls, so the \f(CW\*(C`list_all_interfaces\*(C'\fR method is recommended as a more efficient alternative. .ie n .IP "my $nifaces = $conn\->\fBnum_of_interfaces()\fR" 4 .el .IP "my \f(CW$nifaces\fR = \f(CW$conn\fR\->\fBnum_of_interfaces()\fR" 4 .IX Item "my $nifaces = $conn->num_of_interfaces()" Return the number of running interfaces known to the hypervisor. This can be used as the \f(CW\*(C`maxnames\*(C'\fR parameter to \f(CW\*(C`list_interface_names\*(C'\fR. .ie n .IP "my @names = $conn\->list_interface_names($maxnames)" 4 .el .IP "my \f(CW@names\fR = \f(CW$conn\fR\->list_interface_names($maxnames)" 4 .IX Item "my @names = $conn->list_interface_names($maxnames)" Return a list of all interface names currently known to the hypervisor. The names can be used with the \f(CW\*(C`get_interface_by_name\*(C'\fR method. .ie n .IP "my @ifaces = $conn\->\fBlist_defined_interfaces()\fR" 4 .el .IP "my \f(CW@ifaces\fR = \f(CW$conn\fR\->\fBlist_defined_interfaces()\fR" 4 .IX Item "my @ifaces = $conn->list_defined_interfaces()" Return a list of all network interfaces currently known to the hypervisor. The elements in the returned list are instances of the Sys::Virt::Interface class. This method requires O(n) RPC calls, so the \f(CW\*(C`list_all_interfaces\*(C'\fR method is recommended as a more efficient alternative. .ie n .IP "my $nifaces = $conn\->\fBnum_of_defined_interfaces()\fR" 4 .el .IP "my \f(CW$nifaces\fR = \f(CW$conn\fR\->\fBnum_of_defined_interfaces()\fR" 4 .IX Item "my $nifaces = $conn->num_of_defined_interfaces()" Return the number of inactive interfaces known to the hypervisor. This can be used as the \f(CW\*(C`maxnames\*(C'\fR parameter to \f(CW\*(C`list_defined_interface_names\*(C'\fR. .ie n .IP "my @names = $conn\->list_defined_interface_names($maxnames)" 4 .el .IP "my \f(CW@names\fR = \f(CW$conn\fR\->list_defined_interface_names($maxnames)" 4 .IX Item "my @names = $conn->list_defined_interface_names($maxnames)" Return a list of inactive interface names currently known to the hypervisor. The names can be used with the \f(CW\*(C`get_interface_by_name\*(C'\fR method. .ie n .IP "my @ifaces = $conn\->list_all_interfaces($flags)" 4 .el .IP "my \f(CW@ifaces\fR = \f(CW$conn\fR\->list_all_interfaces($flags)" 4 .IX Item "my @ifaces = $conn->list_all_interfaces($flags)" Return a list of all interfaces currently known to the hypervisor, whether running or shutoff. The elements in the returned list are instances of the Sys::Virt::Interface class. The \f(CW$flags\fR parameter can be used to filter the list of returned interfaces. .ie n .IP "my @ifaces = $conn\->\fBlist_secrets()\fR" 4 .el .IP "my \f(CW@ifaces\fR = \f(CW$conn\fR\->\fBlist_secrets()\fR" 4 .IX Item "my @ifaces = $conn->list_secrets()" Return a list of all secrets currently known to the hypervisor. The elements in the returned list are instances of the Sys::Virt::Secret class. This method requires O(n) RPC calls, so the \f(CW\*(C`list_all_secrets\*(C'\fR method is recommended as a more efficient alternative. .ie n .IP "my $nuuids = $conn\->\fBnum_of_secrets()\fR" 4 .el .IP "my \f(CW$nuuids\fR = \f(CW$conn\fR\->\fBnum_of_secrets()\fR" 4 .IX Item "my $nuuids = $conn->num_of_secrets()" Return the number of secrets known to the hypervisor. This can be used as the \f(CW\*(C`maxuuids\*(C'\fR parameter to \f(CW\*(C`list_secrets\*(C'\fR. .ie n .IP "my @uuids = $conn\->list_secret_uuids($maxuuids)" 4 .el .IP "my \f(CW@uuids\fR = \f(CW$conn\fR\->list_secret_uuids($maxuuids)" 4 .IX Item "my @uuids = $conn->list_secret_uuids($maxuuids)" Return a list of all secret uuids currently known to the hypervisor. The uuids can be used with the \f(CW\*(C`get_secret_by_uuid\*(C'\fR method. .ie n .IP "my @secrets = $conn\->list_all_secrets($flags)" 4 .el .IP "my \f(CW@secrets\fR = \f(CW$conn\fR\->list_all_secrets($flags)" 4 .IX Item "my @secrets = $conn->list_all_secrets($flags)" Return a list of all secrets currently known to the hypervisor. The elements in the returned list are instances of the Sys::Virt::Network class. The \f(CW$flags\fR parameter can be used to filter the list of returned secrets. .ie n .IP "my @nwfilters = $conn\->\fBlist_nwfilters()\fR" 4 .el .IP "my \f(CW@nwfilters\fR = \f(CW$conn\fR\->\fBlist_nwfilters()\fR" 4 .IX Item "my @nwfilters = $conn->list_nwfilters()" Return a list of all nwfilters currently known to the hypervisor. The elements in the returned list are instances of the Sys::Virt::NWFilter class. This method requires O(n) RPC calls, so the \f(CW\*(C`list_all_nwfilters\*(C'\fR method is recommended as a more efficient alternative. .ie n .IP "my $nnwfilters = $conn\->\fBnum_of_nwfilters()\fR" 4 .el .IP "my \f(CW$nnwfilters\fR = \f(CW$conn\fR\->\fBnum_of_nwfilters()\fR" 4 .IX Item "my $nnwfilters = $conn->num_of_nwfilters()" Return the number of running nwfilters known to the hypervisor. This can be used as the \f(CW\*(C`maxids\*(C'\fR parameter to \f(CW\*(C`list_nwfilter_names\*(C'\fR. .ie n .IP "my @filterNames = $conn\->list_nwfilter_names($maxnames)" 4 .el .IP "my \f(CW@filterNames\fR = \f(CW$conn\fR\->list_nwfilter_names($maxnames)" 4 .IX Item "my @filterNames = $conn->list_nwfilter_names($maxnames)" Return a list of all nwfilter names currently known to the hypervisor. The names can be used with the \f(CW\*(C`get_nwfilter_by_name\*(C'\fR method. .ie n .IP "my @nwfilters = $conn\->list_all_nwfilters($flags)" 4 .el .IP "my \f(CW@nwfilters\fR = \f(CW$conn\fR\->list_all_nwfilters($flags)" 4 .IX Item "my @nwfilters = $conn->list_all_nwfilters($flags)" Return a list of all nwfilters currently known to the hypervisor. The elements in the returned list are instances of the Sys::Virt::NWFilter class. The \f(CW$flags\fR parameter is currently unused and defaults to zero. .ie n .IP "my @bindings = $conn\->list_all_nwfilter_bindings($flags)" 4 .el .IP "my \f(CW@bindings\fR = \f(CW$conn\fR\->list_all_nwfilter_bindings($flags)" 4 .IX Item "my @bindings = $conn->list_all_nwfilter_bindings($flags)" Return a list of all nwfilter bindings currently known to the hypervisor. The elements in the returned list are instances of the Sys::Virt::NWFilterBinding class. The \f(CW$flags\fR parameter is currently unused and defaults to zero. .ie n .IP "$conn\->define_save_image_xml($file, $dxml, $flags=0)" 4 .el .IP "\f(CW$conn\fR\->define_save_image_xml($file, \f(CW$dxml\fR, \f(CW$flags\fR=0)" 4 .IX Item "$conn->define_save_image_xml($file, $dxml, $flags=0)" Update the XML associated with a virtual machine's save image. The \f(CW$file\fR parameter is the fully qualified path to the save image XML, while \f(CW$dxml\fR is the new XML document to write. The \f(CW$flags\fR parameter is currently unused and defaults to zero. .ie n .IP "$xml = $conn\->get_save_image_xml_description($file, $flags=1)" 4 .el .IP "\f(CW$xml\fR = \f(CW$conn\fR\->get_save_image_xml_description($file, \f(CW$flags\fR=1)" 4 .IX Item "$xml = $conn->get_save_image_xml_description($file, $flags=1)" Retrieve the current XML configuration associated with the virtual machine's save image identified by \f(CW$file\fR. The \f(CW$flags\fR parameter accepts the same constants as \f(CW\*(C`Sys::Virt::Domain::managed_save_get_xml_description\*(C'\fR. .ie n .IP "my $dom = $conn\->get_domain_by_name($name)" 4 .el .IP "my \f(CW$dom\fR = \f(CW$conn\fR\->get_domain_by_name($name)" 4 .IX Item "my $dom = $conn->get_domain_by_name($name)" Return the domain with a name of \f(CW$name\fR. The returned object is an instance of the Sys::Virt::Domain class. .ie n .IP "my $dom = $conn\->get_domain_by_id($id)" 4 .el .IP "my \f(CW$dom\fR = \f(CW$conn\fR\->get_domain_by_id($id)" 4 .IX Item "my $dom = $conn->get_domain_by_id($id)" Return the domain with a local id of \f(CW$id\fR. The returned object is an instance of the Sys::Virt::Domain class. .ie n .IP "my $dom = $conn\->get_domain_by_uuid($uuid)" 4 .el .IP "my \f(CW$dom\fR = \f(CW$conn\fR\->get_domain_by_uuid($uuid)" 4 .IX Item "my $dom = $conn->get_domain_by_uuid($uuid)" Return the domain with a globally unique id of \f(CW$uuid\fR. The returned object is an instance of the Sys::Virt::Domain class. .ie n .IP "my $net = $conn\->get_network_by_name($name)" 4 .el .IP "my \f(CW$net\fR = \f(CW$conn\fR\->get_network_by_name($name)" 4 .IX Item "my $net = $conn->get_network_by_name($name)" Return the network with a name of \f(CW$name\fR. The returned object is an instance of the Sys::Virt::Network class. .ie n .IP "my $net = $conn\->get_network_by_uuid($uuid)" 4 .el .IP "my \f(CW$net\fR = \f(CW$conn\fR\->get_network_by_uuid($uuid)" 4 .IX Item "my $net = $conn->get_network_by_uuid($uuid)" Return the network with a globally unique id of \f(CW$uuid\fR. The returned object is an instance of the Sys::Virt::Network class. .ie n .IP "my $pool = $conn\->get_storage_pool_by_name($name)" 4 .el .IP "my \f(CW$pool\fR = \f(CW$conn\fR\->get_storage_pool_by_name($name)" 4 .IX Item "my $pool = $conn->get_storage_pool_by_name($name)" Return the storage pool with a name of \f(CW$name\fR. The returned object is an instance of the Sys::Virt::StoragePool class. .ie n .IP "my $pool = $conn\->get_storage_pool_by_uuid($uuid)" 4 .el .IP "my \f(CW$pool\fR = \f(CW$conn\fR\->get_storage_pool_by_uuid($uuid)" 4 .IX Item "my $pool = $conn->get_storage_pool_by_uuid($uuid)" Return the storage pool with a globally unique id of \f(CW$uuid\fR. The returned object is an instance of the Sys::Virt::StoragePool class. .ie n .IP "my $pool = $conn\->get_storage_pool_by_volume($vol)" 4 .el .IP "my \f(CW$pool\fR = \f(CW$conn\fR\->get_storage_pool_by_volume($vol)" 4 .IX Item "my $pool = $conn->get_storage_pool_by_volume($vol)" Return the storage pool with a storage volume \f(CW$vol\fR. The \f(CW$vol\fR parameter must be an instance of the Sys::Virt::StorageVol class. The returned object is an instance of the Sys::Virt::StoragePool class. .ie n .IP "my $pool = $conn\->get_storage_pool_by_target_path($path)" 4 .el .IP "my \f(CW$pool\fR = \f(CW$conn\fR\->get_storage_pool_by_target_path($path)" 4 .IX Item "my $pool = $conn->get_storage_pool_by_target_path($path)" Return the storage pool with a target path of \f(CW$path\fR. The returned object is an instance of the Sys::Virt::StoragePool class. .ie n .IP "my $vol = $conn\->get_storage_volume_by_path($path)" 4 .el .IP "my \f(CW$vol\fR = \f(CW$conn\fR\->get_storage_volume_by_path($path)" 4 .IX Item "my $vol = $conn->get_storage_volume_by_path($path)" Return the storage volume with a location of \f(CW$path\fR. The returned object is an instance of the Sys::Virt::StorageVol class. .ie n .IP "my $vol = $conn\->get_storage_volume_by_key($key)" 4 .el .IP "my \f(CW$vol\fR = \f(CW$conn\fR\->get_storage_volume_by_key($key)" 4 .IX Item "my $vol = $conn->get_storage_volume_by_key($key)" Return the storage volume with a globally unique id of \f(CW$key\fR. The returned object is an instance of the Sys::Virt::StorageVol class. .ie n .IP "my $dev = $conn\->get_node_device_by_name($name)" 4 .el .IP "my \f(CW$dev\fR = \f(CW$conn\fR\->get_node_device_by_name($name)" 4 .IX Item "my $dev = $conn->get_node_device_by_name($name)" Return the node device with a name of \f(CW$name\fR. The returned object is an instance of the Sys::Virt::NodeDevice class. .ie n .IP "my $dev = $conn\->get_node_device_scsihost_by_wwn($wwnn, $wwpn, $flags=0)" 4 .el .IP "my \f(CW$dev\fR = \f(CW$conn\fR\->get_node_device_scsihost_by_wwn($wwnn, \f(CW$wwpn\fR, \f(CW$flags\fR=0)" 4 .IX Item "my $dev = $conn->get_node_device_scsihost_by_wwn($wwnn, $wwpn, $flags=0)" Return the node device which is a SCSI host identified by \f(CW$wwnn\fR and \f(CW$wwpn\fR. The \f(CW$flags\fR parameter is unused and defaults to zero. The returned object is an instance of the Sys::Virt::NodeDevice class. .ie n .IP "my $iface = $conn\->get_interface_by_name($name)" 4 .el .IP "my \f(CW$iface\fR = \f(CW$conn\fR\->get_interface_by_name($name)" 4 .IX Item "my $iface = $conn->get_interface_by_name($name)" Return the interface with a name of \f(CW$name\fR. The returned object is an instance of the Sys::Virt::Interface class. .ie n .IP "my $iface = $conn\->get_interface_by_mac($mac)" 4 .el .IP "my \f(CW$iface\fR = \f(CW$conn\fR\->get_interface_by_mac($mac)" 4 .IX Item "my $iface = $conn->get_interface_by_mac($mac)" Return the interface with a MAC address of \f(CW$mac\fR. The returned object is an instance of the Sys::Virt::Interface class. .ie n .IP "my $sec = $conn\->get_secret_by_uuid($uuid)" 4 .el .IP "my \f(CW$sec\fR = \f(CW$conn\fR\->get_secret_by_uuid($uuid)" 4 .IX Item "my $sec = $conn->get_secret_by_uuid($uuid)" Return the secret with a globally unique id of \f(CW$uuid\fR. The returned object is an instance of the Sys::Virt::Secret class. .ie n .IP "my $sec = $conn\->get_secret_by_usage($usageType, $usageID)" 4 .el .IP "my \f(CW$sec\fR = \f(CW$conn\fR\->get_secret_by_usage($usageType, \f(CW$usageID\fR)" 4 .IX Item "my $sec = $conn->get_secret_by_usage($usageType, $usageID)" Return the secret with a usage type of \f(CW$usageType\fR, identified by \f(CW$usageID\fR. The returned object is an instance of the Sys::Virt::Secret class. .ie n .IP "my $nwfilter = $conn\->get_nwfilter_by_name($name)" 4 .el .IP "my \f(CW$nwfilter\fR = \f(CW$conn\fR\->get_nwfilter_by_name($name)" 4 .IX Item "my $nwfilter = $conn->get_nwfilter_by_name($name)" Return the domain with a name of \f(CW$name\fR. The returned object is an instance of the Sys::Virt::NWFilter class. .ie n .IP "my $nwfilter = $conn\->get_nwfilter_by_uuid($uuid)" 4 .el .IP "my \f(CW$nwfilter\fR = \f(CW$conn\fR\->get_nwfilter_by_uuid($uuid)" 4 .IX Item "my $nwfilter = $conn->get_nwfilter_by_uuid($uuid)" Return the nwfilter with a globally unique id of \f(CW$uuid\fR. The returned object is an instance of the Sys::Virt::NWFilter class. .ie n .IP "my $binding = $conn\->get_nwfilter_binding_by_port_dev($name)" 4 .el .IP "my \f(CW$binding\fR = \f(CW$conn\fR\->get_nwfilter_binding_by_port_dev($name)" 4 .IX Item "my $binding = $conn->get_nwfilter_binding_by_port_dev($name)" Return the network filter binding for the port device \f(CW$name\fR. The returned object is an instance of the Sys::Virt::NWFilterBinding class. .ie n .IP "my $xml = $conn\->find_storage_pool_sources($type, $srcspec[, $flags])" 4 .el .IP "my \f(CW$xml\fR = \f(CW$conn\fR\->find_storage_pool_sources($type, \f(CW$srcspec\fR[, \f(CW$flags\fR])" 4 .IX Item "my $xml = $conn->find_storage_pool_sources($type, $srcspec[, $flags])" Probe for available storage pool sources for the pool of type \f(CW$type\fR. The \f(CW$srcspec\fR parameter can be \f(CW\*(C`undef\*(C'\fR, or a parameter to refine the discovery process, for example a server hostname for NFS discovery. The \&\f(CW$flags\fR parameter is optional, and if omitted defaults to zero. The returned scalar is an XML document describing the discovered storage pool sources. .ie n .IP "my @stats = $conn\->get_all_domain_stats($stats, \e@doms=undef, $flags=0);" 4 .el .IP "my \f(CW@stats\fR = \f(CW$conn\fR\->get_all_domain_stats($stats, \e@doms=undef, \f(CW$flags\fR=0);" 4 .IX Item "my @stats = $conn->get_all_domain_stats($stats, @doms=undef, $flags=0);" Get a list of all statistics for domains known to the hypervisor. The \f(CW$stats\fR parameter controls which data fields to return and should be a combination of the DOMAIN STATS FIELD CONSTANTS. .Sp The optional \f(CW@doms\fR parameter is a list of Sys::Virt::Domain objects to return stats for. If this is undefined, then all domains will be returned. The \f(CW$flags\fR method can be used to filter the list of returned domains. .Sp The return data for the method is a list, one element for each domain. The element will be a hash with two keys, \f(CW\*(C`dom\*(C'\fR pointing to an instance of \f(CW\*(C`Sys::Virt::Domain\*(C'\fR and \f(CW\*(C`data\*(C'\fR pointing to another hash reference containing the actual statistics. .ie n .IP $conn\->interface_change_begin($flags) 4 .el .IP \f(CW$conn\fR\->interface_change_begin($flags) 4 .IX Item "$conn->interface_change_begin($flags)" Begin a transaction for changing the configuration of one or more network interfaces .ie n .IP $conn\->interface_change_commit($flags) 4 .el .IP \f(CW$conn\fR\->interface_change_commit($flags) 4 .IX Item "$conn->interface_change_commit($flags)" Complete a transaction for changing the configuration of one or more network interfaces .ie n .IP $conn\->interface_change_rollback($flags) 4 .el .IP \f(CW$conn\fR\->interface_change_rollback($flags) 4 .IX Item "$conn->interface_change_rollback($flags)" Abort a transaction for changing the configuration of one or more network interfaces .ie n .IP "$conn\->restore_domain($savefile, $dxml=undef, $params=undef, $flags=0)" 4 .el .IP "\f(CW$conn\fR\->restore_domain($savefile, \f(CW$dxml\fR=undef, \f(CW$params\fR=undef, \f(CW$flags\fR=0)" 4 .IX Item "$conn->restore_domain($savefile, $dxml=undef, $params=undef, $flags=0)" Recreate a domain from the saved state file given in the \f(CW$savefile\fR parameter. The optional \f(CW$dxml\fR parameter can be used to alter portions of the domain XML. The \f(CW$params\fR parameter is a hash reference whose keys is a subset of the SAVE / RESTORE PARAMETER CONSTANTS. The \f(CW$flags\fR parameter accepts one of the SAVE / RESTORE FLAG CONSTANTS described later and defaults to zero. .ie n .IP $conn\->get_max_vcpus($domtype) 4 .el .IP \f(CW$conn\fR\->get_max_vcpus($domtype) 4 .IX Item "$conn->get_max_vcpus($domtype)" Return the maximum number of vcpus that can be configured for a domain of type \f(CW$domtype\fR .ie n .IP "my $hostname = $conn\->\fBget_hostname()\fR" 4 .el .IP "my \f(CW$hostname\fR = \f(CW$conn\fR\->\fBget_hostname()\fR" 4 .IX Item "my $hostname = $conn->get_hostname()" Return the name of the host with which this connection is associated. .ie n .IP "my $uri = $conn\->\fBget_uri()\fR" 4 .el .IP "my \f(CW$uri\fR = \f(CW$conn\fR\->\fBget_uri()\fR" 4 .IX Item "my $uri = $conn->get_uri()" Return the URI associated with the open connection. This may be different from the URI used when initially connecting to libvirt, when 'auto\-probing' or drivers occurs. .ie n .IP "my $xml = $conn\->\fBget_sysinfo()\fR" 4 .el .IP "my \f(CW$xml\fR = \f(CW$conn\fR\->\fBget_sysinfo()\fR" 4 .IX Item "my $xml = $conn->get_sysinfo()" Return an XML documenting representing the host system information, typically obtained from SMBIOS tables. .ie n .IP "my $type = $conn\->\fBget_type()\fR" 4 .el .IP "my \f(CW$type\fR = \f(CW$conn\fR\->\fBget_type()\fR" 4 .IX Item "my $type = $conn->get_type()" Return the type of virtualization backend accessed by this hypervisor object. Currently the only supported type is \f(CW\*(C`Xen\*(C'\fR. .ie n .IP "my $xml = $conn\->domain_xml_from_native($format, $config);" 4 .el .IP "my \f(CW$xml\fR = \f(CW$conn\fR\->domain_xml_from_native($format, \f(CW$config\fR);" 4 .IX Item "my $xml = $conn->domain_xml_from_native($format, $config);" Convert the native hypervisor configuration \f(CW$config\fR which is in format <$format> into libvirrt domain XML. Valid values of \f(CW$format\fR vary between hypervisor drivers. .ie n .IP "my $config = $conn\->domain_xml_to_native($format, $xml)" 4 .el .IP "my \f(CW$config\fR = \f(CW$conn\fR\->domain_xml_to_native($format, \f(CW$xml\fR)" 4 .IX Item "my $config = $conn->domain_xml_to_native($format, $xml)" Convert the libvirt domain XML configuration \f(CW$xml\fR to a native hypervisor configuration in format \f(CW$format\fR .ie n .IP "my $ver = $conn\->\fBget_version()\fR" 4 .el .IP "my \f(CW$ver\fR = \f(CW$conn\fR\->\fBget_version()\fR" 4 .IX Item "my $ver = $conn->get_version()" Return the complete version number as a string encoded in the formula \f(CW\*(C`(major * 1000000) + (minor * 1000) + micro\*(C'\fR. .ie n .IP "my $ver = $conn\->get_major_version" 4 .el .IP "my \f(CW$ver\fR = \f(CW$conn\fR\->get_major_version" 4 .IX Item "my $ver = $conn->get_major_version" Return the major version number of the libvirt library. .ie n .IP "my $ver = $conn\->get_minor_version" 4 .el .IP "my \f(CW$ver\fR = \f(CW$conn\fR\->get_minor_version" 4 .IX Item "my $ver = $conn->get_minor_version" Return the minor version number of the libvirt library. .ie n .IP "my $ver = $conn\->get_micro_version" 4 .el .IP "my \f(CW$ver\fR = \f(CW$conn\fR\->get_micro_version" 4 .IX Item "my $ver = $conn->get_micro_version" Return the micro version number of the libvirt library. .ie n .IP "my $ver = $conn\->get_library_version" 4 .el .IP "my \f(CW$ver\fR = \f(CW$conn\fR\->get_library_version" 4 .IX Item "my $ver = $conn->get_library_version" Return the version number of the API associated with the active connection. This differs from \f(CW\*(C`get_version\*(C'\fR in that if the connection is to a remote libvirtd daemon, it will return the API version of the remote libvirt, rather than the local client. .ie n .IP $conn\->\fBis_secure()\fR 4 .el .IP \f(CW$conn\fR\->\fBis_secure()\fR 4 .IX Item "$conn->is_secure()" Returns a true value if the current connection is secure against network interception. This implies either use of UNIX sockets, or encryption with a TCP stream. .ie n .IP $conn\->\fBis_encrypted()\fR 4 .el .IP \f(CW$conn\fR\->\fBis_encrypted()\fR 4 .IX Item "$conn->is_encrypted()" Returns a true value if the current connection data stream is encrypted. .ie n .IP $conn\->\fBis_alive()\fR 4 .el .IP \f(CW$conn\fR\->\fBis_alive()\fR 4 .IX Item "$conn->is_alive()" Returns a true value if the connection is alive, as determined by keep-alive packets or other recent RPC traffic. .ie n .IP "$conn\->set_keep_alive($interval, $count)" 4 .el .IP "\f(CW$conn\fR\->set_keep_alive($interval, \f(CW$count\fR)" 4 .IX Item "$conn->set_keep_alive($interval, $count)" Change the operation of the keep alive protocol to send \f(CW$count\fR packets spaced \f(CW$interval\fR seconds apart before considering the connection dead. .ie n .IP "my $info = $con\->\fBget_node_info()\fR" 4 .el .IP "my \f(CW$info\fR = \f(CW$con\fR\->\fBget_node_info()\fR" 4 .IX Item "my $info = $con->get_node_info()" Returns a hash reference summarising the capabilities of the host node. The elements of the hash are as follows: .RS 4 .IP memory 4 .IX Item "memory" The amount of physical memory in the host .IP model 4 .IX Item "model" The model of the CPU, eg x86_64 .IP cpus 4 .IX Item "cpus" The total number of logical CPUs. .IP mhz 4 .IX Item "mhz" The peak MHZ of the CPU .IP nodes 4 .IX Item "nodes" The number of NUMA cells .IP sockets 4 .IX Item "sockets" The number of CPU sockets .IP cores 4 .IX Item "cores" The number of cores per socket .IP threads 4 .IX Item "threads" The number of threads per core .RE .RS 4 .Sp NB, more accurate information about the total number of CPUs and those online can be obtained using the \f(CW\*(C`get_node_cpu_map\*(C'\fR method. .RE .ie n .IP "my ($totcpus, $onlinemap, $totonline) = $con\->\fBget_node_cpu_map()\fR;" 4 .el .IP "my ($totcpus, \f(CW$onlinemap\fR, \f(CW$totonline\fR) = \f(CW$con\fR\->\fBget_node_cpu_map()\fR;" 4 .IX Item "my ($totcpus, $onlinemap, $totonline) = $con->get_node_cpu_map();" Returns an array containing information about the CPUs available on the host. The first element, \f(CW\*(C`totcpus\*(C'\fR, specifies the total number of CPUs available to the host regardless of their online stat. The second element, \f(CW\*(C`onlinemap\*(C'\fR, provides a bitmap detailing which CPUs are currently online. The third element, \f(CW\*(C`totonline\*(C'\fR, specifies the total number of online CPUs. The values in the bitmap can be extracted using the \f(CW\*(C`unpack\*(C'\fR method as follows: .Sp .Vb 1 \& my @onlinemap = split(//, unpack("b*", $onlinemap)); .Ve .ie n .IP "my $info = $con\->get_node_cpu_stats($cpuNum=\-1, $flags=0)" 4 .el .IP "my \f(CW$info\fR = \f(CW$con\fR\->get_node_cpu_stats($cpuNum=\-1, \f(CW$flags\fR=0)" 4 .IX Item "my $info = $con->get_node_cpu_stats($cpuNum=-1, $flags=0)" Returns a hash reference providing information about the host CPU statistics. If <$cpuNum> is omitted, it defaults to \f(CW\*(C`Sys::Virt::NODE_CPU_STATS_ALL_CPUS\*(C'\fR which causes it to return cumulative information for all CPUs in the host. If \f(CW$cpuNum\fR is zero or larger, it returns information just for the specified number. The \f(CW$flags\fR parameter is currently unused and defaults to zero. The fields in the returned hash reference are .RS 4 .IP kernel 4 .IX Item "kernel" The time spent in kernelspace .IP user 4 .IX Item "user" The time spent in userspace .IP idle 4 .IX Item "idle" The idle time .IP iowait 4 .IX Item "iowait" The I/O wait time .IP utilization 4 .IX Item "utilization" The overall percentage utilization. .RE .RS 4 .RE .ie n .IP "my $info = $con\->get_node_memory_stats($cellNum=\-1, $flags=0)" 4 .el .IP "my \f(CW$info\fR = \f(CW$con\fR\->get_node_memory_stats($cellNum=\-1, \f(CW$flags\fR=0)" 4 .IX Item "my $info = $con->get_node_memory_stats($cellNum=-1, $flags=0)" Returns a hash reference providing information about the host memory statistics. If <$cellNum> is omitted, it defaults to \f(CW\*(C`Sys::Virt::NODE_MEMORY_STATS_ALL_CELLS\*(C'\fR which causes it to return cumulative information for all NUMA cells in the host. If \f(CW$cellNum\fR is zero or larger, it returns information just for the specified number. The \f(CW$flags\fR parameter is currently unused and defaults to zero. The fields in the returned hash reference are .RS 4 .IP total 4 .IX Item "total" The total memory .IP free 4 .IX Item "free" The free memory .IP buffers 4 .IX Item "buffers" The memory consumed by buffers .IP cached 4 .IX Item "cached" The memory consumed for cache .RE .RS 4 .RE .ie n .IP "my $params = $conn\->get_node_memory_parameters($flags=0)" 4 .el .IP "my \f(CW$params\fR = \f(CW$conn\fR\->get_node_memory_parameters($flags=0)" 4 .IX Item "my $params = $conn->get_node_memory_parameters($flags=0)" Return a hash reference containing the set of memory tunable parameters for the node. The keys in the hash are one of the constants MEMORY PARAMETERS described later. The \f(CW$flags\fR parameter is currently unused, and defaults to 0 if omitted. .ie n .IP "$conn\->set_node_memory_parameters($params, $flags=0)" 4 .el .IP "\f(CW$conn\fR\->set_node_memory_parameters($params, \f(CW$flags\fR=0)" 4 .IX Item "$conn->set_node_memory_parameters($params, $flags=0)" Update the memory tunable parameters for the node. The \&\f(CW$params\fR should be a hash reference whose keys are one of the MEMORY PARAMETERS constants. The \f(CW$flags\fR parameter is currently unused, and defaults to 0 if omitted. .ie n .IP "$info = $conn\->get_node_sev_info($flags=0)" 4 .el .IP "\f(CW$info\fR = \f(CW$conn\fR\->get_node_sev_info($flags=0)" 4 .IX Item "$info = $conn->get_node_sev_info($flags=0)" Get the AMD SEV information for the host. \f(CW$flags\fR is currently unused and defaults to 0 if omitted. The returned hash contains the following keys: .RS 4 .IP Sys::Virt::SEV_CBITPOS 4 .IX Item "Sys::Virt::SEV_CBITPOS" The CBit position .IP Sys::Virt::SEV_CERT_CHAIN 4 .IX Item "Sys::Virt::SEV_CERT_CHAIN" The certificate chain .IP Sys::Virt::SEV_PDH 4 .IX Item "Sys::Virt::SEV_PDH" Platform diffie-hellman key .IP Sys::Virt::SEV_REDUCED_PHYS_BITS 4 .IX Item "Sys::Virt::SEV_REDUCED_PHYS_BITS" The number of physical address bits used by SEV .IP Sys::Virt::SEV_MAX_GUESTS 4 .IX Item "Sys::Virt::SEV_MAX_GUESTS" Maximum number of SEV guests that can be launched .IP Sys::Virt::SEV_MAX_ES_GUESTS 4 .IX Item "Sys::Virt::SEV_MAX_ES_GUESTS" Maximum number of SEV-ES guests that can be launched .IP Sys::Virt::SEV_CPU0_ID 4 .IX Item "Sys::Virt::SEV_CPU0_ID" The SEV firmware ID for CPU 0 .RE .RS 4 .RE .ie n .IP "$conn\->node_suspend_for_duration($target, $duration, $flags=0)" 4 .el .IP "\f(CW$conn\fR\->node_suspend_for_duration($target, \f(CW$duration\fR, \f(CW$flags\fR=0)" 4 .IX Item "$conn->node_suspend_for_duration($target, $duration, $flags=0)" Suspend the the host, using mode \f(CW$target\fR which is one of the NODE SUSPEND constants listed later. The \f(CW$duration\fR parameter controls how long the node is suspended for before waking up. .ie n .IP $conn\->domain_event_register($callback) 4 .el .IP \f(CW$conn\fR\->domain_event_register($callback) 4 .IX Item "$conn->domain_event_register($callback)" Register a callback to received notifications of domain state change events. Only a single callback can be registered with each connection instance. The callback will be invoked with four parameters, an instance of \f(CW\*(C`Sys::Virt\*(C'\fR for the connection, an instance of \f(CW\*(C`Sys::Virt::Domain\*(C'\fR for the domain changing state, and a \f(CW\*(C`event\*(C'\fR and \f(CW\*(C`detail\*(C'\fR arguments, corresponding to the event constants defined in the \f(CW\*(C`Sys::Virt::Domain\*(C'\fR module. Before discarding the connection object, the callback must be deregistered, otherwise the connection object memory will never be released in garbage collection. .ie n .IP $conn\->\fBdomain_event_deregister()\fR 4 .el .IP \f(CW$conn\fR\->\fBdomain_event_deregister()\fR 4 .IX Item "$conn->domain_event_deregister()" Unregister a callback, allowing the connection object to be garbage collected. .ie n .IP "$callbackID = $conn\->domain_event_register_any($dom, $eventID, $callback)" 4 .el .IP "\f(CW$callbackID\fR = \f(CW$conn\fR\->domain_event_register_any($dom, \f(CW$eventID\fR, \f(CW$callback\fR)" 4 .IX Item "$callbackID = $conn->domain_event_register_any($dom, $eventID, $callback)" Register a callback to received notifications of domain events. The \f(CW$dom\fR parameter can be \f(CW\*(C`undef\*(C'\fR to request events on all known domains, or a specific \f(CW\*(C`Sys::Virt::Domain\*(C'\fR object to filter events. The \f(CW$eventID\fR parameter is one of the EVENT ID constants described later in this document. The \f(CW$callback\fR is a subroutine reference that will receive the events. .Sp All callbacks receive a \f(CW\*(C`Sys::Virt\*(C'\fR connection as the first parameter and a \f(CW\*(C`Sys::Virt::Domain\*(C'\fR object indicating the domain on which the event occurred as the second parameter. Subsequent parameters vary according to the event type .RS 4 .IP EVENT_ID_LIFECYCLE 4 .IX Item "EVENT_ID_LIFECYCLE" Extra \f(CW\*(C`event\*(C'\fR and \f(CW\*(C`detail\*(C'\fR parameters defining the lifecycle transition that occurred. .IP EVENT_ID_REBOOT 4 .IX Item "EVENT_ID_REBOOT" No extra parameters .IP EVENT_ID_RTC_CHANGE 4 .IX Item "EVENT_ID_RTC_CHANGE" The \f(CW\*(C`utcoffset\*(C'\fR gives the offset from UTC in seconds .IP EVENT_ID_WATCHDOG 4 .IX Item "EVENT_ID_WATCHDOG" The \f(CW\*(C`action\*(C'\fR defines the action that is taken as a result of the watchdog triggering. One of the WATCHDOG constants described later .IP EVENT_ID_IO_ERROR 4 .IX Item "EVENT_ID_IO_ERROR" The \f(CW\*(C`srcPath\*(C'\fR is the file on the host which had the error. The \f(CW\*(C`devAlias\*(C'\fR is the unique device alias from the guest configuration associated with \f(CW\*(C`srcPath\*(C'\fR. The \f(CW\*(C`action\*(C'\fR is the action taken as a result of the error, one of the IO ERROR constants described later .IP EVENT_ID_GRAPHICS 4 .IX Item "EVENT_ID_GRAPHICS" The \f(CW\*(C`phase\*(C'\fR is the stage of the connection, one of the GRAPHICS PHASE constants described later. The \f(CW\*(C`local\*(C'\fR and \f(CW\*(C`remote\*(C'\fR parameters follow with the details of the local and remote network addresses. The \f(CW\*(C`authScheme\*(C'\fR describes how the user was authenticated (if at all). Finally \f(CW\*(C`identities\*(C'\fR is an array ref containing authenticated identities for the user, if any. .RE .RS 4 .Sp The return value is a unique callback ID that must be used when unregistering the event. .RE .ie n .IP $conn\->domain_event_deregister_any($callbackID) 4 .el .IP \f(CW$conn\fR\->domain_event_deregister_any($callbackID) 4 .IX Item "$conn->domain_event_deregister_any($callbackID)" Unregister a callback, associated with the \f(CW$callbackID\fR previously obtained from \f(CW\*(C`domain_event_register_any\*(C'\fR. .ie n .IP "$callbackID = $conn\->network_event_register_any($net, $eventID, $callback)" 4 .el .IP "\f(CW$callbackID\fR = \f(CW$conn\fR\->network_event_register_any($net, \f(CW$eventID\fR, \f(CW$callback\fR)" 4 .IX Item "$callbackID = $conn->network_event_register_any($net, $eventID, $callback)" Register a callback to received notifications of network events. The \f(CW$net\fR parameter can be \f(CW\*(C`undef\*(C'\fR to request events on all known networks, or a specific \f(CW\*(C`Sys::Virt::Network\*(C'\fR object to filter events. The \f(CW$eventID\fR parameter is one of the EVENT ID constants described later in this document. The \f(CW$callback\fR is a subroutine reference that will receive the events. .Sp All callbacks receive a \f(CW\*(C`Sys::Virt\*(C'\fR connection as the first parameter and a \f(CW\*(C`Sys::Virt::Network\*(C'\fR object indicating the network on which the event occurred as the second parameter. Subsequent parameters vary according to the event type .RS 4 .IP EVENT_ID_LIFECYCLE 4 .IX Item "EVENT_ID_LIFECYCLE" Extra \f(CW\*(C`event\*(C'\fR and \f(CW\*(C`detail\*(C'\fR parameters defining the lifecycle transition that occurred. .RE .RS 4 .Sp The return value is a unique callback ID that must be used when unregistering the event. .RE .ie n .IP $conn\->network_event_deregister_any($callbackID) 4 .el .IP \f(CW$conn\fR\->network_event_deregister_any($callbackID) 4 .IX Item "$conn->network_event_deregister_any($callbackID)" Unregister a callback, associated with the \f(CW$callbackID\fR previously obtained from \f(CW\*(C`network_event_register_any\*(C'\fR. .ie n .IP "$callbackID = $conn\->storage_pool_event_register_any($pool, $eventID, $callback)" 4 .el .IP "\f(CW$callbackID\fR = \f(CW$conn\fR\->storage_pool_event_register_any($pool, \f(CW$eventID\fR, \f(CW$callback\fR)" 4 .IX Item "$callbackID = $conn->storage_pool_event_register_any($pool, $eventID, $callback)" Register a callback to received notifications of storage pool events. The \f(CW$pool\fR parameter can be \f(CW\*(C`undef\*(C'\fR to request events on all known storage pools, or a specific \f(CW\*(C`Sys::Virt::StoragePool\*(C'\fR object to filter events. The \f(CW$eventID\fR parameter is one of the EVENT ID constants described later in this document. The \f(CW$callback\fR is a subroutine reference that will receive the events. .Sp All callbacks receive a \f(CW\*(C`Sys::Virt\*(C'\fR connection as the first parameter and a \f(CW\*(C`Sys::Virt::StoragePool\*(C'\fR object indicating the storage pool on which the event occurred as the second parameter. Subsequent parameters vary according to the event type .RS 4 .IP EVENT_ID_LIFECYCLE 4 .IX Item "EVENT_ID_LIFECYCLE" Extra \f(CW\*(C`event\*(C'\fR and \f(CW\*(C`detail\*(C'\fR parameters defining the lifecycle transition that occurred. .IP EVENT_ID_REFRESH 4 .IX Item "EVENT_ID_REFRESH" No extra parameters. .RE .RS 4 .Sp The return value is a unique callback ID that must be used when unregistering the event. .RE .ie n .IP $conn\->storage_pool_event_deregister_any($callbackID) 4 .el .IP \f(CW$conn\fR\->storage_pool_event_deregister_any($callbackID) 4 .IX Item "$conn->storage_pool_event_deregister_any($callbackID)" Unregister a callback, associated with the \f(CW$callbackID\fR previously obtained from \f(CW\*(C`storage_pool_event_register_any\*(C'\fR. .ie n .IP "$callbackID = $conn\->node_device_event_register_any($dev, $eventID, $callback)" 4 .el .IP "\f(CW$callbackID\fR = \f(CW$conn\fR\->node_device_event_register_any($dev, \f(CW$eventID\fR, \f(CW$callback\fR)" 4 .IX Item "$callbackID = $conn->node_device_event_register_any($dev, $eventID, $callback)" Register a callback to received notifications of node device events. The \f(CW$dev\fR parameter can be \f(CW\*(C`undef\*(C'\fR to request events on all known node devices, or a specific \f(CW\*(C`Sys::Virt::NodeDevice\*(C'\fR object to filter events. The \f(CW$eventID\fR parameter is one of the EVENT ID constants described later in this document. The \f(CW$callback\fR is a subroutine reference that will receive the events. .Sp All callbacks receive a \f(CW\*(C`Sys::Virt\*(C'\fR connection as the first parameter and a \f(CW\*(C`Sys::Virt::NodeDevice\*(C'\fR object indicating the node device on which the event occurred as the second parameter. Subsequent parameters vary according to the event type .RS 4 .IP EVENT_ID_LIFECYCLE 4 .IX Item "EVENT_ID_LIFECYCLE" Extra \f(CW\*(C`event\*(C'\fR and \f(CW\*(C`detail\*(C'\fR parameters defining the lifecycle transition that occurred. .RE .RS 4 .Sp The return value is a unique callback ID that must be used when unregistering the event. .RE .ie n .IP $conn\->node_device_event_deregister_any($callbackID) 4 .el .IP \f(CW$conn\fR\->node_device_event_deregister_any($callbackID) 4 .IX Item "$conn->node_device_event_deregister_any($callbackID)" Unregister a callback, associated with the \f(CW$callbackID\fR previously obtained from \f(CW\*(C`node_device_event_register_any\*(C'\fR. .ie n .IP "$callbackID = $conn\->secret_event_register_any($secret, $eventID, $callback)" 4 .el .IP "\f(CW$callbackID\fR = \f(CW$conn\fR\->secret_event_register_any($secret, \f(CW$eventID\fR, \f(CW$callback\fR)" 4 .IX Item "$callbackID = $conn->secret_event_register_any($secret, $eventID, $callback)" Register a callback to received notifications of secret events. The \f(CW$secret\fR parameter can be \f(CW\*(C`undef\*(C'\fR to request events on all known secrets, or a specific \f(CW\*(C`Sys::Virt::Secret\*(C'\fR object to filter events. The \f(CW$eventID\fR parameter is one of the EVENT ID constants described later in this document. The \f(CW$callback\fR is a subroutine reference that will receive the events. .Sp All callbacks receive a \f(CW\*(C`Sys::Virt\*(C'\fR connection as the first parameter and a \f(CW\*(C`Sys::Virt::Secret\*(C'\fR object indicating the secret on which the event occurred as the second parameter. Subsequent parameters vary according to the event type .RS 4 .IP EVENT_ID_LIFECYCLE 4 .IX Item "EVENT_ID_LIFECYCLE" Extra \f(CW\*(C`event\*(C'\fR and \f(CW\*(C`detail\*(C'\fR parameters defining the lifecycle transition that occurred. .IP EVENT_ID_VALUE_CHANGED 4 .IX Item "EVENT_ID_VALUE_CHANGED" No extra parameters. .RE .RS 4 .Sp The return value is a unique callback ID that must be used when unregistering the event. .RE .ie n .IP $conn\->secret_event_deregister_any($callbackID) 4 .el .IP \f(CW$conn\fR\->secret_event_deregister_any($callbackID) 4 .IX Item "$conn->secret_event_deregister_any($callbackID)" Unregister a callback, associated with the \f(CW$callbackID\fR previously obtained from \f(CW\*(C`secret_event_register_any\*(C'\fR. .ie n .IP $conn\->register_close_callback($coderef); 4 .el .IP \f(CW$conn\fR\->register_close_callback($coderef); 4 .IX Item "$conn->register_close_callback($coderef);" Register a callback to be invoked when the connection is closed. The callback will be invoked with two parameters, the \f(CW$conn\fR it was registered against, and the reason for the close event. The reason value will be one of the \f(CW\*(C`CLOSE REASON CONSTANTS\*(C'\fR listed later in this document. .ie n .IP $conn\->\fBunregister_close_callback()\fR; 4 .el .IP \f(CW$conn\fR\->\fBunregister_close_callback()\fR; 4 .IX Item "$conn->unregister_close_callback();" Remove the previously registered close callback. .ie n .IP "my $xml = $con\->baseline_cpu(\e@xml, $flags=0)" 4 .el .IP "my \f(CW$xml\fR = \f(CW$con\fR\->baseline_cpu(\e@xml, \f(CW$flags\fR=0)" 4 .IX Item "my $xml = $con->baseline_cpu(@xml, $flags=0)" Given an array ref whose elements are XML documents describing host CPUs, compute the baseline CPU model that is operable across all hosts. The XML for the baseline CPU model is returned. The optional \f(CW$flags\fR parameter can take one of .RS 4 .IP Sys::Virt::BASELINE_CPU_EXPAND_FEATURES 4 .IX Item "Sys::Virt::BASELINE_CPU_EXPAND_FEATURES" Expand the CPU definition to list all feature flags, even those implied by the model name. .IP Sys::Virt::BASELINE_CPU_MIGRATABLE 4 .IX Item "Sys::Virt::BASELINE_CPU_MIGRATABLE" Only include features which can be live migrated. .RE .RS 4 .RE .ie n .IP "my $xml = $con\->baseline_hypervisor_cpu($emulator, $arch, $machine, $virttype, \e@xml, $flags=0)" 4 .el .IP "my \f(CW$xml\fR = \f(CW$con\fR\->baseline_hypervisor_cpu($emulator, \f(CW$arch\fR, \f(CW$machine\fR, \f(CW$virttype\fR, \e@xml, \f(CW$flags\fR=0)" 4 .IX Item "my $xml = $con->baseline_hypervisor_cpu($emulator, $arch, $machine, $virttype, @xml, $flags=0)" Given an array ref whose elements are XML documents describing host CPUs, compute the baseline CPU model that is operable across all hosts. The XML for the baseline CPU model is returned. Either \f(CW$emulator\fR or \f(CW$arch\fR must be a valid string referring to an emulator binary or an architecture name respectively. The \f(CW$machine\fR parameter is an optional name of a guest machine, and \f(CW$virttype\fR is an optional name of the virtualization type. The optional \f(CW$flags\fR parameter accepts the same values as \f(CW\*(C`baseline_cpu\*(C'\fR. .ie n .IP "@names = $con\->get_cpu_model_names($arch, $flags=0)" 4 .el .IP "\f(CW@names\fR = \f(CW$con\fR\->get_cpu_model_names($arch, \f(CW$flags\fR=0)" 4 .IX Item "@names = $con->get_cpu_model_names($arch, $flags=0)" Get a list of valid CPU models names for the architecture given by \f(CW$arch\fR. The \f(CW$arch\fR value should be one of the architectures listed in the capabilities XML document. The \f(CW$flags\fR parameter is currently unused and defaults to 0. .ie n .IP "my $info = $con\->\fBget_node_security_model()\fR" 4 .el .IP "my \f(CW$info\fR = \f(CW$con\fR\->\fBget_node_security_model()\fR" 4 .IX Item "my $info = $con->get_node_security_model()" Returns a hash reference summarising the security model of the host node. There are two keys in the hash, \f(CW\*(C`model\*(C'\fR specifying the name of the security model (eg 'selinux') and \f(CW\*(C`doi\*(C'\fR specifying the 'domain of interpretation' for security labels. .ie n .IP "my $xml = $con\->\fBget_capabilities()\fR;" 4 .el .IP "my \f(CW$xml\fR = \f(CW$con\fR\->\fBget_capabilities()\fR;" 4 .IX Item "my $xml = $con->get_capabilities();" Returns an XML document describing the hypervisor capabilities .ie n .IP "my $xml = $con\->get_domain_capabilities($emulator, $arch, $machine, $virttype, flags=0);" 4 .el .IP "my \f(CW$xml\fR = \f(CW$con\fR\->get_domain_capabilities($emulator, \f(CW$arch\fR, \f(CW$machine\fR, \f(CW$virttype\fR, flags=0);" 4 .IX Item "my $xml = $con->get_domain_capabilities($emulator, $arch, $machine, $virttype, flags=0);" Returns an XML document describing the capabilities of the requested guest configuration. Either \f(CW$emulator\fR or \f(CW$arch\fR must be a valid string referring to an emulator binary or an architecture name respectively. The \f(CW$machine\fR parameter is an optional name of a guest machine, and \f(CW$virttype\fR is an optional name of the virtualization type. \f(CW$flags\fR is unused and defaults to zero. .ie n .IP "my $xml = $con\->get_storage_pool_capabilities($flags=0);" 4 .el .IP "my \f(CW$xml\fR = \f(CW$con\fR\->get_storage_pool_capabilities($flags=0);" 4 .IX Item "my $xml = $con->get_storage_pool_capabilities($flags=0);" Returns an XML document describing the storage pool driver capabilities (e.g. which storage pool types are supported and so on). \f(CW$flags\fR is currently unused and defaults to zero. .ie n .IP "my $result = $con\->compare_cpu($xml, $flags=0);" 4 .el .IP "my \f(CW$result\fR = \f(CW$con\fR\->compare_cpu($xml, \f(CW$flags\fR=0);" 4 .IX Item "my $result = $con->compare_cpu($xml, $flags=0);" Checks whether the CPU definition in \f(CW$xml\fR is compatible with the current hypervisor connection. This can be used to determine whether it is safe to migrate a guest to this host. The returned result is one of the constants listed later The optional \f(CW$flags\fR parameter can take one of the following constants .RS 4 .IP Sys::Virt::COMPARE_CPU_FAIL_INCOMPATIBLE 4 .IX Item "Sys::Virt::COMPARE_CPU_FAIL_INCOMPATIBLE" Raise a fatal error if the CPUs are not compatible, instead of just returning a special error code. .IP Sys::Virt::COMPARE_CPU_VALIDATE_XML 4 .IX Item "Sys::Virt::COMPARE_CPU_VALIDATE_XML" Validate input XML document against the RNG schema. .RE .RS 4 .RE .ie n .IP "my $result = $con\->compare_hypervisor_cpu($emulator, $arch, $machine, $virttype, $xml, $flags=0);" 4 .el .IP "my \f(CW$result\fR = \f(CW$con\fR\->compare_hypervisor_cpu($emulator, \f(CW$arch\fR, \f(CW$machine\fR, \f(CW$virttype\fR, \f(CW$xml\fR, \f(CW$flags\fR=0);" 4 .IX Item "my $result = $con->compare_hypervisor_cpu($emulator, $arch, $machine, $virttype, $xml, $flags=0);" Checks whether the CPU definition in \f(CW$xml\fR is compatible with the current hypervisor connection. This can be used to determine whether it is safe to migrate a guest to this host. Either \f(CW$emulator\fR or \f(CW$arch\fR must be a valid string referring to an emulator binary or an architecture name respectively. The \f(CW$machine\fR parameter is an optional name of a guest machine, and \f(CW$virttype\fR is an optional name of the virtualization type. The returned result is one of the constants listed later The optional \f(CW$flags\fR parameter can take the same values as the \f(CW\*(C`compare_cpu\*(C'\fR method. .ie n .IP "$mem = $con\->\fBget_node_free_memory()\fR;" 4 .el .IP "\f(CW$mem\fR = \f(CW$con\fR\->\fBget_node_free_memory()\fR;" 4 .IX Item "$mem = $con->get_node_free_memory();" Returns the current free memory on the host .ie n .IP "@mem = $con\->get_node_cells_free_memory($start, $end);" 4 .el .IP "\f(CW@mem\fR = \f(CW$con\fR\->get_node_cells_free_memory($start, \f(CW$end\fR);" 4 .IX Item "@mem = $con->get_node_cells_free_memory($start, $end);" Returns the free memory on each NUMA cell between \f(CW$start\fR and \f(CW$end\fR. .ie n .IP "@pages = $con\->get_node_free_pages(\e@pagesizes, $start, $end);" 4 .el .IP "\f(CW@pages\fR = \f(CW$con\fR\->get_node_free_pages(\e@pagesizes, \f(CW$start\fR, \f(CW$end\fR);" 4 .IX Item "@pages = $con->get_node_free_pages(@pagesizes, $start, $end);" Returns information about the number of pages free on each NUMA cell between \f(CW$start\fR and \f(CW$end\fR inclusive. The \f(CW@pagesizes\fR parameter should be an arrayref specifying which pages sizes information should be returned for. Information about supported page sizes is available in the capabilities XML. The returned array has an element for each NUMA cell requested. The elements are hash references with two keys, \&'cell' specifies the NUMA cell number and 'pages' specifies the free page information for that cell. The 'pages' value is another hash reference where the keys are the page sizes and the values are the free count for that size. .ie n .IP "$con\->node_alloc_pages(\e@pages, $start, $end, $flags=0)" 4 .el .IP "\f(CW$con\fR\->node_alloc_pages(\e@pages, \f(CW$start\fR, \f(CW$end\fR, \f(CW$flags\fR=0)" 4 .IX Item "$con->node_alloc_pages(@pages, $start, $end, $flags=0)" Allocate further huge pages for the reserved dev. The <\e@pages> parameter is an array reference with one entry per page size to allocate for. Each entry is a further array reference where the first element is the page size and the second element is the page count. The same number of pages will be allocated on each NUMA node in the range \f(CW$start\fR to \f(CW$end\fR inclusive. The \&\f(CW$flags\fR parameter accepts two constants .RS 4 .IP Sys::Virt::NODE_ALLOC_PAGES_ADD 4 .IX Item "Sys::Virt::NODE_ALLOC_PAGES_ADD" The requested number of pages will be added to the existing huge page reservation. .IP Sys::Virt::NODE_ALLOC_PAGES_SET 4 .IX Item "Sys::Virt::NODE_ALLOC_PAGES_SET" The huge page reservation will be set to exactly the requested number .RE .RS 4 .RE .SH CONSTANTS .IX Header "CONSTANTS" The following sets of constants are useful when dealing with APIs in this package .SS CONNECTION .IX Subsection "CONNECTION" When opening a connection the following constants can be used: .IP Sys::Virt::CONNECT_RO 4 .IX Item "Sys::Virt::CONNECT_RO" Request a read-only connection .IP Sys::Virt::CONNECT_NO_ALIASES 4 .IX Item "Sys::Virt::CONNECT_NO_ALIASES" Prevent the resolution of URI aliases .SS "CREDENTIAL TYPES" .IX Subsection "CREDENTIAL TYPES" When providing authentication callbacks, the following constants indicate the type of credential being requested .IP Sys::Virt::CRED_AUTHNAME 4 .IX Item "Sys::Virt::CRED_AUTHNAME" Identity to act as .IP Sys::Virt::CRED_USERNAME 4 .IX Item "Sys::Virt::CRED_USERNAME" Identity to authorize as .IP Sys::Virt::CRED_CNONCE 4 .IX Item "Sys::Virt::CRED_CNONCE" Client supplies a nonce .IP Sys::Virt::CRED_REALM 4 .IX Item "Sys::Virt::CRED_REALM" Authentication realm .IP Sys::Virt::CRED_ECHOPROMPT 4 .IX Item "Sys::Virt::CRED_ECHOPROMPT" Challenge response non-secret .IP Sys::Virt::CRED_NOECHOPROMPT 4 .IX Item "Sys::Virt::CRED_NOECHOPROMPT" Challenge response secret .IP Sys::Virt::CRED_PASSPHRASE 4 .IX Item "Sys::Virt::CRED_PASSPHRASE" Passphrase secret .IP Sys::Virt::CRED_LANGUAGE 4 .IX Item "Sys::Virt::CRED_LANGUAGE" RFC 1766 language code .IP Sys::Virt::CRED_EXTERNAL 4 .IX Item "Sys::Virt::CRED_EXTERNAL" Externally provided credential .SS "IDENTITY CONSTANTS" .IX Subsection "IDENTITY CONSTANTS" The following constants are useful to change the connection identity .IP Sys::Virt::IDENTITY_USER_NAME 4 .IX Item "Sys::Virt::IDENTITY_USER_NAME" The process user name .IP Sys::Virt::IDENTITY_UNIX_USER_ID 4 .IX Item "Sys::Virt::IDENTITY_UNIX_USER_ID" The process UNIX user ID .IP Sys::Virt::IDENTITY_GROUP_NAME 4 .IX Item "Sys::Virt::IDENTITY_GROUP_NAME" The process group name .IP Sys::Virt::IDENTITY_UNIX_GROUP_ID 4 .IX Item "Sys::Virt::IDENTITY_UNIX_GROUP_ID" The process UNIX group ID .IP Sys::Virt::IDENTITY_PROCESS_ID 4 .IX Item "Sys::Virt::IDENTITY_PROCESS_ID" The process ID. .IP Sys::Virt::IDENTITY_PROCESS_TIME 4 .IX Item "Sys::Virt::IDENTITY_PROCESS_TIME" The process start time. .IP Sys::Virt::IDENTITY_SASL_USER_NAME 4 .IX Item "Sys::Virt::IDENTITY_SASL_USER_NAME" The SASL authenticated user name .IP Sys::Virt::IDENTITY_X509_DISTINGUISHED_NAME 4 .IX Item "Sys::Virt::IDENTITY_X509_DISTINGUISHED_NAME" The X509 certificate distinguished name for the TLS connection .IP Sys::Virt::IDENTITY_SELINUX_CONTEXT 4 .IX Item "Sys::Virt::IDENTITY_SELINUX_CONTEXT" The SELinux process context .SS "CPU COMPARISON CONSTANTS" .IX Subsection "CPU COMPARISON CONSTANTS" .IP Sys::Virt::CPU_COMPARE_INCOMPATIBLE 4 .IX Item "Sys::Virt::CPU_COMPARE_INCOMPATIBLE" This host is missing one or more CPU features in the CPU description .IP Sys::Virt::CPU_COMPARE_IDENTICAL 4 .IX Item "Sys::Virt::CPU_COMPARE_IDENTICAL" The host has an identical CPU description .IP Sys::Virt::CPU_COMPARE_SUPERSET 4 .IX Item "Sys::Virt::CPU_COMPARE_SUPERSET" The host offers a superset of the CPU descriptoon .SS "NODE SUSPEND CONSTANTS" .IX Subsection "NODE SUSPEND CONSTANTS" .IP Sys::Virt::NODE_SUSPEND_TARGET_MEM 4 .IX Item "Sys::Virt::NODE_SUSPEND_TARGET_MEM" Suspends to memory (equivalent of S3 on x86 architectures) .IP Sys::Virt::NODE_SUSPEND_TARGET_DISK 4 .IX Item "Sys::Virt::NODE_SUSPEND_TARGET_DISK" Suspends to disk (equivalent of S5 on x86 architectures) .IP Sys::Virt::NODE_SUSPEND_TARGET_HYBRID 4 .IX Item "Sys::Virt::NODE_SUSPEND_TARGET_HYBRID" Suspends to memory and disk (equivalent of S3+S5 on x86 architectures) .SS "NODE VCPU CONSTANTS" .IX Subsection "NODE VCPU CONSTANTS" .IP Sys::Virt::NODE_CPU_STATS_ALL_CPUS 4 .IX Item "Sys::Virt::NODE_CPU_STATS_ALL_CPUS" Request statistics for all CPUs .SS "NODE MEMORY CONSTANTS" .IX Subsection "NODE MEMORY CONSTANTS" .IP Sys::Virt::NODE_MEMORY_STATS_ALL_CELLS 4 .IX Item "Sys::Virt::NODE_MEMORY_STATS_ALL_CELLS" Request statistics for all memory cells .SS "MEMORY PARAMETERS" .IX Subsection "MEMORY PARAMETERS" The following constants are used to name memory parameters of the node .IP Sys::Virt::NODE_MEMORY_SHARED_FULL_SCANS 4 .IX Item "Sys::Virt::NODE_MEMORY_SHARED_FULL_SCANS" How many times all mergeable areas have been scanned. .IP Sys::Virt::NODE_MEMORY_SHARED_PAGES_SHARED 4 .IX Item "Sys::Virt::NODE_MEMORY_SHARED_PAGES_SHARED" How many the shared memory pages are being used. .IP Sys::Virt::NODE_MEMORY_SHARED_PAGES_SHARING 4 .IX Item "Sys::Virt::NODE_MEMORY_SHARED_PAGES_SHARING" How many sites are sharing the pages .IP Sys::Virt::NODE_MEMORY_SHARED_PAGES_TO_SCAN 4 .IX Item "Sys::Virt::NODE_MEMORY_SHARED_PAGES_TO_SCAN" How many present pages to scan before the shared memory service goes to sleep .IP Sys::Virt::NODE_MEMORY_SHARED_PAGES_UNSHARED 4 .IX Item "Sys::Virt::NODE_MEMORY_SHARED_PAGES_UNSHARED" How many pages unique but repeatedly checked for merging. .IP Sys::Virt::NODE_MEMORY_SHARED_PAGES_VOLATILE 4 .IX Item "Sys::Virt::NODE_MEMORY_SHARED_PAGES_VOLATILE" How many pages changing too fast to be placed in a tree. .IP Sys::Virt::NODE_MEMORY_SHARED_SLEEP_MILLISECS 4 .IX Item "Sys::Virt::NODE_MEMORY_SHARED_SLEEP_MILLISECS" How many milliseconds the shared memory service should sleep before next scan. .IP Sys::Virt::NODE_MEMORY_SHARED_MERGE_ACROSS_NODES 4 .IX Item "Sys::Virt::NODE_MEMORY_SHARED_MERGE_ACROSS_NODES" Whether pages can be merged across NUMA nodes .SS "CLOSE REASON CONSTANTS" .IX Subsection "CLOSE REASON CONSTANTS" The following constants related to the connection close callback, describe the reason for the closing of the connection. .IP Sys::Virt::CLOSE_REASON_CLIENT 4 .IX Item "Sys::Virt::CLOSE_REASON_CLIENT" The client application requested the connection be closed .IP Sys::Virt::CLOSE_REASON_EOF 4 .IX Item "Sys::Virt::CLOSE_REASON_EOF" End-of-file was encountered reading data from the connection .IP Sys::Virt::CLOSE_REASON_ERROR 4 .IX Item "Sys::Virt::CLOSE_REASON_ERROR" An I/O error was encountered reading/writing data from/to the connection .IP Sys::Virt::CLOSE_REASON_KEEPALIVE 4 .IX Item "Sys::Virt::CLOSE_REASON_KEEPALIVE" The connection keepalive timer triggered due to lack of response from the server .SS "CPU STATS CONSTANTS" .IX Subsection "CPU STATS CONSTANTS" The following constants provide the names of known CPU stats fields .IP Sys::Virt::NODE_CPU_STATS_IDLE 4 .IX Item "Sys::Virt::NODE_CPU_STATS_IDLE" Time spent idle .IP Sys::Virt::NODE_CPU_STATS_IOWAIT 4 .IX Item "Sys::Virt::NODE_CPU_STATS_IOWAIT" Time spent waiting for I/O to complete .IP Sys::Virt::NODE_CPU_STATS_KERNEL 4 .IX Item "Sys::Virt::NODE_CPU_STATS_KERNEL" Time spent executing kernel code .IP Sys::Virt::NODE_CPU_STATS_USER 4 .IX Item "Sys::Virt::NODE_CPU_STATS_USER" Time spent executing user code .IP Sys::Virt::NODE_CPU_STATS_INTR 4 .IX Item "Sys::Virt::NODE_CPU_STATS_INTR" Time spent processing interrupts .IP Sys::Virt::NODE_CPU_STATS_UTILIZATION 4 .IX Item "Sys::Virt::NODE_CPU_STATS_UTILIZATION" Percentage utilization of the CPU. .SS "MEMORY STAS CONSTANTS" .IX Subsection "MEMORY STAS CONSTANTS" The following constants provide the names of known memory stats fields .IP Sys::Virt::NODE_MEMORY_STATS_BUFFERS 4 .IX Item "Sys::Virt::NODE_MEMORY_STATS_BUFFERS" The amount of memory consumed by I/O buffers .IP Sys::Virt::NODE_MEMORY_STATS_CACHED 4 .IX Item "Sys::Virt::NODE_MEMORY_STATS_CACHED" The amount of memory consumed by disk cache .IP Sys::Virt::NODE_MEMORY_STATS_FREE 4 .IX Item "Sys::Virt::NODE_MEMORY_STATS_FREE" The amount of free memory .IP Sys::Virt::NODE_MEMORY_STATS_TOTAL 4 .IX Item "Sys::Virt::NODE_MEMORY_STATS_TOTAL" The total amount of memory .SS "IP address constants" .IX Subsection "IP address constants" The following constants are used to interpret IP address types .IP Sys::Virt::IP_ADDR_TYPE_IPV4 4 .IX Item "Sys::Virt::IP_ADDR_TYPE_IPV4" An IPv4 address type .IP Sys::Virt::IP_ADDR_TYPE_IPV6 4 .IX Item "Sys::Virt::IP_ADDR_TYPE_IPV6" An IPv6 address type .SH BUGS .IX Header "BUGS" Hopefully none, but the XS code needs to be audited to ensure it is not leaking memory. .SH AUTHORS .IX Header "AUTHORS" Daniel P. Berrange .SH COPYRIGHT .IX Header "COPYRIGHT" Copyright (C) 2006\-2009 Red Hat Copyright (C) 2006\-2009 Daniel P. Berrange .SH LICENSE .IX Header "LICENSE" This program is free software; you can redistribute it and/or modify it under the terms of either the GNU General Public License as published by the Free Software Foundation (either version 2 of the License, or at your option any later version), or, the Artistic License, as specified in the Perl README file. .SH "SEE ALSO" .IX Header "SEE ALSO" Sys::Virt::Domain, Sys::Virt::Network, Sys::Virt::StoragePool, Sys::Virt::StorageVol, Sys::Virt::Error, \f(CW\*(C`http://libvirt.org\*(C'\fR