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 Function: VcClusterComputeResourceRescanStorage
publicVcClusterComputeResourceRescanStorage(objVcClusterComputeResource:VcClusterComputeResource):void{
this.objLogger.info(`Start rescanning storage for cluster${objVcClusterComputeResource.name}.`);
try{
letarrVcHostSystem:VcHostSystem[]=objVcClusterComputeResource.host;
this.objLogger.debug(`Number of hosts to be rescanned${arrVcHostSystem.length}`);
arrVcHostSystem.forEach((objVcHostSystem:VcHostSystem):void=>{
letobjVcHostConfigManager:VcHostConfigManager=objVcHostSystem.configManager;
letobjVcHostStorageSystem:VcHostStorageSystem=objVcHostConfigManager.storageSystem;
objVcHostStorageSystem.rescanAllHba();
objVcHostStorageSystem.rescanVmfs();
objVcHostStorageSystem.refreshStorageSystem();
this.objLogger.debug(`Rescan finished for host${objVcHostSystem.name}`);
});
}
catch (objException){
Utilities.logException(objException,this.objLogger,"VcClusterComputeResourceRescanStorage",`Rescan failed for${objVcClusterComputeResource.name} cluster.`);
}
}Discover more from Cloud Build Tools
Subscribe to get the latest posts sent to your email.
