Introduction
Today, I will set up a storage DRS cluster in vCenter using VCF Orchestrator.
Objective
The aim is to cover the most common functionality and make it as generic as possible.
Something like this…

Here’s how to achieve it. My objectives were to:
- Support multiple vCenters.
- Support multiple datastore clusters.
- Allow default and common settings adjustments.
- Provide defaults where applicable.
vCenters
To retrieve all vCenters and display them in the custom form’s dropdown, I use a simple function as an action element, fetching all objects of type VC:SdkConnection
and returning them as an array, as expected by the dropdown box.
/**
*
* @return {Array/string}
*/
(function () {
const sdkConnections = Server.findAllForType('c') as VcSdkConnection[];
const vcNames = sdkConnections.map(vc =>
vc.id
);
return vcNames;
});
Datastore Clusters
To fetch all available clusters, the approach is similar (writing a function in the action element), but the code differs.
First, I obtain the SDK connection (vCenter) as an object using a pre-written function called getVcSdkConnectionByName
, available here. Once obtained, I use a built-in method called getAllVimManagedObject
to fetch StoragePod
(datastore cluster in API terms) as the managed object. This method returns an array of objects (datastoreClusters
variable), so I can retrieve all available datastore clusters in that vCenter.
If this array is not empty (important to check), I loop through it to get names to display in the workflow dropdown box.
/**
* @param {string} vCenter - vCenter name
*
* @return {Array/string}
*/
(function (vCenter) {
if (!vCenter) return [""];
let datastoreClusters = [];
if (vCenter) {
const sdkConnection = System.getModule('com.examples.vmware_aria_orchestrator_examples.actions')
.vcSdkManagement()
.VcSdkManagement.prototype.getVcSdkConnectionByName(vCenter);
datastoreClusters = sdkConnection.getAllVimManagedObjects("StoragePod", null, null);
}
if (datastoreClusters.length !== 0) {
let datastoreClusterNames = [];
for (var i = 0; i
The Logic
To manipulate a datastore cluster, several requirements must be defined:
StorageResourceManager
VcStoragePod
VcStorageDrsConfigSpec
And more, depending on the use cases to be covered. In my case,