VMware Cloud Community
chandar75
Contributor
Contributor
Jump to solution

any one able create the cluster under DC , using vRO Workflow (not under Folder)

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..

Reply
0 Kudos
1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee
Jump to solution

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

View solution in original post

Reply
0 Kudos
7 Replies
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi,

Check the vCenter inventory hierarchy; there you can see that clusters are child entities of host folders.

Reply
0 Kudos
chandar75
Contributor
Contributor
Jump to solution

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.

pastedImage_1.png

Reply
0 Kudos
iiliev
VMware Employee
VMware Employee
Jump to solution

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

Reply
0 Kudos
chandar75
Contributor
Contributor
Jump to solution

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 );

}

}

Reply
0 Kudos
iiliev
VMware Employee
VMware Employee
Jump to solution

https://pubs.vmware.com/vsphere-6-5/index.jsp?topic=%2Fcom.vmware.wssdk.pg.doc%2FPG_Introduction_Inv...

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.

Reply
0 Kudos
chandar75
Contributor
Contributor
Jump to solution

allright thanks for the info.... Smiley Happy 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(...);

Reply
0 Kudos
iiliev
VMware Employee
VMware Employee
Jump to solution

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.

Reply
0 Kudos