Managing Clusters 3.6
A Cluster is a group of Hosts. Clusters can have associated Datastores and Virtual Networks, this is how the administrator sets which Hosts have the underlying requirements for each Datastore and Virtual Network configured.
Clusters are managed with the ''onecluster'' command. To create new Clusters, use onecluster create <name>
. Existing Clusters can be inspected with the onecluster list
and show
commands.
<xterm> $ onecluster list
ID NAME HOSTS NETS DATASTORES
$ onecluster create production ID: 100
$ onecluster list
ID NAME HOSTS NETS DATASTORES
100 production 0 0 0
$ onecluster show production CLUSTER 100 INFORMATION ID : 100 NAME : production
HOSTS
VNETS
DATASTORES </xterm>
Hosts can be created directly in a Cluster, using the –cluster
option of onehost create
, or be added at any moment using the command onecluster addhost
. Hosts can be in only one Cluster at a time.
To delete a Host from a Cluster, the command onecluster delhost
must be used. When a Host is removed from a Cluster, it is seen as part of the Cluster 'none', more about this below.
In the following example, we will add Host 0 to the Cluster we created before. You will notice that the onecluster show
command will list the Host ID 0 as part of the Cluster.
<xterm> $ onehost list
ID NAME CLUSTER RVM TCPU FCPU ACPU TMEM FMEM AMEM STAT 0 host01 - 7 400 290 400 3.7G 2.2G 3.7G on
$ onecluster addhost production host01
$ onehost list
ID NAME CLUSTER RVM TCPU FCPU ACPU TMEM FMEM AMEM STAT 0 host01 producti 7 400 290 400 3.7G 2.2G 3.7G on
$ onecluster show production CLUSTER 100 INFORMATION ID : 100 NAME : production
HOSTS 0
VNETS
DATASTORES </xterm>
Datastores and Virtual Networks can be added to one Cluster. This means that any Host in that Cluster is properly configured to run VMs using Images from the Datastores, or is using leases from the Virtual Networks.
For instance, if you have several Hosts configured to use the iSCSI datastore drivers and Open vSwitch networks, you would group them in the same Cluster. The Scheduler will know that VMs using these resources can be deployed in any of the Hosts of the Cluster.
These operations can be done with the onecluster
addvnet/delvnet
and adddatastore/deldatastore
:
<xterm> $ onecluster addvnet production priv-ovswitch
$ onecluster adddatastore production iscsi
$ onecluster list
ID NAME HOSTS NETS DATASTORES
100 production 1 1 1
$ onecluster show 100 CLUSTER 100 INFORMATION ID : 100 NAME : production
HOSTS 0
VNETS 1
DATASTORES 100 </xterm>
Hosts, Datastores and Virtual Networks can be grouped into clusters, but this is optional. By default, these resources are created outside of any Cluster, what can be seen as a special Cluster named 'none' in Sunstone. In the CLI, this Cluster name is shown as '-'.
Virtual Machines using resources from Datastores or Virtual Networks in the Cluster 'none' can be deployed in any Host, which must be properly configured.
Hosts in the Cluster 'none' will only run VMs using resources without a Cluster.
When a Virtual Machine uses resources (Images or Virtual Networks) from a Cluster, OpenNebula adds the following requirement to the template:
<xterm> $ onevm show 0 […] REQUIREMENTS=“CLUSTER_ID = 100” </xterm>
Because of this, if you try to use resources from more than one Cluster, the Virtual Machine creation will fail with a message similar to this one:
<xterm> $ onetemplate instantiate 0 [TemplateInstantiate] Error allocating a new virtual machine. Incompatible cluster IDs. DISK [0]: IMAGE [0] from DATASTORE [1] requires CLUSTER [101] NIC [0]: NETWORK [1] requires CLUSTER [100] </xterm>
The system datastore holds files for running VMs. Each cluster can use a different system datastore, read more in the system datastore guide.
The Sunstone UI interface offers an easy way to manage clusters and the resources whithin them. You will find the cluster submenu under the infraestructure menu. From there, you will be able to: