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: Orchestrator Function to check the compatibility of a vCenter Virtual Machine with the destination before executing a vMotion operation.
Private Function: CheckCompatibility
private CheckCompatibility(objVcVirtualMachine: VcVirtualMachine, objVcHostSystem: VcHostSystem, objVcResourcePool: VcResourcePool): void {
let objVcSdkConnection: VcSdkConnection = objVcVirtualMachine.sdkConnection;
let objVcVirtualMachineCompatibilityChecker: VcVirtualMachineCompatibilityChecker = objVcSdkConnection.vmCompatibilityChecker;
let arrTestType: string[] = ["datastoreTests", "hostTests", "networkTests", "resourcePoolTests", "sourceTests"];
let objVcTask: VcTask = objVcVirtualMachineCompatibilityChecker.checkCompatibility_Task(objVcVirtualMachine, objVcHostSystem, objVcResourcePool, arrTestType);
objVcTask = this.WaitForVcTaskEnd(objVcTask, 1);
let objVcTaskInfo: VcTaskInfo = objVcTask.info;
let objVcTaskInfoState: VcTaskInfoState = objVcTaskInfo.state;
let objVcLocalizedMethodFault: VcLocalizedMethodFault = objVcTaskInfo.error;
let objVcMethodFault: VcMethodFault = objVcLocalizedMethodFault.fault;
if (objVcTaskInfoState === VcTaskInfoState["error"] && objVcMethodFault) {
this.objLogger.info(`${objVcTaskInfoState.name}`);
this.objLogger.info(`${objVcTaskInfoState.value}`);
this.objLogger.info(`${objVcLocalizedMethodFault.localizedMessage}`);
this.objLogger.info(`${objVcLocalizedMethodFault.message}`);
this.objLogger.info(`${objVcMethodFault.localizedMessage}`);
this.objLogger.info(`${objVcMethodFault.message}`);
}
}Discover more from Cloud Build Tools
Subscribe to get the latest posts sent to your email.
