Cluster (OpenNebula Cloud API)
Description: declaration: package: org.opennebula.client.cluster, class: Cluster

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`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  ``
  `Cluster(int id, Client client)`
  Creates a new Cluster representation.
  `protected`
  `Cluster(Node xmlElement, Client client)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `OneResponse`
  `addDatastore(int dsId)`
  Adds a Datastore to this Cluster
  `static OneResponse`
  `addDatastore(Client client, int id, int dsId)`
  Adds a Datastore to this Cluster
  `OneResponse`
  `addHost(int hid)`
  Adds a Host to this Cluster
  `static OneResponse`
  `addHost(Client client, int id, int hid)`
  Adds a Host to this Cluster
  `OneResponse`
  `addVnet(int vnetId)`
  Adds a VNet to this Cluster
  `static OneResponse`
  `addVnet(Client client, int id, int vnetId)`
  Adds a VNet to this Cluster
  `static OneResponse`
  `allocate(Client client, 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
  `OneResponse`
  `delDatastore(int dsId)`
  Deletes a Datastore from this Cluster
  `static OneResponse`
  `delDatastore(Client client, int id, 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.
  `OneResponse`
  `delHost(int hid)`
  Deletes a Host from this Cluster
  `static OneResponse`
  `delHost(Client client, int id, int hid)`
  Deletes a Host from this Cluster
  `OneResponse`
  `delVnet(int vnetId)`
  Deletes a VNet from this Cluster
  `static OneResponse`
  `delVnet(Client client, int id, 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`
  `info(Client client, int id, boolean decrypt)`
  Retrieves the information of the given cluster.
  `OneResponse`
  `optimize()`
  Optimize Cluster
  `static OneResponse`
  `optimize(Client client, int id)`
  Optimize Cluster
  `OneResponse`
  `planDelete()`
  Delete Plan
  `static OneResponse`
  `planDelete(Client client, int id)`
  Delete Plan
  `OneResponse`
  `planExecute()`
  Execute Plan
  `static OneResponse`
  `planExecute(Client client, int id)`
  Execute Plan
  `OneResponse`
  `rename(String name)`
  Renames this Cluster
  `static OneResponse`
  `rename(Client client, int id, String name)`
  Renames this Cluster.
  `OneResponse`
  `update(String new_template)`
  Replaces the cluster template.
  `OneResponse`
  `update(String new_template, boolean append)`
  Replaces the cluster template.
  `static OneResponse`
  `update(Client client, int id, String new_template, boolean append)`
  Replaces the cluster contents.

  ### 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 Details

  - ### Cluster

    public Cluster(int id, Client client)
    Creates a new Cluster representation.
    Parameters:
      `id` - The cluster id.
      `client` - XML-RPC Client.

  - ### Cluster

    protected Cluster(Node xmlElement, Client client)
    See Also:
      - `PoolElement`

- ## Method Details

  - ### allocate

    public static OneResponse allocate(Client client, 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 from
      `decrypt` - 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, 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, String name)
    Renames this Cluster.
    Parameters:
      `client` - XML-RPC Client.
      `id` - The cluster id.
      `name` - New name for the Cluster
    Returns:
      If successful the message contains the cluster id.

  - ### optimize

    public static OneResponse optimize(Client client, int id)
    Optimize Cluster
    Parameters:
      `client` - XML-RPC Client.
      `id` - The cluster id.

  - ### planExecute

    public static OneResponse planExecute(Client client, int id)
    Execute Plan
    Parameters:
      `client` - XML-RPC Client.
      `id` - The cluster id.

  - ### planDelete

    public static OneResponse planDelete(Client client, int id)
    Delete Plan
    Parameters:
      `client` - XML-RPC Client.
      `id` - 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(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(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(String name)
    Renames this Cluster
    Parameters:
      `name` - New name for the Cluster.
    Returns:
      If an error occurs the error message contains the reason.

  - ### optimize

    public OneResponse optimize()
    Optimize Cluster
    Returns:
      If an error occurs the error message contains the reason.

  - ### planExecute

    public OneResponse planExecute()
    Execute Plan
    Returns:
      If an error occurs the error message contains the reason.

  - ### planDelete

    public OneResponse planDelete()
    Delete Plan
    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.