Package org.libvirt
Class Interface
- java.lang.Object
-
- org.libvirt.Interface
-
public class Interface extends java.lang.Object
A device which is attached to a node
-
-
Field Summary
Fields Modifier and Type Field Description static int
VIR_INTERFACE_XML_INACTIVE
Get XML Flag: dump inactive interface information
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
create()
Activate an interface (i.e.int
destroy()
Deactivate an interface (i.e.protected void
finalize()
int
free()
Frees this interface object.java.lang.String
getMACString()
Returns the mac string of the interfacejava.lang.String
getName()
Returns the name of the interfacejava.lang.String
getXMLDescription(int flags)
Returns the XML description for theinterfaceint
isActive()
Determine if the interface is currently runningint
undefine()
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 LibvirtException
Activate 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 LibvirtException
Deactivate 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:
finalize
in classjava.lang.Object
- Throws:
LibvirtException
-
free
public int free() throws LibvirtException
Frees 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 LibvirtException
Returns the mac string of the interface- Returns:
- String or null
- Throws:
LibvirtException
-
getName
public java.lang.String getName() throws LibvirtException
Returns the name of the interface- Returns:
- String or null
- Throws:
LibvirtException
-
getXMLDescription
public java.lang.String getXMLDescription(int flags) throws LibvirtException
Returns the XML description for theinterface- Parameters:
flags
-- Returns:
- String or null
- Throws:
LibvirtException
-
isActive
public int isActive() throws LibvirtException
Determine if the interface is currently running- Returns:
- 1 if running, 0 if inactive
- Throws:
LibvirtException
- See Also:
- Libvirt Documentation
-
undefine
public int undefine() throws LibvirtException
Undefine 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
-
-