I keep getting the message "SDRS Cannot perform vmotion becuase SDRS is disabled on this machine" errors.
Is there a powershell command to turn SDRS ON (like under the datastore cluster, Default Fully Automated Setting) for all machines and to disable the "Keep VMDK's together" setting?
I've found a resource that disables the default setting for the datastore cluster, but id like to go back and recursively apply the settings for specific VM's
Thanks!
You can configure a datastoreclusterwith the Set-DatastoreCluster cmdlet, the SDRSAutomationLevel parameter lets you specify the FullyAutomated setting.
But for finer control, you will have to use one of the API methods for now.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Only problem with that is it sets the "Default" not the current state as far as i know.
Can i set the current state for each VM with that tool? I have not found a way to do it.
On another note, in the same view, how do i DISABLE "Keep vmdks together" setting for each vm?
To disable the IntraVmAffinity per VM on the datastorecluster, you'll have to use the ConfigureStorageDrsForPod method.
Something like this
$dscName = "MyDSC"
$dsc = Get-DatastoreCluster -Name $dscName
$srm = Get-View StorageResourceManager
$spec = New-Object VMware.Vim.StorageDrsConfigSpec
Get-VM -Datastore $dsc | %{
$vmEntry = New-Object VMware.Vim.StorageDrsVmConfigSpec
$vmEntry.Operation = "edit"
$vmEntry.Info = New-Object VMware.Vim.StorageDrsVmConfigInfo
$vmEntry.Info.IntraVmAffinity = $false
$vmEntry.Info.Vm = $_.ExtensionData.MoRef
$spec.vmConfigSpec += $vmEntry
}
$srm.ConfigureStorageDrsForPod($dsc.ExtensionData.MoRef, $spec, $true)
Simlarly, to disable the intr-VM affinity rule, you can do
$dscName = "MyDSC"
$modify = $true
$dsc = Get-DatastoreCluster -Name $dscName
$srm = Get-View StorageResourceManager
$spec = New-Object VMware.Vim.StorageDrsConfigSpec
Get-VM -Datastore $dsc | %{
$vmEntry = New-Object VMware.Vim.StorageDrsVmConfigSpec
$vmEntry.Operation = "edit"
$vmEntry.Info = New-Object VMware.Vim.StorageDrsVmConfigInfo
$vmEntry.Info.IntraVmAffinity = $false
$vmEntry.Info.Behavior = [VMware.Vim.StorageDrsPodConfigInfoBehavior]::automated
$vmEntry.Info.Vm = $_.ExtensionData.MoRef
$spec.vmConfigSpec += $vmEntry
}
$srm.ConfigureStorageDrsForPod($dsc.ExtensionData.MoRef, $spec, $modify)
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Which turns the VM to "FULLY AUTOMATED" in the sdrs settings?
In my sample script, yes.
But you can change the value you assign to the Info.Behavior property.
See StorageDrsPodConfigInfoBehavior
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Will test this to see if it works, sorry for the delay. Will update whether or not the answer is correct shortly
Doesnt work. Each new drive added to the VM still attempts to do the VMDK together option and forks up the script.
Checking the clusters i see:
Get-DatastoreCluster | Select Name, @{N="DefaultIntraVmAffinity";E={($_ | Get-View).PodStorageDRSEntry.StorageDRSConfig.PodConfig.DefaultIntraVmAffinity}}
Name DefaultIntraVmAffinity
---- ----------------------
055_Autonomy_Main False
055_VSP_NoSDRS-2 False
055_VSP_NoSDRS-3 False
055_VSP_NoSDRS-4 False
055_VSP_NoSDRS-5 False
055_VSP_NoSDRS-6 False
055_VSP_NoSDRS-7 False
055_VSP_NoSDRS False
Sorry confused, are you in fact looking to have VMDK anti-affinity rules generated ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I'm looking to have the SDRS cluster NOT apply the KEEP VMDKS TOGETHER whenever a new drive is added to the cluster.
Despite having disabling the vmintraaffinity (see above) it still reverts "Keep VMDKS together" when the VM is added on to.
Hi,
I know it's been a while since you post, but have you found a solution?
I searched the web on and on and I found nothing about that. I am also looking for a solution to set up "Don't Keep VMDKs together" by default on all Datastore Cluster.
Thank you,