I am looking for a way to remove the vpx_disabled_methods flag on a virtual machine set by our backup software. Even after a successful backup there are some virtual machines that still have sVMotion disabled. The current way I resolve this issue is by stopping the vCenter services, clearing out the vpx_disabled_methods table in SQL, and then starting the vCenter services. Ideally I would write a function that makes the same api call that backup software vendors use to enable sVMotion. Anyone point me in the right direction?
As documented in KB2008957, a unregister/register of the VM might help.
Try with this
$vm = Get-VM -Name MyVM
$pathVMX = $vm.ExtensionData.Config.Files.VmPathName
$esx = $vm.Host
$rp = $vm.ResourcePool
Remove-Inventory -Item $vm -Confirm:$false
New-VM -VMFilePath $pathVMX -VMHost $esx -ResourcePool $rp -Confirm:$false
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
That is an alternative but the virtual machine downtime is a deal breaker. An creating the enable method api call would be ideal.
Unregister/register of a VM doesn't cause any downtime afaik.
Which API call are you referring to ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Maybe the VDDK api; I am not really sure. Our backup software sends a command to vCenter to disable storage vMotion on that virtual machine while the backup is active. Once the backup has finished the software sends another command enabling storage vMotion. What I would like do to is send that "enable" command.
I just doubled checked. An unregister requires the virtual machine to be powered down.
Remove-Inventory The attempted operation cannot be performed in the current state (Powered on).
Indeed, tried in the mean time myself, it needs to be powered off.
Wouldn't that be the TSQL that is mentioned in the KB ?
You should be able to see that in the SQL server I guess.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You can, and that is how I do it now. But doing it that way requires a vCenter service restart, along with a manual edit of the database. I would rather send the same command that the backup software is sending.
VMDude (Frédéric Martin http://www.vmdude.fr/en/) wrote an excellent app to resolve this issue. Here is a link to the app and the source code LazyMethodsEnabler tool | vmdude. I have taken his app and wrapped into a function to make easier to use with other PowerShell scripts. For this function to work you will need to download his app and the VDDK5.0 libraries located on his site. Unzip all the files to the same directory as the script. The credentials are needed for the app to log into vCenter. My script is attached to this post.