Package org.libvirt
Class Interface
- java.lang.Object
-
- org.libvirt.Interface
-
public class Interface extends java.lang.ObjectA device which is attached to a node
-
-
Field Summary
Fields Modifier and Type Field Description protected LibvirtlibvirtThe libvirt connection from the hypervisorstatic intVIR_INTERFACE_XML_INACTIVEGet XML Flag: dump inactive interface information
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcreate()Create and start a defined network.intdestroy()Destroy the network object.voidfinalize()intfree()Frees this interface object.java.lang.StringgetMACString()Returns the mac string of the interfacejava.lang.StringgetName()Returns the name of the interfacejava.lang.StringgetXMLDescription(int flags)Returns the XML description for theinterfaceintisActive()Determine if the interface is currently runningprotected voidprocessError()Error handling logic to throw errors.intundefine()Undefine an interface, ie remove it from the config.
-
-
-
Field Detail
-
VIR_INTERFACE_XML_INACTIVE
public static int VIR_INTERFACE_XML_INACTIVE
Get XML Flag: dump inactive interface information
-
libvirt
protected Libvirt libvirt
The libvirt connection from the hypervisor
-
-
Method Detail
-
create
public int create() throws LibvirtExceptionCreate and start a defined network. If the call succeed the network moves from the defined to the running networks pools.- Throws:
LibvirtException
-
destroy
public int destroy() throws LibvirtExceptionDestroy the network object. The running instance is shutdown if not down already and all resources used by it are given back to the hypervisor.- Throws:
LibvirtException
-
finalize
public void finalize() throws LibvirtException- Overrides:
finalizein classjava.lang.Object- Throws:
LibvirtException
-
free
public int free() throws LibvirtExceptionFrees this interface object. The running instance is kept alive. The data structure is freed and should not be used thereafter.- Returns:
- number of references left (>= 0) for success, -1 for failure.
- Throws:
LibvirtException
-
getMACString
public java.lang.String getMACString() throws LibvirtExceptionReturns the mac string of the interface- Throws:
LibvirtException
-
getName
public java.lang.String getName() throws LibvirtExceptionReturns the name of the interface- Throws:
LibvirtException
-
getXMLDescription
public java.lang.String getXMLDescription(int flags) throws LibvirtExceptionReturns the XML description for theinterface- Throws:
LibvirtException
-
isActive
public int isActive() throws LibvirtExceptionDetermine if the interface is currently running- Returns:
- 1 if running, 0 if inactive, -1 on error
- Throws:
LibvirtException- See Also:
- Libvirt Documentation
-
processError
protected void processError() throws LibvirtExceptionError handling logic to throw errors. Must be called after every libvirt call.- Throws:
LibvirtException
-
undefine
public int undefine() throws LibvirtExceptionUndefine an interface, ie remove it from the config. This does not free the associated virInterfacePtr object.- Throws:
LibvirtException
-
-