To use this function add it to the class library file named PluginVCVirtualMachineService.ts
GitHub Repository: https://github.com/SimonSparksUK/Orchestrator
Filename: PluginVCVirtualMachineService.ts
Description: Disable a dedicated GPU on a vCenter Virtual Machine
Public Function: GPUPassthroughEnable
publicGPUPassthroughDisable(objVcVirtualMachine:VcVirtualMachine,strVendorID:string,strDeviceID:string):boolean{
letobjVcVirtualPCIPassthrough:VcVirtualPCIPassthrough=this.buildVcVirtualPCIPassthrough(strVendorID,strDeviceID);
letobjVcVirtualDeviceConfigSpec:VcVirtualDeviceConfigSpec=this.VcVirtualDeviceConfigSpecCreate(objVcVirtualPCIPassthrough,VcVirtualDeviceConfigSpecOperation.remove);
letarrVcVirtualDeviceConfigSpec:VcVirtualDeviceConfigSpec[]= [];
arrVcVirtualDeviceConfigSpec.push(objVcVirtualDeviceConfigSpec);
letintMemoryGB:number=parseInt(objVcVirtualMachine.memory);
letobjVcResourceAllocationInfo:VcResourceAllocationInfo=newVcResourceAllocationInfo();
objVcResourceAllocationInfo.reservation=4096;// TO DO - SS - Get this value from the VcVirtualMachine
letobjVcVirtualMachineConfigSpec:VcVirtualMachineConfigSpec=newVcVirtualMachineConfigSpec();
objVcVirtualMachineConfigSpec.memoryAllocation=objVcResourceAllocationInfo;
objVcVirtualMachineConfigSpec.deviceChange=arrVcVirtualDeviceConfigSpec;
objVcVirtualMachineConfigSpec.memoryReservationLockedToMax=false;
letblnReturn:boolean=this.Reconfigure(objVcVirtualMachine,objVcVirtualMachineConfigSpec);
returnblnReturn;
}TypeScriptDiscover more from Cloud Build Tools
Subscribe to get the latest posts sent to your email.
