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
      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()
      Activate an interface (i.e.
      int destroy()
      Deactivate an interface (i.e.
      protected 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
      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 final int VIR_INTERFACE_XML_INACTIVE
        Get XML Flag: dump inactive interface information
        See Also:
        Constant Field Values
    • Method Detail

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

        public java.lang.String getXMLDescription​(int flags)
                                           throws LibvirtException
        Returns the XML description for theinterface
        Parameters:
        flags -
        Returns:
        String or null
        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.
        Returns:
        0 on success or -1 on error
        Throws:
        LibvirtException