org.libvirt

Class Device

public class Device extends Object

A device which is attached to a node
Field Summary
protected Libvirtlibvirt
The libvirt connection from the hypervisor
Method Summary
intdestroy()
Destroy the device object.
intdetach()
Dettach the node device from the node itself so that it may be assigned to a guest domain.
intfree()
Frees this device object.
StringgetName()
Returns the name of the device
intgetNumberOfCapabilities()
Returns the number of capabilities which the instance has.
StringgetParent()
Returns the parent of the device
StringgetXMLDescription()
Returns the XML description of the device
String[]listCapabilities()
List the capabilities of the device
protected voidprocessError()
Error handling logic to throw errors.
intreAttach()
ReAttach a device to the node.
intreset()
Reset a previously dettached node device to the node before or after assigning it to a guest.

Field Detail

libvirt

protected Libvirt libvirt
The libvirt connection from the hypervisor

Method Detail

destroy

public int destroy()
Destroy the device object. The virtual device is removed from the host operating system. This function may require privileged access.

Throws: LibvirtException

UNKNOWN: 0 for success, -1 for failure.

detach

public int detach()
Dettach the node device from the node itself so that it may be assigned to a guest domain.

Throws: LibvirtException

free

public int free()
Frees this device 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

getName

public String getName()
Returns the name of the device

Throws: LibvirtException

getNumberOfCapabilities

public int getNumberOfCapabilities()
Returns the number of capabilities which the instance has.

Throws: LibvirtException

getParent

public String getParent()
Returns the parent of the device

Throws: LibvirtException

getXMLDescription

public String getXMLDescription()
Returns the XML description of the device

Throws: LibvirtException

listCapabilities

public String[] listCapabilities()
List the capabilities of the device

Throws: LibvirtException

processError

protected void processError()
Error handling logic to throw errors. Must be called after every libvirt call.

reAttach

public int reAttach()
ReAttach a device to the node.

Throws: LibvirtException

reset

public int reset()
Reset a previously dettached node device to the node before or after assigning it to a guest.

Throws: LibvirtException