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 validity of a vMotion operation before executing it.
Private Function: CheckVMotion
privateCheckVMotion(objVcVirtualMachine:VcVirtualMachine,objVcHostSystem:VcHostSystem,objVcResourcePool:VcResourcePool,objVcVirtualMachinePowerState:VcVirtualMachinePowerState):void{
letobjVcSdkConnection:VcSdkConnection=objVcVirtualMachine.sdkConnection;
letobjVcVirtualMachineProvisioningChecker:VcVirtualMachineProvisioningChecker=objVcSdkConnection.vmProvisioningChecker;
letarrTestType:string[]= ["datastoreTests","hostTests","networkTests","resourcePoolTests","sourceTests"];
letobjVcTask:VcTask=objVcVirtualMachineProvisioningChecker.checkMigrate_Task(objVcVirtualMachine,objVcHostSystem,objVcResourcePool,objVcVirtualMachinePowerState,arrTestType);
objVcTask=this.WaitForVcTaskEnd(objVcTask,1);
letobjVcTaskInfo:VcTaskInfo=objVcTask.info;
letobjVcTaskInfoState:VcTaskInfoState=objVcTaskInfo.state;
letobjVcLocalizedMethodFault:VcLocalizedMethodFault=objVcTaskInfo.error;
letobjVcMethodFault: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.
