dont see any script class to create the cluster on Orchestrator.... all i see under DC folder or host folder etc.... any one can throw the sample....
appreciate..
You can get the root host folder of the datacenter and create the cluster there. something like:
var myDatacenter = ...; // variable containing your datacenter object of type VC:Datacenter
var myNewCluster = myDatacenter.hostFolder.createClusterEx(...); // create the cluster
Hi,
Check the vCenter inventory hierarchy; there you can see that clusters are child entities of host folders.
correct all the methods i see under folder (host folder, dc folder OR storage folder etc...) to create the cluster, im looking for create a cluster under direct DC.
You can get the root host folder of the datacenter and create the cluster there. something like:
var myDatacenter = ...; // variable containing your datacenter object of type VC:Datacenter
var myNewCluster = myDatacenter.hostFolder.createClusterEx(...); // create the cluster
yaa the key i dont want or i dont have here is folder (in my DC Hierarchy). the bold part below, there is no option i see without folder, under DC how i can create the cluster. thanks for your response.
var clusterConfigSpec = new VcClusterConfigSpec();
var allCLs = VcPlugin.getAllClusterComputeResources();
for each (var c in allCLs) {
if (ClusterName == null) {
System.log ("Cannot create the cluster for unknown reason");
}
else if (c.name === ClusterName) {
ClusterName = c; // found by name
System.log ("Cluster Name found OR cluster already Exist: " + ClusterName.name);
break;
}
else {
var ClusterNameOut = DCname.createCluster(ClusterName, clusterConfigSpec);
System.log ("Cluster Created: " + ClusterNameOut );
}
}
That's what I'm trying to explain - in the object hierarchy, cluster objects are children entity of a folder. For every datacenter, the vCenter automatically creates folders to hold the corresponding children types. Including a folder for cluster objects, and you can reference this folder in vRO via property hostFolder of the datacenter object.
The way you create clusters is using exactly the code I provided in the previous post - datacenterObject.hostFolder.createClusterEx(clustername, spec)
You may not like it, or not want it, but this is how the things work in vCenter.
allright thanks for the info.... got it, i was on impression that a folder creation is mandatory -under DC to create cluster through vRO. (its just part of the syntex and not required a real folder back in vCenter.)
myDatacenter.hostFolder.createClusterEx(...);
Right, applications like vCenter client can decide to hide such automatically created folders and show the clusters as direct children of the datacenter nodes. But this is done in the UI logic; the folders are still there in the object hierarchy model.
I guess the same 'hiding' could have been done also on API level. It shouldn't be a problem to expose createClusterEx() method also for datacenter type, and then automatically translate calls like datacenterObjec.createClusterEx() to datacenterObject.hostFolder.createClusterEx(), but such 'alias' is not implemented.