Package org.opennebula.client.vm
Class VirtualMachinePool
java.lang.Object
org.opennebula.client.Pool
org.opennebula.client.vm.VirtualMachinePool
- All Implemented Interfaces:
Iterable<VirtualMachine>
This class represents an OpenNebula VM pool.
It also offers static XML-RPC call wrappers.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Flag for Virtual Machines in any state.static final int
Flag for Virtual Machines in any state, except for DONE.Fields inherited from class org.opennebula.client.Pool
ALL, client, elementName, GROUP, infoMethod, MINE, MINE_GROUP, poolElements, xpath
-
Constructor Summary
ConstructorsConstructorDescriptionVirtualMachinePool
(Client client) Creates a new Virtual Machine pool with the default filter flag value set toPool.MINE_GROUP
(Virtual Machines belonging to the connected user, and the ones in his group)VirtualMachinePool
(Client client, int filter) Creates a new Virtual Machine pool. -
Method Summary
Modifier and TypeMethodDescriptionaccounting
(int filter, int start_time, int end_time) Returns the virtual machine history records.static OneResponse
accounting
(Client client, int filter, int start_time, int end_time) Returns the virtual machine history records.calculateshowback
(int filter, int first_month, int first_year, int last_month, int last_year) Processes all the history records, and stores the monthly cost for each VMstatic OneResponse
calculateshowback
(Client client, int filter, int first_month, int first_year, int last_month, int last_year) Processes all the history records, and stores the monthly cost for each VMThe factory method returns a suitable PoolElement object from an XML node.getById
(int id) Returns the Virtual Machine with the given Id from the pool.info()
Loads the xml representation of all or part of the Virtual Machines in the pool.info
(int filter, int startId, int endId, int state) Retrieves all or part of the Virtual Machines in the pool.static OneResponse
Retrieves all or part of the Virtual Machines in the pool.static OneResponse
Retrieves all or part of the Virtual Machines in the pool.Loads the xml representation of all the Virtual Machines in the pool.static OneResponse
info_extended
(Client client, int filter) Retrieves all of the Virtual Machines in the pool.static OneResponse
info_extended
(Client client, int vm_ids, boolean extended) Retrieves all of the Virtual Machines in the vm_ids list.static OneResponse
info_search
(Client client, int filter, int startId, int endId, int state, String query) Retrieves all or part of the Virtual Machines in the pool.infoAll()
Loads the xml representation of all the Virtual Machines in the pool.static OneResponse
Retrieves all the Virtual Machines in the pool.Loads the xml representation of all the connected user's Virtual Machines and the ones in his group.static OneResponse
Retrieves all the connected user's Virtual Machines and the ones in his group.infoMine()
Loads the xml representation of all the connected user's Virtual Machines.static OneResponse
Retrieves all the connected user's Virtual Machines.iterator()
monitoring
(int filter) Retrieves the monitoring data for all or part of the Virtual Machines in the pool.static OneResponse
monitoring
(Client client, int filter) Retrieves the monitoring data for all or part of the Virtual Machines in the pool.static OneResponse
monitoring
(Client client, int filter, int num) Retrieves the monitoring data for all or part of the Virtual Machines in the pool.showback
(int filter, int first_month, int first_year, int last_month, int last_year) Returns the virtual machine showback recordsstatic OneResponse
Returns the virtual machine showback recordsMethods inherited from class org.opennebula.client.Pool
getLength, info, info, info, infoAll, infoGroup, infoGroupPrimary, infoMine, item, processInfo, xmlrpcInfo
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
ALL_VM
public static final int ALL_VMFlag for Virtual Machines in any state.- See Also:
-
NOT_DONE
public static final int NOT_DONEFlag for Virtual Machines in any state, except for DONE.- See Also:
-
-
Constructor Details
-
VirtualMachinePool
Creates a new Virtual Machine pool with the default filter flag value set toPool.MINE_GROUP
(Virtual Machines belonging to the connected user, and the ones in his group)- Parameters:
client
- XML-RPC Client.- See Also:
-
VirtualMachinePool
Creates a new Virtual Machine pool.- Parameters:
client
- XML-RPC Client.filter
- Filter flag to use by default in the methodinfo()
. Possible values:Pool.ALL
: All Virtual MachinesPool.MINE
: Connected user's Virtual MachinesPool.MINE_GROUP
: Connected user's Virtual Machines, and the ones in his groupPool.GROUP
: User's primary group Virtual Machines- >= 0 UID User's Virtual Machines
-
-
Method Details
-
factory
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. -
info
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 MachinesPool.MINE
: Connected user's Virtual MachinesPool.MINE_GROUP
: Connected user's Virtual Machines, and the ones in his groupPool.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
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 MachinesPool.MINE
: Connected user's Virtual MachinesPool.MINE_GROUP
: Connected user's Virtual Machines, and the ones in his groupPool.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
Retrieves all of the Virtual Machines in the vm_ids list.- Parameters:
client
- XML-RPC Client.vm_ids
- Comma separated list of VM IDs.extended
- If true the extended body is retrieved.- Returns:
- If successful the message contains the string with the information returned by OpenNebula.
-
infoAll
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
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
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
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 MachinesPool.MINE
: Connected user's Virtual MachinesPool.MINE_GROUP
: Connected user's Virtual Machines, and the ones in his groupPool.GROUP
: User's primary group Virtual Machines- >= 0 UID User's Virtual Machines
startId
- Lowest Id to retrieveendId
- Biggest Id to retrievestate
- Numeric state of the Virtual Machines wanted, or one ofALL_VM
orNOT_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, 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 MachinesPool.MINE
: Connected user's Virtual MachinesPool.MINE_GROUP
: Connected user's Virtual Machines, and the ones in his groupPool.GROUP
: User's primary group Virtual Machines- >= 0 UID User's Virtual Machines
startId
- Lowest Id to retrieveendId
- Biggest Id to retrievestate
- Numeric state of the Virtual Machines wanted, or one ofALL_VM
orNOT_DONE
query
- query for FTS- Returns:
- If successful the message contains the string with the information returned by OpenNebula.
-
monitoring
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 MachinesPool.MINE
: Connected user's Virtual MachinesPool.MINE_GROUP
: Connected user's Virtual Machines, and the ones in his groupPool.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
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 MachinesPool.MINE
: Connected user's Virtual MachinesPool.MINE_GROUP
: Connected user's Virtual Machines, and the ones in his groupPool.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.
-
accounting
Returns the virtual machine history records.- Parameters:
client
- XML-RPC Client.filter
- Filter flag to use. Possible values:Pool.ALL
: All Virtual MachinesPool.MINE
: Connected user's Virtual MachinesPool.MINE_GROUP
: Connected user's Virtual Machines, and the ones in his groupPool.GROUP
: User's primary group Virtual Machines- >= 0 UID User's Virtual Machines
start_time
- : Start time for the time interval. Can be -1, in which case the time interval won't have a left boundary.end_time
- : End time for the time interval. Can be -1, in which case the time interval won't have a right boundary.- Returns:
- If successful the message contains the string with the information returned by OpenNebula.
-
showback
public static OneResponse showback(Client client, int filter, int first_month, int first_year, int last_month, int last_year) Returns the virtual machine showback records- Parameters:
client
- XML-RPC Client.filter
- Filter flag to use. Possible values:Pool.ALL
: All Virtual MachinesPool.MINE
: Connected user's Virtual MachinesPool.MINE_GROUP
: Connected user's Virtual Machines, and the ones in his groupPool.GROUP
: User's primary group Virtual Machines- >= 0 UID User's Virtual Machines
first_month
- First month for the time interval. January is 1. Can be -1, in which case the time interval won't have a left boundary.first_year
- First year for the time interval. Can be -1, in which case the time interval won't have a left boundary.last_month
- Last month for the time interval. January is 1. Can be -1, in which case the time interval won't have a right boundary.last_year
- Last year for the time interval. Can be -1, in which case the time interval won't have a right boundary.- Returns:
- If successful the message contains the string with the information returned by OpenNebula.
-
calculateshowback
public static OneResponse calculateshowback(Client client, int filter, int first_month, int first_year, int last_month, int last_year) Processes all the history records, and stores the monthly cost for each VM- Parameters:
client
- XML-RPC Client.filter
- Filter flag to use. Possible values:Pool.ALL
: All Virtual MachinesPool.MINE
: Connected user's Virtual MachinesPool.MINE_GROUP
: Connected user's Virtual Machines, and the ones in his groupPool.GROUP
: User's primary group Virtual Machines- >= 0 UID User's Virtual Machines
first_month
- First month for the time interval. January is 1. Can be -1, in which case the time interval won't have a left boundary.first_year
- First year for the time interval. Can be -1, in which case the time interval won't have a left boundary.last_month
- Last month for the time interval. January is 1. Can be -1, in which case the time interval won't have a right boundary.last_year
- Last year for the time interval. Can be -1, in which case the time interval won't have a right boundary.- Returns:
- If an error occurs the error message contains the reason.
-
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. -
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:
-
infoAll
Loads the xml representation of all the Virtual Machines in the pool. -
infoMine
Loads the xml representation of all the connected user's Virtual Machines. -
infoGroup
Loads the xml representation of all the connected user's Virtual Machines and the ones in his group. -
info
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 MachinesPool.MINE
: Connected user's Virtual MachinesPool.MINE_GROUP
: Connected user's Virtual Machines, and the ones in his groupPool.GROUP
: User's primary group Virtual Machines- >= 0 UID User's Virtual Machines
startId
- Lowest Id to retrieveendId
- Biggest Id to retrievestate
- Numeric state of the Virtual Machines wanted- Returns:
- If successful the message contains the string with the information returned by OpenNebula.
-
monitoring
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 MachinesPool.MINE
: Connected user's Virtual MachinesPool.MINE_GROUP
: Connected user's Virtual Machines, and the ones in his groupPool.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.
-
accounting
Returns the virtual machine history records.- Parameters:
filter
- Filter flag to use. Possible values:Pool.ALL
: All Virtual MachinesPool.MINE
: Connected user's Virtual MachinesPool.MINE_GROUP
: Connected user's Virtual Machines, and the ones in his groupPool.GROUP
: User's primary group Virtual Machines- >= 0 UID User's Virtual Machines
start_time
- : Start time for the time interval. Can be -1, in which case the time interval won't have a left boundary.end_time
- : End time for the time interval. Can be -1, in which case the time interval won't have a right boundary.- Returns:
- If successful the message contains the string with the information returned by OpenNebula.
-
showback
public OneResponse showback(int filter, int first_month, int first_year, int last_month, int last_year) Returns the virtual machine showback records- Parameters:
filter
- Filter flag to use. Possible values:Pool.ALL
: All Virtual MachinesPool.MINE
: Connected user's Virtual MachinesPool.MINE_GROUP
: Connected user's Virtual Machines, and the ones in his groupPool.GROUP
: User's primary group Virtual Machines- >= 0 UID User's Virtual Machines
first_month
- First month for the time interval. January is 1. Can be -1, in which case the time interval won't have a left boundary.first_year
- First year for the time interval. Can be -1, in which case the time interval won't have a left boundary.last_month
- Last month for the time interval. January is 1. Can be -1, in which case the time interval won't have a right boundary.last_year
- Last year for the time interval. Can be -1, in which case the time interval won't have a right boundary.- Returns:
- If successful the message contains the string with the information returned by OpenNebula.
-
calculateshowback
public OneResponse calculateshowback(int filter, int first_month, int first_year, int last_month, int last_year) Processes all the history records, and stores the monthly cost for each VM- Parameters:
filter
- Filter flag to use. Possible values:Pool.ALL
: All Virtual MachinesPool.MINE
: Connected user's Virtual MachinesPool.MINE_GROUP
: Connected user's Virtual Machines, and the ones in his groupPool.GROUP
: User's primary group Virtual Machines- >= 0 UID User's Virtual Machines
first_month
- First month for the time interval. January is 1. Can be -1, in which case the time interval won't have a left boundary.first_year
- First year for the time interval. Can be -1, in which case the time interval won't have a left boundary.last_month
- Last month for the time interval. January is 1. Can be -1, in which case the time interval won't have a right boundary.last_year
- Last year for the time interval. Can be -1, in which case the time interval won't have a right boundary.- Returns:
- If an error occurs the error message contains the reason.
-
iterator
- Specified by:
iterator
in interfaceIterable<VirtualMachine>
-
getById
Returns the Virtual Machine with the given Id from the pool. If it is not found, then returns null. The methodinfo()
must be called before.
-