Quick post here. So I have been reviewing some great posts from @vmKen and @BenMeadowcroft about automating Site Recovery Manager operations with PowerCLI and wanted to give it a try myself. They outlined the process rather clearly in their blogs so it was a breeze to get most of the stuff up and running. But when I went to actually execute a test recovery or a recovery etc. it kept failing! The PowerCLI command to start the recovery was $VMrp.Start($RPmode)–the $VMrp being my recovery plan and the $RPMode being the recovery plan mode of a recovery. The command was accepted but the recovery plan never started.
I got the following error in vCenter:
Unable to start the requested operation. Another operation may be in progress. Please wait for it to finish and try again.
Hmm…weird. I could kick off a test from the GUI with no issue so nothing was “interfering” from what I could tell. I thought maybe since I was using Site Recovery Manager 5.8 maybe something had changed so I tried it with my 5.5 environment and got the same result.
After I was about to lose my mind it finally occurred to me that I was connecting to the protected vCenter and the protected SRM server (I did enter in remote credentials for the recovery SRM server though). While I could query the recovery plan etc without issue from here, maybe SRM didn’t allow a recovery plan to be started unless you directly connected to the recovery vCenter/SRM server.
So I reconnected to the recovery site and it worked! So I guess it makes a difference, so FYI. Now there might be a workaround to this and it is definitely possible I missed something that allows this but this seems to be what you need to do. If you find this isn’t true please let me know!
Thanks Ken and Ben for getting me started!! Cool stuff. Kens posts:
http://blogs.vmware.com/vsphere/2014/05/automate-failover-with-srm.html
http://blogs.vmware.com/vsphere/2014/05/srm-powercli-reporting.html
http://blogs.vmware.com/vsphere/2014/05/powercli-and-the-srm-api.html
Hi,
Nicely explained. Even I am facing the same issue. I am not able to understand like how should i connect to recovery vCenter/SRM server directly. Like executing the same command i used to connect to proteced vCenter/SRM server or by providing RemoteUser and RemotePassword parameter to Connect-SRMServer while connecting to protected SRM Server
Thanks in advance
From my experience it seems to be best to connect to the protected SRM server if you want to do configuration and connect to recovery if you need to start an operation. Are your credentials the same for vCenter as SRM?
so you mean to say I should not connect to protected vCenter and SRM and connect only to recovery vCenter and SRM for starting an operation??
This is what I am doing right now:
Connect-VIServer -Server
$Srm = Connect-SrmServer -Server -RemoteCredential -Credential
$SrmApi = $Srm.ExtensionData
$rp = $SrmApi.Recovery.ListPlans()
$RPmode = New-Object VMware.VimAutomation.Srm.Views.SrmRecoveryPlanRecoveryMode
$RPmode.value__ = 1
$rp[0].Start($RPmode)
Even I am getting the same error which you have mentioned in your post.
I dint understand your sentence:
While I could query the recovery plan etc without issue from here, maybe SRM didn’t allow a recovery plan to be started unless you directly connected to the recovery vCenter/SRM server.
Should I need to connect to both or one???
Sorry for the previous reply. I replied without trying it out… I just tried and it worked.
Thanks a lot
Ah ok great, glad to hear!