1Sys::Virt::Network(3) User Contributed Perl DocumentationSys::Virt::Network(3)
2
3
4
6 Sys::Virt::Network - Represent & manage a libvirt virtual network
7
9 The "Sys::Virt::Network" module represents a virtual network managed by
10 the virtual machine monitor.
11
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
106 This section documents constants that are used with various APIs
107 described above
108
109 LIST FILTERING
110 The following constants are used to filter object lists
111
112 Sys::Virt::Network::LIST_ACTIVE
113 Include networks which are active
114
115 Sys::Virt::Network::LIST_INACTIVE
116 Include networks which are not active
117
118 Sys::Virt::Network::LIST_AUTOSTART
119 Include networks which are set to autostart
120
121 Sys::Virt::Network::LIST_NO_AUTOSTART
122 Include networks which are not set to autostart
123
124 Sys::Virt::Network::LIST_PERSISTENT
125 Include networks which are persistent
126
127 Sys::Virt::Network::LIST_TRANSIENT
128 Include networks which are transient
129
130 XML CONSTANTS
131 The following constants are used when querying XML
132
133 Sys::Virt::Network::XML_INACTIVE
134 Request the inactive XML, instead of the current possibly live
135 config.
136
138 The following constants are used to refer to sections of the XML
139 document
140
141 Sys::Virt::Network::SECTION_BRIDGE
142 The bridge device element
143
144 Sys::Virt::Network::SECTION_DNS_HOST
145 The DNS host record section
146
147 Sys::Virt::Network::SECTION_DNS_SRV
148 The DNS SRV record section
149
150 Sys::Virt::Network::SECTION_DNS_TXT
151 The DNS TXT record section
152
153 Sys::Virt::Network::SECTION_DOMAIN
154 The domain name section
155
156 Sys::Virt::Network::SECTION_FORWARD
157 The forward device section
158
159 Sys::Virt::Network::SECTION_FORWARD_INTERFACE
160 The forward interface section
161
162 Sys::Virt::Network::SECTION_FORWARD_PF
163 The forward physical function section
164
165 Sys::Virt::Network::SECTION_IP
166 The IP address section
167
168 Sys::Virt::Network::SECTION_IP_DHCP_HOST
169 The IP address DHCP host section
170
171 Sys::Virt::Network::SECTION_IP_DHCP_RANGE
172 The IP address DHCP range section
173
174 Sys::Virt::Network::SECTION_PORTGROUP
175 The port group section
176
177 Sys::Virt::Network::SECTION_NONE
178 The top level domain element
179
180 XML UPDATE FLAGS
181 Sys::Virt::Network::UPDATE_AFFECT_CURRENT
182 Affect whatever the current object state is
183
184 Sys::Virt::Network::UPDATE_AFFECT_CONFIG
185 Always update the config file
186
187 Sys::Virt::Network::UPDATE_AFFECT_LIVE
188 Always update the live config
189
190 XML UPDATE COMMANDS
191 Sys::Virt::Network::UPDATE_COMMAND_NONE
192 No update
193
194 Sys::Virt::Network::UPDATE_COMMAND_DELETE
195 Remove the matching entry
196
197 Sys::Virt::Network::UPDATE_COMMAND_MODIFY
198 Modify the matching entry
199
200 Sys::Virt::Network::UPDATE_COMMAND_ADD_FIRST
201 Insert the matching entry at the start
202
203 Sys::Virt::Network::UPDATE_COMMAND_ADD_LAST
204 Insert the matching entry at the end
205
206 EVENT ID CONSTANTS
207 Sys::Virt::Network::EVENT_ID_LIFECYCLE
208 Network lifecycle events
209
210 LIFECYCLE CHANGE EVENTS
211 The following constants allow network lifecycle change events to be
212 interpreted. The events contain both a state change, and a reason
213 though the reason is currently unused.
214
215 Sys::Virt::Network::EVENT_DEFINED
216 Indicates that a persistent configuration has been defined for the
217 network.
218
219 Sys::Virt::Network::EVENT_STARTED
220 The network has started running
221
222 Sys::Virt::Network::EVENT_STOPPED
223 The network has stopped running
224
225 Sys::Virt::Network::EVENT_UNDEFINED
226 The persistent configuration has gone away
227
229 Daniel P. Berrange <berrange@redhat.com>
230
232 Copyright (C) 2006 Red Hat Copyright (C) 2006-2007 Daniel P. Berrange
233
235 This program is free software; you can redistribute it and/or modify it
236 under the terms of either the GNU General Public License as published
237 by the Free Software Foundation (either version 2 of the License, or at
238 your option any later version), or, the Artistic License, as specified
239 in the Perl README file.
240
242 Sys::Virt, Sys::Virt::Error, "http://libvirt.org"
243
244
245
246perl v5.16.3 2018-11-02 Sys::Virt::Network(3)