Package org.libvirt
Class Device
- java.lang.Object
-
- org.libvirt.Device
-
public class Device extends java.lang.ObjectA device which is attached to a node
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intdestroy()Destroy the device object.intdetach()Dettach the node device from the node itself so that it may be assigned to a guest domain.voidfinalize()intfree()Frees this device object.java.lang.StringgetName()Returns the name of the deviceintgetNumberOfCapabilities()Returns the number of capabilities which the instance has.java.lang.StringgetParent()Returns the parent of the devicejava.lang.StringgetXMLDescription()Returns the XML description of the devicejava.lang.String[]listCapabilities()List the capabilities of the deviceprotected 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() throws LibvirtExceptionDestroy the device object. The virtual device is removed from the host operating system. This function may require privileged access.- Returns:
- 0 for success, -1 for failure.
- Throws:
LibvirtException
-
detach
public int detach() throws LibvirtExceptionDettach the node device from the node itself so that it may be assigned to a guest domain.- Throws:
LibvirtException
-
finalize
public void finalize() throws LibvirtException- Overrides:
finalizein classjava.lang.Object- Throws:
LibvirtException
-
free
public int free() throws LibvirtExceptionFrees 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 java.lang.String getName() throws LibvirtExceptionReturns the name of the device- Throws:
LibvirtException
-
getNumberOfCapabilities
public int getNumberOfCapabilities() throws LibvirtExceptionReturns the number of capabilities which the instance has.- Throws:
LibvirtException
-
getParent
public java.lang.String getParent() throws LibvirtExceptionReturns the parent of the device- Throws:
LibvirtException
-
getXMLDescription
public java.lang.String getXMLDescription() throws LibvirtExceptionReturns the XML description of the device- Throws:
LibvirtException
-
listCapabilities
public java.lang.String[] listCapabilities() throws LibvirtExceptionList the capabilities of the device- Throws:
LibvirtException
-
processError
protected void processError() throws LibvirtExceptionError handling logic to throw errors. Must be called after every libvirt call.- Throws:
LibvirtException
-
reAttach
public int reAttach() throws LibvirtExceptionReAttach a device to the node.- Throws:
LibvirtException
-
reset
public int reset() throws LibvirtExceptionReset a previously dettached node device to the node before or after assigning it to a guest.- Throws:
LibvirtException
-
-