.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" 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 .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . 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 .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Sys::Virt::Network 3pm" .TH Sys::Virt::Network 3pm "2021-01-30" "perl v5.32.0" "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 (\s-1UUID\s0) 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 \s-1UUID,\s0 in the format \&'\s-1XXXXXXXX\-XXXX\-XXXX\-XXXX\-XXXXXXXXXXXX\s0'. .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 \s-1XML\s0 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 \s-1XML SECTION CONSTANTS\s0 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 \s-1OS.\s0 .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 \s-1DHCP\s0 leases. If \f(CW$mac\fR is undefined than leases for all VMs are returned, otherwise only leases for the matching \s-1MAC\s0 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 \s-1IP\s0 address type constants .ie n .IP """mac""" 4 .el .IP "\f(CWmac\fR" 4 .IX Item "mac" The \s-1MAC\s0 address of the lease .ie n .IP """iaid""" 4 .el .IP "\f(CWiaid\fR" 4 .IX Item "iaid" The \s-1IAID\s0 of the client .ie n .IP """ipaddr""" 4 .el .IP "\f(CWipaddr\fR" 4 .IX Item "ipaddr" The \s-1IP\s0 address of the lease .ie n .IP """prefix""" 4 .el .IP "\f(CWprefix\fR" 4 .IX Item "prefix" The \s-1IP\s0 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 \s-1ID\s0 or \s-1DUID\s0 .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 \s-1UUID.\s0 The returned \f(CW$port\fR object is an instance of the \f(CW\*(C`Sys::Virt::NetworkPort\*(C'\fR class. .SH "CONSTANTS" .IX Header "CONSTANTS" This section documents constants that are used with various APIs described above .SS "\s-1LIST FILTERING\s0" .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 "\s-1XML CONSTANTS\s0" .IX Subsection "XML CONSTANTS" The following constants are used when querying \s-1XML\s0 .IP "Sys::Virt::Network::XML_INACTIVE" 4 .IX Item "Sys::Virt::Network::XML_INACTIVE" Request the inactive \s-1XML,\s0 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 \s-1XML\s0 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 \s-1DNS\s0 host record section .IP "Sys::Virt::Network::SECTION_DNS_SRV" 4 .IX Item "Sys::Virt::Network::SECTION_DNS_SRV" The \s-1DNS SRV\s0 record section .IP "Sys::Virt::Network::SECTION_DNS_TXT" 4 .IX Item "Sys::Virt::Network::SECTION_DNS_TXT" The \s-1DNS TXT\s0 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 \s-1IP\s0 address section .IP "Sys::Virt::Network::SECTION_IP_DHCP_HOST" 4 .IX Item "Sys::Virt::Network::SECTION_IP_DHCP_HOST" The \s-1IP\s0 address \s-1DHCP\s0 host section .IP "Sys::Virt::Network::SECTION_IP_DHCP_RANGE" 4 .IX Item "Sys::Virt::Network::SECTION_IP_DHCP_RANGE" The \s-1IP\s0 address \s-1DHCP\s0 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 "\s-1XML UPDATE FLAGS\s0" .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 "\s-1XML UPDATE COMMANDS\s0" .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 "\s-1EVENT ID CONSTANTS\s0" .IX Subsection "EVENT ID CONSTANTS" .IP "Sys::Virt::Network::EVENT_ID_LIFECYCLE" 4 .IX Item "Sys::Virt::Network::EVENT_ID_LIFECYCLE" Network lifecycle events .SS "\s-1LIFECYCLE CHANGE EVENTS\s0" .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 .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 \s-1GNU\s0 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 \s-1README\s0 file. .SH "SEE ALSO" .IX Header "SEE ALSO" Sys::Virt, Sys::Virt::Error, \f(CW\*(C`http://libvirt.org\*(C'\fR