.\" -*- 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::Network 3pm" .TH Sys::Virt::Network 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::Network \- Represent & manage a libvirt virtual network .SH DESCRIPTION .IX Header "DESCRIPTION" The \f(CW\*(C`Sys::Virt::Network\*(C'\fR module represents a virtual network managed by the virtual machine monitor. .SH METHODS .IX Header "METHODS" .ie n .IP "my $uuid = $net\->\fBget_uuid()\fR" 4 .el .IP "my \f(CW$uuid\fR = \f(CW$net\fR\->\fBget_uuid()\fR" 4 .IX Item "my $uuid = $net->get_uuid()" Returns a 16 byte long string containing the raw globally unique identifier (UUID) for the network. .ie n .IP "my $uuid = $net\->\fBget_uuid_string()\fR" 4 .el .IP "my \f(CW$uuid\fR = \f(CW$net\fR\->\fBget_uuid_string()\fR" 4 .IX Item "my $uuid = $net->get_uuid_string()" Returns a printable string representation of the raw UUID, in the format \&'XXXXXXXX\-XXXX\-XXXX\-XXXX\-XXXXXXXXXXXX'. .ie n .IP "my $name = $net\->\fBget_name()\fR" 4 .el .IP "my \f(CW$name\fR = \f(CW$net\fR\->\fBget_name()\fR" 4 .IX Item "my $name = $net->get_name()" Returns a string with a locally unique name of the network .ie n .IP $net\->\fBis_active()\fR 4 .el .IP \f(CW$net\fR\->\fBis_active()\fR 4 .IX Item "$net->is_active()" Returns a true value if the network is currently running .ie n .IP $net\->\fBis_persistent()\fR 4 .el .IP \f(CW$net\fR\->\fBis_persistent()\fR 4 .IX Item "$net->is_persistent()" Returns a true value if the network has a persistent configuration file defined .ie n .IP "my $xml = $net\->\fBget_xml_description()\fR" 4 .el .IP "my \f(CW$xml\fR = \f(CW$net\fR\->\fBget_xml_description()\fR" 4 .IX Item "my $xml = $net->get_xml_description()" Returns an XML document containing a complete description of the network's configuration .ie n .IP $net\->\fBcreate()\fR 4 .el .IP \f(CW$net\fR\->\fBcreate()\fR 4 .IX Item "$net->create()" Start a network whose configuration was previously defined using the \&\f(CW\*(C`define_network\*(C'\fR method in Sys::Virt. .ie n .IP $net\->\fBundefine()\fR 4 .el .IP \f(CW$net\fR\->\fBundefine()\fR 4 .IX Item "$net->undefine()" Remove the configuration associated with a network previously defined with the \f(CW\*(C`define_network\*(C'\fR method in Sys::Virt. If the network is running, you probably want to use the \f(CW\*(C`shutdown\*(C'\fR or \f(CW\*(C`destroy\*(C'\fR methods instead. .ie n .IP $net\->\fBdestroy()\fR 4 .el .IP \f(CW$net\fR\->\fBdestroy()\fR 4 .IX Item "$net->destroy()" Immediately terminate the machine, and remove it from the virtual machine monitor. The \f(CW$net\fR handle is invalid after this call completes and should not be used again. .ie n .IP "$net\->update($command, $section, $parentIndex, $xml, $flags=0)" 4 .el .IP "\f(CW$net\fR\->update($command, \f(CW$section\fR, \f(CW$parentIndex\fR, \f(CW$xml\fR, \f(CW$flags\fR=0)" 4 .IX Item "$net->update($command, $section, $parentIndex, $xml, $flags=0)" Update the network configuration with \f(CW$xml\fR. The \f(CW$section\fR parameter, which must be one of the XML SECTION CONSTANTS listed later, indicates what schema is used in \f(CW$xml\fR. The \f(CW$command\fR parameter determines what action is taken. Finally, the \f(CW$flags\fR parameter can be use to control which config is affected. .ie n .IP $net\->\fBget_bridge_name()\fR 4 .el .IP \f(CW$net\fR\->\fBget_bridge_name()\fR 4 .IX Item "$net->get_bridge_name()" Return the name of the bridge device associated with the virtual network .ie n .IP "$flag = $net\->\fBget_autostart()\fR;" 4 .el .IP "\f(CW$flag\fR = \f(CW$net\fR\->\fBget_autostart()\fR;" 4 .IX Item "$flag = $net->get_autostart();" Return a true value if the virtual network is configured to automatically start upon boot. Return false, otherwise .ie n .IP $net\->set_autostart($flag) 4 .el .IP \f(CW$net\fR\->set_autostart($flag) 4 .IX Item "$net->set_autostart($flag)" Set the state of the autostart flag, which determines whether the virtual network will automatically start upon boot of the host OS. .ie n .IP "@leases = $net\->get_dhcp_leases($mac=undef, $flags=0)" 4 .el .IP "\f(CW@leases\fR = \f(CW$net\fR\->get_dhcp_leases($mac=undef, \f(CW$flags\fR=0)" 4 .IX Item "@leases = $net->get_dhcp_leases($mac=undef, $flags=0)" Get a list of all active DHCP leases. If \f(CW$mac\fR is undefined than leases for all VMs are returned, otherwise only leases for the matching MAC address are returned. The \f(CW$flags\fR parameter is currently unused and defaults to zero. .Sp The elements in the returned array are hash references with the following fields .RS 4 .ie n .IP """iface""" 4 .el .IP \f(CWiface\fR 4 .IX Item "iface" Network interface name .ie n .IP """expirytime""" 4 .el .IP \f(CWexpirytime\fR 4 .IX Item "expirytime" Seconds since the epoch until the lease expires .ie n .IP """type""" 4 .el .IP \f(CWtype\fR 4 .IX Item "type" One of the Sys::Virt IP address type constants .ie n .IP """mac""" 4 .el .IP \f(CWmac\fR 4 .IX Item "mac" The MAC address of the lease .ie n .IP """iaid""" 4 .el .IP \f(CWiaid\fR 4 .IX Item "iaid" The IAID of the client .ie n .IP """ipaddr""" 4 .el .IP \f(CWipaddr\fR 4 .IX Item "ipaddr" The IP address of the lease .ie n .IP """prefix""" 4 .el .IP \f(CWprefix\fR 4 .IX Item "prefix" The IP address prefix .ie n .IP """hostname""" 4 .el .IP \f(CWhostname\fR 4 .IX Item "hostname" The optional hostname associated with the lease .ie n .IP """clientid""" 4 .el .IP \f(CWclientid\fR 4 .IX Item "clientid" The client ID or DUID .RE .RS 4 .RE .ie n .IP "@port = $net\->list_all_ports($flags=0)" 4 .el .IP "\f(CW@port\fR = \f(CW$net\fR\->list_all_ports($flags=0)" 4 .IX Item "@port = $net->list_all_ports($flags=0)" List all ports associated with the network. The return array elements are instances of the \f(CW\*(C`Sys::Virt::NetworkPort\*(C'\fR class. .ie n .IP "$port = $net\->create_port($xml, $flags=0)" 4 .el .IP "\f(CW$port\fR = \f(CW$net\fR\->create_port($xml, \f(CW$flags\fR=0)" 4 .IX Item "$port = $net->create_port($xml, $flags=0)" Create a new network port from the given \f(CW$xml\fR description. The \f(CW$flags\fR parameter can optionally taken one or more of the network port creation constants. The returned \f(CW$port\fR object is an instance of the \&\f(CW\*(C`Sys::Virt::NetworkPort\*(C'\fR class. .ie n .IP "$port = $net\->get_port_by_uuid($uuid);" 4 .el .IP "\f(CW$port\fR = \f(CW$net\fR\->get_port_by_uuid($uuid);" 4 .IX Item "$port = $net->get_port_by_uuid($uuid);" Lookup a network port from a raw or printable UUID. The returned \f(CW$port\fR object is an instance of the \f(CW\*(C`Sys::Virt::NetworkPort\*(C'\fR class. .ie n .IP "my $str = $net\->get_metadata($type, $uri, $flags =0)" 4 .el .IP "my \f(CW$str\fR = \f(CW$net\fR\->get_metadata($type, \f(CW$uri\fR, \f(CW$flags\fR =0)" 4 .IX Item "my $str = $net->get_metadata($type, $uri, $flags =0)" Returns the metadata element of type \f(CW$type\fR associated with the network. If \f(CW$type\fR is \f(CW\*(C`Sys::Virt::Network::METADATA_ELEMENT\*(C'\fR then the \f(CW$uri\fR parameter specifies the XML namespace to retrieve, otherwise \f(CW$uri\fR should be \f(CW\*(C`undef\*(C'\fR. The optional \&\f(CW$flags\fR parameter takes one of the XML UPDATE FLAGS values, and defaults to zero. .ie n .IP "$net\->set_metadata($type, $val, $key, $uri, $flags=0)" 4 .el .IP "\f(CW$net\fR\->set_metadata($type, \f(CW$val\fR, \f(CW$key\fR, \f(CW$uri\fR, \f(CW$flags\fR=0)" 4 .IX Item "$net->set_metadata($type, $val, $key, $uri, $flags=0)" Sets the metadata element of type \f(CW$type\fR to hold the value \&\f(CW$val\fR. If \f(CW$type\fR is \f(CW\*(C`Sys::Virt::Network::METADATA_ELEMENT\*(C'\fR then the \f(CW$key\fR and \f(CW$uri\fR elements specify an XML namespace to use, otherwise they should both be \f(CW\*(C`undef\*(C'\fR. The optional \&\f(CW$flags\fR parameter takes one of the XML UPDATE FLAGS values, and defaults to zero. .SH CONSTANTS .IX Header "CONSTANTS" This section documents constants that are used with various APIs described above .SS "NETWORK CREATION CONSTANTS" .IX Subsection "NETWORK CREATION CONSTANTS" When creating networks zero or more of the following constants may be used .IP Sys::Virt::Network::CREATE_VALIDATE 4 .IX Item "Sys::Virt::Network::CREATE_VALIDATE" Validate the XML document against the XML schema .SS "LIST FILTERING" .IX Subsection "LIST FILTERING" The following constants are used to filter object lists .IP Sys::Virt::Network::LIST_ACTIVE 4 .IX Item "Sys::Virt::Network::LIST_ACTIVE" Include networks which are active .IP Sys::Virt::Network::LIST_INACTIVE 4 .IX Item "Sys::Virt::Network::LIST_INACTIVE" Include networks which are not active .IP Sys::Virt::Network::LIST_AUTOSTART 4 .IX Item "Sys::Virt::Network::LIST_AUTOSTART" Include networks which are set to autostart .IP Sys::Virt::Network::LIST_NO_AUTOSTART 4 .IX Item "Sys::Virt::Network::LIST_NO_AUTOSTART" Include networks which are not set to autostart .IP Sys::Virt::Network::LIST_PERSISTENT 4 .IX Item "Sys::Virt::Network::LIST_PERSISTENT" Include networks which are persistent .IP Sys::Virt::Network::LIST_TRANSIENT 4 .IX Item "Sys::Virt::Network::LIST_TRANSIENT" Include networks which are transient .SS "NETWORK DEFINE" .IX Subsection "NETWORK DEFINE" The following constants can be used to control the behaviour of network define operations .IP Sys::Virt::Network::DEFINE_VALIDATE 4 .IX Item "Sys::Virt::Network::DEFINE_VALIDATE" Validate the XML document against the XML schema .SS "XML CONSTANTS" .IX Subsection "XML CONSTANTS" The following constants are used when querying XML .IP Sys::Virt::Network::XML_INACTIVE 4 .IX Item "Sys::Virt::Network::XML_INACTIVE" Request the inactive XML, instead of the current possibly live config. .SH "XML SECTION CONSTANTS" .IX Header "XML SECTION CONSTANTS" The following constants are used to refer to sections of the XML document .IP Sys::Virt::Network::SECTION_BRIDGE 4 .IX Item "Sys::Virt::Network::SECTION_BRIDGE" The bridge device element .IP Sys::Virt::Network::SECTION_DNS_HOST 4 .IX Item "Sys::Virt::Network::SECTION_DNS_HOST" The DNS host record section .IP Sys::Virt::Network::SECTION_DNS_SRV 4 .IX Item "Sys::Virt::Network::SECTION_DNS_SRV" The DNS SRV record section .IP Sys::Virt::Network::SECTION_DNS_TXT 4 .IX Item "Sys::Virt::Network::SECTION_DNS_TXT" The DNS TXT record section .IP Sys::Virt::Network::SECTION_DOMAIN 4 .IX Item "Sys::Virt::Network::SECTION_DOMAIN" The domain name section .IP Sys::Virt::Network::SECTION_FORWARD 4 .IX Item "Sys::Virt::Network::SECTION_FORWARD" The forward device section .IP Sys::Virt::Network::SECTION_FORWARD_INTERFACE 4 .IX Item "Sys::Virt::Network::SECTION_FORWARD_INTERFACE" The forward interface section .IP Sys::Virt::Network::SECTION_FORWARD_PF 4 .IX Item "Sys::Virt::Network::SECTION_FORWARD_PF" The forward physical function section .IP Sys::Virt::Network::SECTION_IP 4 .IX Item "Sys::Virt::Network::SECTION_IP" The IP address section .IP Sys::Virt::Network::SECTION_IP_DHCP_HOST 4 .IX Item "Sys::Virt::Network::SECTION_IP_DHCP_HOST" The IP address DHCP host section .IP Sys::Virt::Network::SECTION_IP_DHCP_RANGE 4 .IX Item "Sys::Virt::Network::SECTION_IP_DHCP_RANGE" The IP address DHCP range section .IP Sys::Virt::Network::SECTION_PORTGROUP 4 .IX Item "Sys::Virt::Network::SECTION_PORTGROUP" The port group section .IP Sys::Virt::Network::SECTION_NONE 4 .IX Item "Sys::Virt::Network::SECTION_NONE" The top level domain element .SS "XML UPDATE FLAGS" .IX Subsection "XML UPDATE FLAGS" .IP Sys::Virt::Network::UPDATE_AFFECT_CURRENT 4 .IX Item "Sys::Virt::Network::UPDATE_AFFECT_CURRENT" Affect whatever the current object state is .IP Sys::Virt::Network::UPDATE_AFFECT_CONFIG 4 .IX Item "Sys::Virt::Network::UPDATE_AFFECT_CONFIG" Always update the config file .IP Sys::Virt::Network::UPDATE_AFFECT_LIVE 4 .IX Item "Sys::Virt::Network::UPDATE_AFFECT_LIVE" Always update the live config .SS "XML UPDATE COMMANDS" .IX Subsection "XML UPDATE COMMANDS" .IP Sys::Virt::Network::UPDATE_COMMAND_NONE 4 .IX Item "Sys::Virt::Network::UPDATE_COMMAND_NONE" No update .IP Sys::Virt::Network::UPDATE_COMMAND_DELETE 4 .IX Item "Sys::Virt::Network::UPDATE_COMMAND_DELETE" Remove the matching entry .IP Sys::Virt::Network::UPDATE_COMMAND_MODIFY 4 .IX Item "Sys::Virt::Network::UPDATE_COMMAND_MODIFY" Modify the matching entry .IP Sys::Virt::Network::UPDATE_COMMAND_ADD_FIRST 4 .IX Item "Sys::Virt::Network::UPDATE_COMMAND_ADD_FIRST" Insert the matching entry at the start .IP Sys::Virt::Network::UPDATE_COMMAND_ADD_LAST 4 .IX Item "Sys::Virt::Network::UPDATE_COMMAND_ADD_LAST" Insert the matching entry at the end .SS "EVENT ID CONSTANTS" .IX Subsection "EVENT ID CONSTANTS" .IP Sys::Virt::Network::EVENT_ID_LIFECYCLE 4 .IX Item "Sys::Virt::Network::EVENT_ID_LIFECYCLE" Network lifecycle events .IP Sys::Virt::Network::EVENT_ID_METADATA_CHANGE 4 .IX Item "Sys::Virt::Network::EVENT_ID_METADATA_CHANGE" The network metadata has changed .SS "LIFECYCLE CHANGE EVENTS" .IX Subsection "LIFECYCLE CHANGE EVENTS" The following constants allow network lifecycle change events to be interpreted. The events contain both a state change, and a reason though the reason is currently unused. .IP Sys::Virt::Network::EVENT_DEFINED 4 .IX Item "Sys::Virt::Network::EVENT_DEFINED" Indicates that a persistent configuration has been defined for the network. .IP Sys::Virt::Network::EVENT_STARTED 4 .IX Item "Sys::Virt::Network::EVENT_STARTED" The network has started running .IP Sys::Virt::Network::EVENT_STOPPED 4 .IX Item "Sys::Virt::Network::EVENT_STOPPED" The network has stopped running .IP Sys::Virt::Network::EVENT_UNDEFINED 4 .IX Item "Sys::Virt::Network::EVENT_UNDEFINED" The persistent configuration has gone away .SS "METADATA TYPE CONSTANTS" .IX Subsection "METADATA TYPE CONSTANTS" The following constants control the type of metadata being accessed .IP Sys::Virt::Network::METADATA_TITLE 4 .IX Item "Sys::Virt::Network::METADATA_TITLE" The short human friendly title of the network .IP Sys::Virt::Network::METADATA_DESCRIPTION 4 .IX Item "Sys::Virt::Network::METADATA_DESCRIPTION" The long free text description of the network .IP Sys::Virt::Network::METADATA_ELEMENT 4 .IX Item "Sys::Virt::Network::METADATA_ELEMENT" The structured metadata elements for the network .SH AUTHORS .IX Header "AUTHORS" Daniel P. Berrange .SH COPYRIGHT .IX Header "COPYRIGHT" Copyright (C) 2006 Red Hat Copyright (C) 2006\-2007 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, Sys::Virt::Error, \f(CW\*(C`http://libvirt.org\*(C'\fR