OpenNebula
Cloud API

org.opennebula.client.cluster
Class Cluster

java.lang.Object
  extended by org.opennebula.client.PoolElement
      extended by 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
 
Constructor Summary
  Cluster(int id, Client client)
          Creates a new Cluster representation.
protected Cluster(org.w3c.dom.Node xmlElement, Client client)
           
 
Method Summary
static OneResponse addDatastore(Client client, int id, int dsId)
          Adds a Datastore to this Cluster
 OneResponse addDatastore(int dsId)
          Adds a Datastore to this Cluster
static OneResponse addHost(Client client, int id, int hid)
          Adds a Host to this Cluster
 OneResponse addHost(int hid)
          Adds a Host to this Cluster
static OneResponse addVnet(Client client, int id, int vnetId)
          Adds a VNet to this Cluster
 OneResponse addVnet(int vnetId)
          Adds a VNet to this Cluster
static OneResponse allocate(Client client, java.lang.String name)
          Allocates a new cluster in OpenNebula
 boolean containsDatastore(int id)
          Returns whether or not the datastore is part of this cluster
 boolean containsHost(int id)
          Returns whether or not the host is part of this cluster
 boolean containsVnet(int id)
          Returns whether or not the vnet is part of this cluster
static OneResponse delDatastore(Client client, int id, int dsId)
          Deletes a Datastore from this Cluster
 OneResponse delDatastore(int dsId)
          Deletes a Datastore from this Cluster
 OneResponse delete()
          Deletes the cluster from OpenNebula.
static OneResponse delete(Client client, int id)
          Deletes a cluster from OpenNebula.
static OneResponse delHost(Client client, int id, int hid)
          Deletes a Host from this Cluster
 OneResponse delHost(int hid)
          Deletes a Host from this Cluster
static OneResponse delVnet(Client client, int id, int vnetId)
          Deletes a VNet from this Cluster
 OneResponse delVnet(int vnetId)
          Deletes a VNet from this Cluster
 OneResponse info()
          Loads the xml representation of the cluster.
static OneResponse info(Client client, int id)
          Retrieves the information of the given cluster.
static OneResponse update(Client client, int id, java.lang.String new_template)
          Replaces the cluster contents.
 OneResponse update(java.lang.String new_template)
          Replaces the cluster template.
 
Methods inherited from class org.opennebula.client.PoolElement
chmod, chmod, chmod, getId, getName, gid, id, processInfo, state, uid, xpath
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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.

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)
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.
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.

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.

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.

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.

OpenNebula
Cloud API

Visit OpenNebula.org
Copyright 2002-2012 © OpenNebula Project Leads (OpenNebula.org).