Orchestrator Functions: VcVirtualMachineReserveCPU

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 VcVirtualMachineReserveCPU(objVcVirtualMachine: VcVirtualMachine, intVcSharesInfoCPU: number, intVcResourceAllocationInfoCPUReservation: number): boolean {

    let objVcSharesInfoCPU: VcSharesInfo = new VcSharesInfo();
    objVcSharesInfoCPU.shares = intVcSharesInfoCPU;
    objVcSharesInfoCPU.level = VcSharesLevel.normal;

    let objVcResourceAllocationInfoCPU: VcResourceAllocationInfo = new VcResourceAllocationInfo();
    objVcResourceAllocationInfoCPU.reservation = intVcResourceAllocationInfoCPUReservation;
    objVcResourceAllocationInfoCPU.shares = objVcSharesInfoCPU;

    let objVcVirtualMachineConfigSpec: VcVirtualMachineConfigSpec = new VcVirtualMachineConfigSpec();
    objVcVirtualMachineConfigSpec.cpuAllocation = objVcResourceAllocationInfoCPU;

    let blnReturn: boolean = this.VcVirtualMachineReconfigure(objVcVirtualMachine, objVcVirtualMachineConfigSpec);

    return blnReturn;
}

Discover more from Cloud Build Tools

Subscribe to get the latest posts sent to your email.

You may also like