Orchestrator Function: VcClusterComputeResouceReconfigure

by Simon Sparks · January 5, 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

private VcClusterComputeResouceReconfigure(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 {

    let objVcClusterConfigSpecEx: VcClusterConfigSpecEx = new VcClusterConfigSpecEx();
    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`);

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

        this.WaitForVcTaskEnd(objVcTask, 1);

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

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

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

        if (objException instanceof VcRuntimeFault) {
            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.`);
        }

        return false;
    }
}

Discover more from Cloud Build Tools

Subscribe to get the latest posts sent to your email.

You may also like