Merge branch 'feature-1279'

This commit is contained in:
Ruben S. Montero committed 2012-05-30 17:28:48 +02:00
commit dd6f8b22fa
65 files changed
+1230 -3187

No files matched your search

@@ -33,6 +33,7 @@ public class Host extends PoolElement{
private static final String DELETE = METHOD_PREFIX + "delete";
private static final String ENABLE = METHOD_PREFIX + "enable";
private static final String UPDATE = METHOD_PREFIX + "update";
private static final String MONITORING = METHOD_PREFIX + "monitoring";
private static final String[] HOST_STATES =
{"INIT", "MONITORING_MONITORED", "MONITORED", "ERROR", "DISABLED",
@@ -171,6 +172,19 @@ public class Host extends PoolElement{
return client.call(UPDATE, id, new_template);
}
/**
* Retrieves the monitoring information of the given host, in XML
*
* @param client XML-RPC Client.
* @param id The host id (hid) of the target machine.
* @return If successful the message contains the string
* with the monitoring information returned by OpenNebula.
*/
public static OneResponse monitoring(Client client, int id)
{
return client.call(MONITORING, id);
}
// =================================
// Instanced object XML-RPC methods
// =================================
@@ -239,6 +253,17 @@ public class Host extends PoolElement{
return update(client, id, new_template);
}
/**
* Retrieves the monitoring information of the given host, in XML
*
* @return If successful the message contains the string
* with the monitoring information returned by OpenNebula.
*/
public OneResponse monitoring()
{
return monitoring(client, id);
}
// =================================
// Helpers
// =================================
@@ -33,6 +33,7 @@ public class HostPool extends Pool implements Iterable<Host>{
private static final String ELEMENT_NAME = "HOST";
private static final String INFO_METHOD = "hostpool.info";
private static final String MONITORING = "hostpool.monitoring";
/**
* Creates a new host pool
@@ -61,6 +62,18 @@ public class HostPool extends Pool implements Iterable<Host>{
return Pool.info(client, INFO_METHOD);
}
/**
* Retrieves the monitoring data for all the hosts in the pool.
*
* @param client XML-RPC Client.
* @return If successful the message contains the string
* with the information returned by OpenNebula.
*/
public static OneResponse monitoring(Client client)
{
return client.call(MONITORING);
}
/**
* Loads the xml representation of the host pool.
*
@@ -71,6 +84,17 @@ public class HostPool extends Pool implements Iterable<Host>{
return super.info();
}
/**
* Retrieves the monitoring data for all the hosts in the pool.
*
* @return If successful the message contains the string
* with the information returned by OpenNebula.
*/
public OneResponse monitoring()
{
return monitoring(client);
}
public Iterator<Host> iterator()
{
AbstractList<Host> ab = new AbstractList<Host>()
@@ -36,6 +36,7 @@ public class VirtualMachine extends PoolElement{
private static final String SAVEDISK = METHOD_PREFIX + "savedisk";
private static final String CHOWN = METHOD_PREFIX + "chown";
private static final String CHMOD = METHOD_PREFIX + "chmod";
private static final String MONITORING = METHOD_PREFIX + "monitoring";
private static final String[] VM_STATES =
{
@@ -216,6 +217,19 @@ public class VirtualMachine extends PoolElement{
return chmod(client, CHMOD, id, octet);
}
/**
* Retrieves the monitoring information of the given VM, in XML
*
* @param client XML-RPC Client.
* @param id The virtual machine id (vid) of the target instance.
* @return If successful the message contains the string
* with the monitoring information returned by OpenNebula.
*/
public static OneResponse monitoring(Client client, int id)
{
return client.call(MONITORING, id);
}
// =================================
// Instanced object XML-RPC methods
// =================================
@@ -395,6 +409,17 @@ public class VirtualMachine extends PoolElement{
return chmod(client, id, octet);
}
/**
* Retrieves the monitoring information of the given VM, in XML
*
* @return If successful the message contains the string
* with the monitoring information returned by OpenNebula.
*/
public OneResponse monitoring()
{
return monitoring(client, id);
}
// =================================
// Helpers
// =================================
@@ -33,6 +33,7 @@ public class VirtualMachinePool extends Pool implements Iterable<VirtualMachine>
private static final String ELEMENT_NAME = "VM";
private static final String INFO_METHOD = "vmpool.info";
private static final String MONITORING = "vmpool.monitoring";
/**
* Flag for Virtual Machines in any state.
@@ -173,6 +174,27 @@ public class VirtualMachinePool extends Pool implements Iterable<VirtualMachine>
return client.call(INFO_METHOD, filter, startId, endId, state);
}
/**
* Retrieves the monitoring data for all or part of the Virtual
* Machines in the pool.
*
* @param client XML-RPC Client.
* @param filter Filter flag to use. Possible values:
* <ul>
* <li>{@link Pool#ALL}: All Virtual Machines</li>
* <li>{@link Pool#MINE}: Connected user's Virtual Machines</li>
* <li>{@link Pool#MINE_GROUP}: Connected user's Virtual Machines, and
* the ones in his group</li>
* <li>>= 0: UID User's Virtual Machines</li>
* </ul>
* @return If successful the message contains the string
* with the information returned by OpenNebula.
*/
public static OneResponse monitoring(Client client, int filter)
{
return client.call(MONITORING, filter);
}
/**
* Loads the xml representation of all or part of the
* Virtual Machines in the pool. The filter used is the one set in
@@ -255,6 +277,26 @@ public class VirtualMachinePool extends Pool implements Iterable<VirtualMachine>
return response;
}
/**
* Retrieves the monitoring data for all or part of the Virtual
* Machines in the pool.
*
* @param filter Filter flag to use. Possible values:
* <ul>
* <li>{@link Pool#ALL}: All Virtual Machines</li>
* <li>{@link Pool#MINE}: Connected user's Virtual Machines</li>
* <li>{@link Pool#MINE_GROUP}: Connected user's Virtual Machines, and
* the ones in his group</li>
* <li>>= 0: UID User's Virtual Machines</li>
* </ul>
* @return If successful the message contains the string
* with the information returned by OpenNebula.
*/
public OneResponse monitoring(int filter)
{
return monitoring(client, filter);
}
public Iterator<VirtualMachine> iterator()
{
AbstractList<VirtualMachine> ab = new AbstractList<VirtualMachine>()