Package org.opennebula.client.cluster
Class Cluster
- java.lang.Object
-
- org.opennebula.client.PoolElement
-
- org.opennebula.client.cluster.Cluster
-
public class Cluster extends PoolElement
This class represents an OpenNebula cluster. It also offers static XML-RPC call wrappers.
-
-
Field Summary
-
Fields inherited from class org.opennebula.client.PoolElement
client, id, xml, xpath
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description OneResponse
addDatastore(int dsId)
Adds a Datastore to this Clusterstatic OneResponse
addDatastore(Client client, int id, int dsId)
Adds a Datastore to this ClusterOneResponse
addHost(int hid)
Adds a Host to this Clusterstatic OneResponse
addHost(Client client, int id, int hid)
Adds a Host to this ClusterOneResponse
addVnet(int vnetId)
Adds a VNet to this Clusterstatic OneResponse
addVnet(Client client, int id, int vnetId)
Adds a VNet to this Clusterstatic OneResponse
allocate(Client client, java.lang.String name)
Allocates a new cluster in OpenNebulaboolean
containsDatastore(int id)
Returns whether or not the datastore is part of this clusterboolean
containsHost(int id)
Returns whether or not the host is part of this clusterboolean
containsVnet(int id)
Returns whether or not the vnet is part of this clusterOneResponse
delDatastore(int dsId)
Deletes a Datastore from this Clusterstatic OneResponse
delDatastore(Client client, int id, int dsId)
Deletes a Datastore from this ClusterOneResponse
delete()
Deletes the cluster from OpenNebula.static OneResponse
delete(Client client, int id)
Deletes a cluster from OpenNebula.OneResponse
delHost(int hid)
Deletes a Host from this Clusterstatic OneResponse
delHost(Client client, int id, int hid)
Deletes a Host from this ClusterOneResponse
delVnet(int vnetId)
Deletes a VNet from this Clusterstatic OneResponse
delVnet(Client client, int id, int vnetId)
Deletes a VNet from this ClusterOneResponse
info()
Loads the xml representation of the cluster.static OneResponse
info(Client client, int id)
Retrieves the information of the given cluster.static OneResponse
info(Client client, int id, boolean decrypt)
Retrieves the information of the given cluster.OneResponse
rename(java.lang.String name)
Renames this Clusterstatic OneResponse
rename(Client client, int id, java.lang.String name)
Renames this Cluster.OneResponse
update(java.lang.String new_template)
Replaces the cluster template.OneResponse
update(java.lang.String new_template, boolean append)
Replaces the cluster template.static OneResponse
update(Client client, int id, java.lang.String new_template, boolean append)
Replaces the cluster contents.
-
-
-
Constructor Detail
-
Cluster
public Cluster(int id, Client client)
Creates a new Cluster representation.- Parameters:
id
- The cluster id.client
- XML-RPC Client.
-
Cluster
protected Cluster(org.w3c.dom.Node xmlElement, Client client)
- See Also:
PoolElement
-
-
Method Detail
-
allocate
public static OneResponse allocate(Client client, java.lang.String name)
Allocates a new cluster in OpenNebula- Parameters:
client
- XML-RPC Client.name
- Name for the new cluster.- Returns:
- If successful the message contains the associated id generated for this cluster.
-
info
public static OneResponse info(Client client, int id)
Retrieves the information of the given cluster.- Parameters:
client
- XML-RPC Client.id
- The cluster id.- Returns:
- If successful the message contains the string with the information returned by OpenNebula.
-
info
public static OneResponse info(Client client, int id, boolean decrypt)
Retrieves the information of the given cluster.- Parameters:
client
- XML-RPC Client.id
- The Cluster id for the Cluster to retrieve the information fromdecrypt
- If true decrypt sensitive attributes- Returns:
- If successful the message contains the string with the information returned by OpenNebula.
-
delete
public static OneResponse delete(Client client, int id)
Deletes a cluster from OpenNebula.- Parameters:
client
- XML-RPC Client.id
- The cluster id.- Returns:
- A encapsulated response.
-
update
public static OneResponse update(Client client, int id, java.lang.String new_template, boolean append)
Replaces the cluster contents.- Parameters:
client
- XML-RPC Client.id
- The id of the target cluster we want to modify.new_template
- New template contents.append
- True to append new attributes instead of replace the whole template- Returns:
- If successful the message contains the cluster id.
-
addHost
public static OneResponse addHost(Client client, int id, int hid)
Adds a Host to this Cluster- Parameters:
client
- XML-RPC Client.id
- The cluster id.hid
- Host ID.- Returns:
- A encapsulated response.
-
delHost
public static OneResponse delHost(Client client, int id, int hid)
Deletes a Host from this Cluster- Parameters:
client
- XML-RPC Client.id
- The cluster id.hid
- Host ID.- Returns:
- A encapsulated response.
-
addDatastore
public static OneResponse addDatastore(Client client, int id, int dsId)
Adds a Datastore to this Cluster- Parameters:
client
- XML-RPC Client.id
- The cluster id.dsId
- Datastore ID.- Returns:
- A encapsulated response.
-
delDatastore
public static OneResponse delDatastore(Client client, int id, int dsId)
Deletes a Datastore from this Cluster- Parameters:
client
- XML-RPC Client.id
- The cluster id.dsId
- Datastore ID.- Returns:
- A encapsulated response.
-
addVnet
public static OneResponse addVnet(Client client, int id, int vnetId)
Adds a VNet to this Cluster- Parameters:
client
- XML-RPC Client.id
- The cluster id.vnetId
- VNet ID.- Returns:
- A encapsulated response.
-
delVnet
public static OneResponse delVnet(Client client, int id, int vnetId)
Deletes a VNet from this Cluster- Parameters:
client
- XML-RPC Client.id
- The cluster id.vnetId
- VNet ID.- Returns:
- A encapsulated response.
-
rename
public static OneResponse rename(Client client, int id, java.lang.String name)
Renames this Cluster.- Parameters:
client
- XML-RPC Client.id
- The image id of the target host we want to modify.name
- New name for the Cluster- Returns:
- If successful the message contains the cluster id.
-
info
public OneResponse info()
Loads the xml representation of the cluster. The info is also stored internally.- See Also:
info(Client, int)
-
delete
public OneResponse delete()
Deletes the cluster from OpenNebula.- See Also:
delete(Client, int)
-
update
public OneResponse update(java.lang.String new_template)
Replaces the cluster template.- Parameters:
new_template
- New cluster template.- Returns:
- If successful the message contains the cluster id.
-
update
public OneResponse update(java.lang.String new_template, boolean append)
Replaces the cluster template.- Parameters:
new_template
- New cluster template.append
- True to append new attributes instead of replace the whole template- Returns:
- If successful the message contains the cluster id.
-
addHost
public OneResponse addHost(int hid)
Adds a Host to this Cluster- Parameters:
hid
- Host ID.- Returns:
- A encapsulated response.
-
delHost
public OneResponse delHost(int hid)
Deletes a Host from this Cluster- Parameters:
hid
- Host ID.- Returns:
- A encapsulated response.
-
addDatastore
public OneResponse addDatastore(int dsId)
Adds a Datastore to this Cluster- Parameters:
dsId
- Datastore ID.- Returns:
- A encapsulated response.
-
delDatastore
public OneResponse delDatastore(int dsId)
Deletes a Datastore from this Cluster- Parameters:
dsId
- Datastore ID.- Returns:
- A encapsulated response.
-
addVnet
public OneResponse addVnet(int vnetId)
Adds a VNet to this Cluster- Parameters:
vnetId
- VNet ID.- Returns:
- A encapsulated response.
-
delVnet
public OneResponse delVnet(int vnetId)
Deletes a VNet from this Cluster- Parameters:
vnetId
- VNet ID.- Returns:
- A encapsulated response.
-
rename
public OneResponse rename(java.lang.String name)
Renames this Cluster- Parameters:
name
- New name for the Cluster.- Returns:
- If an error occurs the error message contains the reason.
-
containsHost
public boolean containsHost(int id)
Returns whether or not the host is part of this cluster- Parameters:
id
- The host ID.- Returns:
- Whether or not the host is part of this cluster.
-
containsDatastore
public boolean containsDatastore(int id)
Returns whether or not the datastore is part of this cluster- Parameters:
id
- The datastore ID.- Returns:
- Whether or not the datastore is part of this cluster.
-
containsVnet
public boolean containsVnet(int id)
Returns whether or not the vnet is part of this cluster- Parameters:
id
- The vnet ID.- Returns:
- Whether or not the vnet is part of this cluster.
-
-