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 static intVIR_INTERFACE_XML_INACTIVEGet XML Flag: dump inactive interface information
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcreate()Activate an interface (i.e.intdestroy()Deactivate an interface (i.e.protected 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 runningintundefine()Undefine an interface, ie remove it from the config.
-
-
-
Field Detail
-
VIR_INTERFACE_XML_INACTIVE
public static final int VIR_INTERFACE_XML_INACTIVE
Get XML Flag: dump inactive interface information- See Also:
- Constant Field Values
-
-
Method Detail
-
create
public int create() throws LibvirtExceptionActivate an interface (i.e. call "ifup").If there was an open network config transaction at the time this interface was defined (that is, if virInterfaceChangeBegin() had been called), the interface will be brought back down (and then undefined) if virInterfaceChangeRollback() is called.
- Returns:
- 0 on success or -1 on error
- Throws:
LibvirtException
-
destroy
public int destroy() throws LibvirtExceptionDeactivate an interface (i.e. call "ifdown").This does not remove the interface from the config, and does not free the associated virInterfacePtr object.
If there is an open network config transaction at the time this interface is destroyed (that is, if virInterfaceChangeBegin() had been called), and if the interface is later undefined and then virInterfaceChangeRollback() is called, the restoral of the interface definition will also bring the interface back up.
- Returns:
- 0 on success or -1 on error
- Throws:
LibvirtException
-
finalize
protected 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)
- Throws:
LibvirtException
-
getMACString
public java.lang.String getMACString() throws LibvirtExceptionReturns the mac string of the interface- Returns:
- String or null
- Throws:
LibvirtException
-
getName
public java.lang.String getName() throws LibvirtExceptionReturns the name of the interface- Returns:
- String or null
- Throws:
LibvirtException
-
getXMLDescription
public java.lang.String getXMLDescription(int flags) throws LibvirtExceptionReturns the XML description for theinterface- Parameters:
flags-- Returns:
- String or null
- Throws:
LibvirtException
-
isActive
public int isActive() throws LibvirtExceptionDetermine if the interface is currently running- Returns:
- 1 if running, 0 if inactive
- Throws:
LibvirtException- See Also:
- Libvirt Documentation
-
undefine
public int undefine() throws LibvirtExceptionUndefine an interface, ie remove it from the config. This does not free the associated virInterfacePtr object.- Returns:
- 0 on success or -1 on error
- Throws:
LibvirtException
-
-