Package org.libvirt
Class Network
- java.lang.Object
-
- org.libvirt.Network
-
public class Network extends java.lang.ObjectA network object defined by libvirt.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classNetwork.IP_Addr_Type
-
Field Summary
Fields Modifier and Type Field Description protected ConnectvirConnectThe Connect Object that represents the Hypervisor of this Network
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcreate()Creates and starts this defined network.voiddestroy()Destroy this network object.protected voidfinalize()intfree()Frees this network object.booleangetAutostart()Provides a boolean value indicating whether this network is configured to be automatically started when the host machine boots.java.lang.StringgetBridgeName()Provides a bridge interface name to which a domain may connect a network interface in order to join this network.ConnectgetConnect()Provides the connection pointer associated with this network.java.lang.StringgetName()Gets the public name for this networkint[]getUUID()Gets the UUID for this networkjava.lang.StringgetUUIDString()Gets the UUID for a network as string.java.lang.StringgetXMLDesc(int flags)Provides an XML description of this network.intisActive()Determine if the network is currently runningintisPersistent()Determine if the network has a persistent configuration which means it will still exist after shutting downvoidsetAutostart(boolean autostart)Configures this network to be automatically started when the host machine boots.voidundefine()Undefines this network but does not stop it if it is running
-
-
-
Field Detail
-
virConnect
protected Connect virConnect
The Connect Object that represents the Hypervisor of this Network
-
-
Method Detail
-
create
public void create() throws LibvirtExceptionCreates and starts this defined network. If the call succeeds the network moves from the defined to the running networks pools.- Throws:
LibvirtException
-
destroy
public void destroy() throws LibvirtExceptionDestroy this network object. The running instance is shutdown if not down already and all resources used by it are given back to the hypervisor. The object becomes invalid and should not be used thereafter if the call does not return an error. This function may require priviledged access- Throws:
LibvirtException
-
finalize
protected void finalize() throws LibvirtException- Overrides:
finalizein classjava.lang.Object- Throws:
LibvirtException
-
free
public int free() throws LibvirtExceptionFrees this network object. The running instance is kept alive. The object becomes invalid and should not be used thereafter if the call does not return an error.- Returns:
- number of references left (>= 0)
- Throws:
LibvirtException
-
getAutostart
public boolean getAutostart() throws LibvirtExceptionProvides a boolean value indicating whether this network is configured to be automatically started when the host machine boots.- Returns:
- true if autostarted, false otherwise
- Throws:
LibvirtException
-
getBridgeName
public java.lang.String getBridgeName() throws LibvirtExceptionProvides a bridge interface name to which a domain may connect a network interface in order to join this network.- Returns:
- the interface name
- Throws:
LibvirtException
-
getConnect
public Connect getConnect()
Provides the connection pointer associated with this network.- Returns:
- the Connect object
-
getName
public java.lang.String getName() throws LibvirtExceptionGets the public name for this network- Returns:
- the public name
- Throws:
LibvirtException
-
getUUID
public int[] getUUID() throws LibvirtExceptionGets the UUID for this network- Returns:
- the UUID as an unpacked int array
- Throws:
LibvirtException- See Also:
- rfc4122
-
getUUIDString
public java.lang.String getUUIDString() throws LibvirtExceptionGets the UUID for a network as string.- Returns:
- the UUID in canonical String format
- Throws:
LibvirtException- See Also:
- rfc4122
-
getXMLDesc
public java.lang.String getXMLDesc(int flags) throws LibvirtExceptionProvides an XML description of this network. The description may be reused later to relaunch the network with Virconnect.virNetworkCreateXML().- Parameters:
flags- and OR'ed set of extraction flags, not used yet- Returns:
- The XML representation of this network
- Throws:
LibvirtException
-
isActive
public int isActive() throws LibvirtExceptionDetermine if the network is currently running- Returns:
- 1 if running, 0 if inactive, -1 on error
- Throws:
LibvirtException- See Also:
- Libvirt Documentation
-
isPersistent
public int isPersistent() throws LibvirtExceptionDetermine if the network has a persistent configuration which means it will still exist after shutting down- Returns:
- 1 if persistent, 0 if transient, -1 on error
- Throws:
LibvirtException- See Also:
- Libvirt Documentation
-
setAutostart
public void setAutostart(boolean autostart) throws LibvirtExceptionConfigures this network to be automatically started when the host machine boots.- Parameters:
autostart- whether the network should be automatically started 0 or 1- Throws:
LibvirtException
-
undefine
public void undefine() throws LibvirtExceptionUndefines this network but does not stop it if it is running- Throws:
LibvirtException
-
-