org.libvirt

Class Interface

public class Interface extends Object

A device which is attached to a node
Field Summary
protected Libvirtlibvirt
The libvirt connection from the hypervisor
static intVIR_INTERFACE_XML_INACTIVE
Get XML Flag: dump inactive interface information
Method Summary
intcreate()
Create and start a defined network.
intdestroy()
Destroy the network object.
intfree()
Frees this interface object.
StringgetMACString()
Returns the mac string of the interface
StringgetName()
Returns the name of the interface
StringgetXMLDescription(int flags)
Returns the XML description for theinterface
intisActive()
Determine if the interface is currently running
protected voidprocessError()
Error handling logic to throw errors.
intundefine()
Undefine an interface, ie remove it from the config.

Field Detail

libvirt

protected Libvirt libvirt
The libvirt connection from the hypervisor

VIR_INTERFACE_XML_INACTIVE

public static int VIR_INTERFACE_XML_INACTIVE
Get XML Flag: dump inactive interface information

Method Detail

create

public int create()
Create 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()
Destroy 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

free

public int free()
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) for success, -1 for failure.

Throws: LibvirtException

getMACString

public String getMACString()
Returns the mac string of the interface

Throws: LibvirtException

getName

public String getName()
Returns the name of the interface

Throws: LibvirtException

getXMLDescription

public String getXMLDescription(int flags)
Returns the XML description for theinterface

Throws: LibvirtException

isActive

public int isActive()
Determine 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()
Error handling logic to throw errors. Must be called after every libvirt call.

undefine

public int undefine()
Undefine an interface, ie remove it from the config. This does not free the associated virInterfacePtr object.

Throws: LibvirtException