CoralBargi
Contributor
Contributor

SDRS recommendations executing one at a time

Hi,

Have a Storage array that doesn't do well with multiple concurrent storage vmotions.

Would like to run SDRS recommendation one at a time as to not overload it.
Found plenty of code to apply all the recommendations (like below from @LucD ) but my powershell is not strong enough to figure out how to have it execute synchronously 🙂

If anyone could help I'd be very grateful 

 

$dscName = 'MyDSC'

$dsc = Get-View -ViewType StoragePod -Filter @{'Name'=$dscName}

$si = Get-View ServiceInstance

$storMgr = Get-View -Id $si.Content.StorageResourceManager

$storMgr.RefreshStorageDrsRecommendation($dsc.MoRef)

$dsc.UpdateViewData()

if($dsc.PodStorageDrsEntry.Recommendation){

    $dsc.PodStorageDrsEntry.Recommendation | %{

        $storMgr.ApplyStorageDrsRecommendationToPod_Task($dsc.MoRef,$_.Key)

    }

}

0 Kudos
1 Reply
LucD
Leadership
Leadership

Change the method ApplyStorageDrsRecommendationToPod_Task to ApplyStorageDrsRecommendationToPod, then it will run synchronously.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos