Class VirtualMachinePool

  • All Implemented Interfaces:
    java.lang.Iterable<VirtualMachine>

    public class VirtualMachinePool
    extends Pool
    implements java.lang.Iterable<VirtualMachine>
    This class represents an OpenNebula VM pool. It also offers static XML-RPC call wrappers.
    • Field Detail

      • ALL_VM

        public static final int ALL_VM
        Flag for Virtual Machines in any state.
        See Also:
        Constant Field Values
      • NOT_DONE

        public static final int NOT_DONE
        Flag for Virtual Machines in any state, except for DONE.
        See Also:
        Constant Field Values
    • Constructor Detail

      • VirtualMachinePool

        public VirtualMachinePool​(Client client)
        Creates a new Virtual Machine pool with the default filter flag value set to Pool.MINE_GROUP (Virtual Machines belonging to the connected user, and the ones in his group)
        Parameters:
        client - XML-RPC Client.
        See Also:
        VirtualMachinePool(Client, int)
      • VirtualMachinePool

        public VirtualMachinePool​(Client client,
                                  int filter)
        Creates a new Virtual Machine pool.
        Parameters:
        client - XML-RPC Client.
        filter - Filter flag to use by default in the method info(). Possible values:
        • Pool.ALL: All Virtual Machines
        • Pool.MINE: Connected user's Virtual Machines
        • Pool.MINE_GROUP: Connected user's Virtual Machines, and the ones in his group
        • Pool.GROUP: User's primary group Virtual Machines
        • >= 0 UID User's Virtual Machines
    • Method Detail

      • factory

        public PoolElement factory​(org.w3c.dom.Node node)
        Description copied from class: Pool
        The factory method returns a suitable PoolElement object from an XML node. Each Pool must implement the corresponding factory method.
        Specified by:
        factory in class Pool
        Parameters:
        node - XML Dom node to build the PoolElement from
        Returns:
        The corresponding PoolElement
      • info

        public static OneResponse info​(Client client,
                                       int filter)
        Retrieves all or part of the Virtual Machines in the pool.
        Parameters:
        client - XML-RPC Client.
        filter - Filter flag to use. Possible values:
        • Pool.ALL: All Virtual Machines
        • Pool.MINE: Connected user's Virtual Machines
        • Pool.MINE_GROUP: Connected user's Virtual Machines, and the ones in his group
        • Pool.GROUP: User's primary group Virtual Machines
        • >= 0 UID User's Virtual Machines
        Returns:
        If successful the message contains the string with the information returned by OpenNebula.
      • info_extended

        public static OneResponse info_extended​(Client client,
                                                int filter)
        Retrieves all of the Virtual Machines in the pool.
        Parameters:
        client - XML-RPC Client.
        filter - Filter flag to use. Possible values:
        • Pool.ALL: All Virtual Machines
        • Pool.MINE: Connected user's Virtual Machines
        • Pool.MINE_GROUP: Connected user's Virtual Machines, and the ones in his group
        • Pool.GROUP: User's primary group Virtual Machines
        • >= 0 UID User's Virtual Machines
        Returns:
        If successful the message contains the string with the information returned by OpenNebula.
      • infoAll

        public static OneResponse infoAll​(Client client)
        Retrieves all the Virtual Machines in the pool.
        Parameters:
        client - XML-RPC Client.
        Returns:
        If successful the message contains the string with the information returned by OpenNebula.
      • infoMine

        public static OneResponse infoMine​(Client client)
        Retrieves all the connected user's Virtual Machines.
        Parameters:
        client - XML-RPC Client.
        Returns:
        If successful the message contains the string with the information returned by OpenNebula.
      • infoGroup

        public static OneResponse infoGroup​(Client client)
        Retrieves all the connected user's Virtual Machines and the ones in his group.
        Parameters:
        client - XML-RPC Client.
        Returns:
        If successful the message contains the string with the information returned by OpenNebula.
      • info

        public static OneResponse info​(Client client,
                                       int filter,
                                       int startId,
                                       int endId,
                                       int state)
        Retrieves all or part of the Virtual Machines in the pool. The Virtual Machines to retrieve can be also filtered by Id, specifying the first and last Id to include; and by state.
        Parameters:
        client - XML-RPC Client.
        filter - Filter flag to use. Possible values:
        • Pool.ALL: All Virtual Machines
        • Pool.MINE: Connected user's Virtual Machines
        • Pool.MINE_GROUP: Connected user's Virtual Machines, and the ones in his group
        • Pool.GROUP: User's primary group Virtual Machines
        • >= 0 UID User's Virtual Machines
        startId - Lowest Id to retrieve
        endId - Biggest Id to retrieve
        state - Numeric state of the Virtual Machines wanted, or one of ALL_VM or NOT_DONE
        Returns:
        If successful the message contains the string with the information returned by OpenNebula.
      • info_search

        public static OneResponse info_search​(Client client,
                                              int filter,
                                              int startId,
                                              int endId,
                                              int state,
                                              java.lang.String query)
        Retrieves all or part of the Virtual Machines in the pool. The Virtual Machines to retrieve can be also filtered by Id, specifying the first and last Id to include; and by state.
        Parameters:
        client - XML-RPC Client.
        filter - Filter flag to use. Possible values:
        • Pool.ALL: All Virtual Machines
        • Pool.MINE: Connected user's Virtual Machines
        • Pool.MINE_GROUP: Connected user's Virtual Machines, and the ones in his group
        • Pool.GROUP: User's primary group Virtual Machines
        • >= 0 UID User's Virtual Machines
        startId - Lowest Id to retrieve
        endId - Biggest Id to retrieve
        state - Numeric state of the Virtual Machines wanted, or one of ALL_VM or NOT_DONE
        query - query for FTS
        Returns:
        If successful the message contains the string with the information returned by OpenNebula.
      • monitoring

        public static OneResponse monitoring​(Client client,
                                             int filter)
        Retrieves the monitoring data for all or part of the Virtual Machines in the pool.
        Parameters:
        client - XML-RPC Client.
        filter - Filter flag to use. Possible values:
        • Pool.ALL: All Virtual Machines
        • Pool.MINE: Connected user's Virtual Machines
        • Pool.MINE_GROUP: Connected user's Virtual Machines, and the ones in his group
        • Pool.GROUP: User's primary group Virtual Machines
        • >= 0 UID User's Virtual Machines
        Returns:
        If successful the message contains the string with the information returned by OpenNebula.
      • monitoring

        public static OneResponse monitoring​(Client client,
                                             int filter,
                                             int num)
        Retrieves the monitoring data for all or part of the Virtual Machines in the pool.
        Parameters:
        client - XML-RPC Client.
        filter - Filter flag to use. Possible values:
        • Pool.ALL: All Virtual Machines
        • Pool.MINE: Connected user's Virtual Machines
        • Pool.MINE_GROUP: Connected user's Virtual Machines, and the ones in his group
        • Pool.GROUP: User's primary group Virtual Machines
        • >= 0 UID User's Virtual Machines
        num - : Retrieve monitor records in the last num seconds. 0 just the last record, -1 all records.
        Returns:
        If successful the message contains the string with the information returned by OpenNebula.
      • info

        public OneResponse info()
        Loads the xml representation of all or part of the Virtual Machines in the pool. The filter used is the one set in the constructor.
        Overrides:
        info in class Pool
        Returns:
        If successful the message contains the string with the information returned by OpenNebula.
        See Also:
        info(Client, int)
      • info_extended

        public OneResponse info_extended()
        Loads the xml representation of all the Virtual Machines in the pool. The filter used is the one set in the constructor.
        Returns:
        If successful the message contains the string with the information returned by OpenNebula.
        See Also:
        info(Client, int)
      • infoAll

        public OneResponse infoAll()
        Loads the xml representation of all the Virtual Machines in the pool.
        Overrides:
        infoAll in class Pool
        Returns:
        If successful the message contains the string with the information returned by OpenNebula.
      • infoMine

        public OneResponse infoMine()
        Loads the xml representation of all the connected user's Virtual Machines.
        Overrides:
        infoMine in class Pool
        Returns:
        If successful the message contains the string with the information returned by OpenNebula.
      • infoGroup

        public OneResponse infoGroup()
        Loads the xml representation of all the connected user's Virtual Machines and the ones in his group.
        Overrides:
        infoGroup in class Pool
        Returns:
        If successful the message contains the string with the information returned by OpenNebula.
      • info

        public OneResponse info​(int filter,
                                int startId,
                                int endId,
                                int state)
        Retrieves all or part of the Virtual Machines in the pool. The Virtual Machines to retrieve can be also filtered by Id, specifying the first and last Id to include.
        Parameters:
        filter - Filter flag to use. Possible values:
        • Pool.ALL: All Virtual Machines
        • Pool.MINE: Connected user's Virtual Machines
        • Pool.MINE_GROUP: Connected user's Virtual Machines, and the ones in his group
        • Pool.GROUP: User's primary group Virtual Machines
        • >= 0 UID User's Virtual Machines
        startId - Lowest Id to retrieve
        endId - Biggest Id to retrieve
        state - Numeric state of the Virtual Machines wanted
        Returns:
        If successful the message contains the string with the information returned by OpenNebula.
      • monitoring

        public OneResponse monitoring​(int filter)
        Retrieves the monitoring data for all or part of the Virtual Machines in the pool.
        Parameters:
        filter - Filter flag to use. Possible values:
        • Pool.ALL: All Virtual Machines
        • Pool.MINE: Connected user's Virtual Machines
        • Pool.MINE_GROUP: Connected user's Virtual Machines, and the ones in his group
        • Pool.GROUP: User's primary group Virtual Machines
        • >= 0 UID User's Virtual Machines
        Returns:
        If successful the message contains the string with the information returned by OpenNebula.
      • getById

        public VirtualMachine getById​(int id)
        Returns the Virtual Machine with the given Id from the pool. If it is not found, then returns null. The method info() must be called before.
        Overrides:
        getById in class Pool
        Parameters:
        id - of the ACl rule to retrieve
        Returns:
        The Virtual Machine with the given Id, or null if it was not found.