Orchestrator Function: vCenter Cluster Compute Resource Reconfigure

by Simon Sparks · 5 January 2026

To use this function add it to the class library file named vCenterServerService.ts

GitHub Repository: https://github.com/SimonSparksUK/Orchestrator

Filename: vCenterServerService.ts

Public Function: VcClusterComputeResouceReconfigure

privateVcClusterComputeResouceReconfigure(objVcClusterComputeResource:VcClusterComputeResource,
objVcClusterDrsConfigInfo?:VcClusterDrsConfigInfo,
objVcClusterDasConfigInfo?:VcClusterDasConfigInfo,
arrVcClusterRuleSpec?:VcClusterRuleSpec[],
arrVcClusterDrsVmConfigSpec?:VcClusterDrsVmConfigSpec[],
arrVcClusterGroupSpec?:VcClusterGroupSpec[],
objVcClusterOrchestrationInfo?:VcClusterOrchestrationInfo,
arrVcClusterVmOrchestrationSpec?:VcClusterVmOrchestrationSpec[],
arrVcClusterDasVmConfigSpec?:VcClusterDasVmConfigSpec[],
objVcClusterInfraUpdateHaConfigInfo?:VcClusterInfraUpdateHaConfigInfo,
objVcClusterProactiveDrsConfigInfo?:VcClusterProactiveDrsConfigInfo,
objVcDesiredSoftwareSpec?:VcDesiredSoftwareSpec
):boolean{

letobjVcClusterConfigSpecEx:VcClusterConfigSpecEx=newVcClusterConfigSpecEx();
objVcClusterConfigSpecEx.spbmEnabled=true;
objVcClusterConfigSpecEx.defaultHardwareVersionKey="";

if (objVcClusterDrsConfigInfo){
objVcClusterConfigSpecEx.drsConfig=objVcClusterDrsConfigInfo;
}
if (objVcClusterDasConfigInfo){
objVcClusterConfigSpecEx.dasConfig=objVcClusterDasConfigInfo;
}
if (arrVcClusterRuleSpec){
objVcClusterConfigSpecEx.rulesSpec=arrVcClusterRuleSpec;
}
if (arrVcClusterGroupSpec){
objVcClusterConfigSpecEx.groupSpec=arrVcClusterGroupSpec;
}
if (arrVcClusterGroupSpec){
objVcClusterConfigSpecEx.orchestration=objVcClusterOrchestrationInfo;
}
if (arrVcClusterVmOrchestrationSpec){
objVcClusterConfigSpecEx.vmOrchestrationSpec=arrVcClusterVmOrchestrationSpec;
}
if (arrVcClusterDasVmConfigSpec){
objVcClusterConfigSpecEx.dasVmConfigSpec=arrVcClusterDasVmConfigSpec;
}
if (arrVcClusterDrsVmConfigSpec){
objVcClusterConfigSpecEx.drsVmConfigSpec=arrVcClusterDrsVmConfigSpec;
}
if (objVcClusterInfraUpdateHaConfigInfo){
objVcClusterConfigSpecEx.infraUpdateHaConfig=objVcClusterInfraUpdateHaConfigInfo;
}
if (objVcClusterProactiveDrsConfigInfo){
objVcClusterConfigSpecEx.proactiveDrsConfig=objVcClusterProactiveDrsConfigInfo;
}
if (objVcDesiredSoftwareSpec){
//@ts-ignore
objVcClusterConfigSpecEx.desiredSoftwareSpec=objVcDesiredSoftwareSpec;
}

try{
Locking.lock(`${objVcClusterComputeResource.name}-Modification`);

letobjVcTask:VcTask=objVcClusterComputeResource.reconfigureCluster_Task(objVcClusterConfigSpecEx,true);

this.WaitForVcTaskEnd(objVcTask,1);

Locking.unlock(`${objVcClusterComputeResource.name}-Modification`);

returntrue;
}
catch (objException){
Locking.unlock(`${objVcClusterComputeResource.name}-Modification`);

Utilities.logException(objException,this.objLogger,"VcClusterComputeResouceReconfigure");

if (objExceptioninstanceofVcRuntimeFault){
this.objLogger.error(`Thrown if any type of runtime fault is thrown that is not covered by the other faults; for example, a communication error.`);
}

returnfalse;
}
}

Discover more from Cloud Build Tools

Subscribe to get the latest posts sent to your email.

You may also like