Package org.libvirt

Class Interface


  • public class Interface
    extends java.lang.Object
    A device which is attached to a node
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected Libvirt libvirt
      The libvirt connection from the hypervisor
      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()
      Create and start a defined network.
      int destroy()
      Destroy the network object.
      void finalize()  
      int free()
      Frees this interface object.
      java.lang.String getMACString()
      Returns the mac string of the interface
      java.lang.String getName()
      Returns the name of the interface
      java.lang.String getXMLDescription​(int flags)
      Returns the XML description for theinterface
      int isActive()
      Determine if the interface is currently running
      protected void processError()
      Error handling logic to throw errors.
      int undefine()
      Undefine an interface, ie remove it from the config.
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • VIR_INTERFACE_XML_INACTIVE

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

        protected Libvirt libvirt
        The libvirt connection from the hypervisor
    • Method Detail

      • create

        public int create()
                   throws LibvirtException
        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()
                    throws LibvirtException
        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()
                 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) for success, -1 for failure.
        Throws:
        LibvirtException
      • getXMLDescription

        public java.lang.String getXMLDescription​(int flags)
                                           throws LibvirtException
        Returns the XML description for theinterface
        Throws:
        LibvirtException
      • processError

        protected void processError()
                             throws LibvirtException
        Error handling logic to throw errors. Must be called after every libvirt call.
        Throws:
        LibvirtException
      • undefine

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