1Sys::Virt::Network(3) User Contributed Perl DocumentationSys::Virt::Network(3)
2
3
4

NAME

6       Sys::Virt::Network - Represent & manage a libvirt virtual network
7

DESCRIPTION

9       The "Sys::Virt::Network" module represents a virtual network managed by
10       the virtual machine monitor.
11

METHODS

13       my $uuid = $net->get_uuid()
14           Returns a 16 byte long string containing the raw globally unique
15           identifier (UUID) for the network.
16
17       my $uuid = $net->get_uuid_string()
18           Returns a printable string representation of the raw UUID, in the
19           format 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'.
20
21       my $name = $net->get_name()
22           Returns a string with a locally unique name of the network
23
24       $net->is_active()
25           Returns a true value if the network is currently running
26
27       $net->is_persistent()
28           Returns a true value if the network has a persistent configuration
29           file defined
30
31       my $xml = $net->get_xml_description()
32           Returns an XML document containing a complete description of the
33           network's configuration
34
35       $net->create()
36           Start a network whose configuration was previously defined using
37           the "define_network" method in Sys::Virt.
38
39       $net->undefine()
40           Remove the configuration associated with a network previously
41           defined with the "define_network" method in Sys::Virt. If the
42           network is running, you probably want to use the "shutdown" or
43           "destroy" methods instead.
44
45       $net->destroy()
46           Immediately terminate the machine, and remove it from the virtual
47           machine monitor. The $net handle is invalid after this call
48           completes and should not be used again.
49
50       $net->update($command, $section, $parentIndex, $xml, $flags=0)
51           Update the network configuration with $xml. The $section parameter,
52           which must be one of the XML SECTION CONSTANTS listed later,
53           indicates what schema is used in $xml. The $command parameter
54           determines what action is taken. Finally, the $flags parameter can
55           be use to control which config is affected.
56
57       $net->get_bridge_name()
58           Return the name of the bridge device associated with the virtual
59           network
60
61       $flag = $net->get_autostart();
62           Return a true value if the virtual network is configured to
63           automatically start upon boot. Return false, otherwise
64
65       $net->set_autostart($flag)
66           Set the state of the autostart flag, which determines whether the
67           virtual network will automatically start upon boot of the host OS.
68
69       @leases = $net->get_dhcp_leases($mac=undef, $flags=0)
70           Get a list of all active DHCP leases. If $mac is undefined than
71           leases for all VMs are returned, otherwise only leases for the
72           matching MAC address are returned. The $flags parameter is
73           currently unused and defaults to zero.
74
75           The elements in the returned array are hash references with the
76           following fields
77
78           "iface"
79               Network interface name
80
81           "expirytime"
82               Seconds since the epoch until the lease expires
83
84           "type"
85               One of the Sys::Virt IP address type constants
86
87           "mac"
88               The MAC address of the lease
89
90           "iaid"
91               The IAID of the client
92
93           "ipaddr"
94               The IP address of the lease
95
96           "prefix"
97               The IP address prefix
98
99           "hostname"
100               The optional hostname associated with the lease
101
102           "clientid"
103               The client ID or DUID
104
105       @port = $net->list_all_ports($flags=0)
106           List all ports associated with the network. The return array
107           elements are instances of the "Sys::Virt::NetworkPort" class.
108
109       $port = $net->create_port($xml, $flags=0)
110           Create a new network port from the given $xml description. The
111           $flags parameter can optionally taken one or more of the network
112           port creation constants. The returned $port object is an instance
113           of the "Sys::Virt::NetworkPort" class.
114
115       $port = $net->get_port_by_uuid($uuid);
116           Lookup a network port from a raw or printable UUID.  The returned
117           $port object is an instance of the "Sys::Virt::NetworkPort" class.
118

CONSTANTS

