OpenNebula clusters group compatible hosts, datastores, and virtual networks so the scheduler can place VMs only on resources that work together. A named cluster is useful when different hardware generations, storage backends, or network fabrics should stay separated instead of sharing one capacity pool.
The CLI path uses onecluster to create the logical object and attach existing resources. Hosts belong to one cluster at a time, while datastores and virtual networks can belong to more than one cluster when their drivers and physical connectivity are available to every host that may use them.
Use an OpenNebula front-end shell with infrastructure administration privileges, commonly the oneadmin account. Resource names such as host01, system, and priv-ovswitch represent existing objects in the cloud; substitute names that match the prepared compute node, system datastore, and virtual network.
Related: How to add a host to OpenNebula
Related: How to create an OpenNebula datastore
Related: How to create an OpenNebula virtual network
$ onecluster list ID NAME HOSTS NETS DATASTORES
$ onecluster create production ID: 100
$ onecluster show production CLUSTER 100 INFORMATION ID : 100 NAME : production HOSTS VNETS DATASTORES
$ onecluster addhost production host01
A host can belong to only one cluster. Moving an active host changes where the scheduler can place workloads that need that host's resources.
Related: How to add a host to OpenNebula
$ onecluster addvnet production priv-ovswitch
The network backing must exist on the hosts that will run VMs attached to this virtual network.
$ onecluster adddatastore production system
An OpenNebula cluster needs at least one system datastore before the scheduler can deploy VMs into it. Use the default system datastore or a datastore created for the same storage driver and host layout.
$ onecluster list ID NAME HOSTS NETS DATASTORES 100 production 1 1 1
$ onecluster show production CLUSTER 100 INFORMATION ID : 100 NAME : production HOSTS 0 VNETS 1 DATASTORES 0
The ID lists should match the host, virtual network, and datastore assigned in the earlier steps.