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.
  • 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:
  • 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:
    • delete

      public OneResponse delete()
      Deletes the cluster from OpenNebula.
      See Also:
    • 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.