Package org.libvirt

Class Interface

java.lang.Object
org.libvirt.Interface

public class Interface extends Object
A device which is attached to a node
  • Field Details

    • VIR_INTERFACE_XML_INACTIVE

      public static final int VIR_INTERFACE_XML_INACTIVE
      Get XML Flag: dump inactive interface information
      See Also:
  • Method Details

    • 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 class 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 String getMACString() throws LibvirtException
      Returns the mac string of the interface
      Returns:
      String or null
      Throws:
      LibvirtException
    • getName

      public String getName() throws LibvirtException
      Returns the name of the interface
      Returns:
      String or null
      Throws:
      LibvirtException
    • getXMLDescription

      public 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:
    • 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