120       This section documents constants that are used with various APIs
121       described above
122
123   NETWORK CREATION CONSTANTS
124       When creating networks zero or more of the following constants may be
125       used
126
127       Sys::Virt::Network::CREATE_VALIDATE
128           Validate the XML document against the XML schema
129
130   LIST FILTERING
131       The following constants are used to filter object lists
132
133       Sys::Virt::Network::LIST_ACTIVE
134           Include networks which are active
135
136       Sys::Virt::Network::LIST_INACTIVE
137           Include networks which are not active
138
139       Sys::Virt::Network::LIST_AUTOSTART
140           Include networks which are set to autostart
141
142       Sys::Virt::Network::LIST_NO_AUTOSTART
143           Include networks which are not set to autostart
144
145       Sys::Virt::Network::LIST_PERSISTENT
146           Include networks which are persistent
147
148       Sys::Virt::Network::LIST_TRANSIENT
149           Include networks which are transient
150
151   NETWORK DEFINE
152       The following constants can be used to control the behaviour of network
153       define operations
154
155       Sys::Virt::Network::DEFINE_VALIDATE
156           Validate the XML document against the XML schema
157
158   XML CONSTANTS
159       The following constants are used when querying XML
160
161       Sys::Virt::Network::XML_INACTIVE
162           Request the inactive XML, instead of the current possibly live
163           config.
164

XML SECTION CONSTANTS

166       The following constants are used to refer to sections of the XML
167       document
168
169       Sys::Virt::Network::SECTION_BRIDGE
170           The bridge device element
171
172       Sys::Virt::Network::SECTION_DNS_HOST
173           The DNS host record section
174
175       Sys::Virt::Network::SECTION_DNS_SRV
176           The DNS SRV record section
177
178       Sys::Virt::Network::SECTION_DNS_TXT
179           The DNS TXT record section
180
181       Sys::Virt::Network::SECTION_DOMAIN
182           The domain name section
183
184       Sys::Virt::Network::SECTION_FORWARD
185           The forward device section
186
187       Sys::Virt::Network::SECTION_FORWARD_INTERFACE
188           The forward interface section
189
190       Sys::Virt::Network::SECTION_FORWARD_PF
191           The forward physical function section
192
193       Sys::Virt::Network::SECTION_IP
194           The IP address section
195
196       Sys::Virt::Network::SECTION_IP_DHCP_HOST
197           The IP address DHCP host section
198
199       Sys::Virt::Network::SECTION_IP_DHCP_RANGE
200           The IP address DHCP range section
201
202       Sys::Virt::Network::SECTION_PORTGROUP
203           The port group section
204
205       Sys::Virt::Network::SECTION_NONE
206           The top level domain element
207
208   XML UPDATE FLAGS
209       Sys::Virt::Network::UPDATE_AFFECT_CURRENT
210           Affect whatever the current object state is
211
212       Sys::Virt::Network::UPDATE_AFFECT_CONFIG
213           Always update the config file
214
215       Sys::Virt::Network::UPDATE_AFFECT_LIVE
216           Always update the live config
217
218   XML UPDATE COMMANDS
219       Sys::Virt::Network::UPDATE_COMMAND_NONE
220           No update
221
222       Sys::Virt::Network::UPDATE_COMMAND_DELETE
223           Remove the matching entry
224
225       Sys::Virt::Network::UPDATE_COMMAND_MODIFY
226           Modify the matching entry
227
228       Sys::Virt::Network::UPDATE_COMMAND_ADD_FIRST
229           Insert the matching entry at the start
230
231       Sys::Virt::Network::UPDATE_COMMAND_ADD_LAST
232           Insert the matching entry at the end
233
234   EVENT ID CONSTANTS
235       Sys::Virt::Network::EVENT_ID_LIFECYCLE
236           Network lifecycle events
237
238   LIFECYCLE CHANGE EVENTS
239       The following constants allow network lifecycle change events to be
240       interpreted. The events contain both a state change, and a reason
241       though the reason is currently unused.
242
243       Sys::Virt::Network::EVENT_DEFINED
244           Indicates that a persistent configuration has been defined for the
245           network.
246
247       Sys::Virt::Network::EVENT_STARTED
248           The network has started running
249
250       Sys::Virt::Network::EVENT_STOPPED
251           The network has stopped running
252
253       Sys::Virt::Network::EVENT_UNDEFINED
254           The persistent configuration has gone away
255

AUTHORS

257       Daniel P. Berrange <berrange@redhat.com>
258
260       Copyright (C) 2006 Red Hat Copyright (C) 2006-2007 Daniel P. Berrange
261

LICENSE

263       This program is free software; you can redistribute it and/or modify it
264       under the terms of either the GNU General Public License as published
265       by the Free Software Foundation (either version 2 of the License, or at
266       your option any later version), or, the Artistic License, as specified
267       in the Perl README file.
268

SEE ALSO

270       Sys::Virt, Sys::Virt::Error, "http://libvirt.org"
271
272
273
274perl v5.36.0                      2022-07-25             Sys::Virt::Network(3)
Impressum