10. 12
Extend Your Recovery Plans
Recover Physical
Workloads
Update DNS
Send Recovery
Notifications
Integrate With
Other Systems
11. 13
SRM Command Steps
Top-Level Commands Per-VM Commands
Where can
they
execute?
On the SRM server On the SRM server
On the Recovered VM
(requires VM tools)
When can
they
execute?
Any top level step during:
Failover, Migration, or Testing
Pre or Post Power-on
When executed on the VM
only post power-on steps!
Environment
Variables?
VMware_RecoveryName
VMware_RecoveryMode
VMware_VC_Host
VMware_VC_Port
VMware_VM_Uuid
VMware_VM_Name
VMware_VM_Ref
VMware_VM_Path
Post Power-On:
VMware_VM_GuestName
VMware_VM_GuestIP
12. 14
Demo Time: What Am I Going To Show?
1. Call PowerShell script on SRM server
2. Call /bin/sh on recovered VM
3. How do I write scripts that work for both failover and failback?
4. Can I execute different behavior between test and failover?
5. How do I securely store credentials in my scripts?
16. 18
3. How do I Write Scripts that Work for Both
Failover and Failback?
# PowerShell
if ($env:VMware_VC_Host -eq ‘vc-w8-
01a.corp.local‘) {
# action when target is site A
} else {
# action when target is site B
}
17. 19
4. Can I Execute Different Behavior Between Test and Failover?
# PowerShell
if ($env:VMware_VC_RecoveryMode -eq ‘test‘) {
# action during test
} else {
# other action
}
18. 20
5. How Do I Securely Store Credentials in My Scripts?
# PowerCLI to store
New-VICredentialStoreItem `
–Host $env:VMware_VC_Host `
–User ‘Administrator’ `
–Password ‘VMware1!’ `
–File ‘c:scriptsvicredentials.txt’
19. 21
SRM Command Steps – Key Takeaways
Useful tool but not a “hammer” for everything
Don’t do too much in custom scripts
• Look at RTO impact running a script
Avoid changing scripts for failback
• Use Environment Variables for conditional logic
21. 23
“There are known knowns.
These are things we know that
we know.
“There are known unknowns.
That is to say, there are things
that we know we don't know.
“But there are also unknown
unknowns. There are things
we don't know we don't know.”
- Donald Rumsfeld
22. 24
6 Types of SRM Events
Site Status
vSphere
Replication
Protection Group Storage and
Storage Provider
Permissions &
Licensing
Recovery
23. 25
Some Interesting Alarms To Monitor
Remote Site Down VM Not Protected
VM Datastore
Replication Lost
Placeholder VM
Deleted
Array Pair Ping
Failed
VM Lost
License Expiring
License Expired
Recovery Plan
Destroyed
Recovery Plan
Started
vSphere Replication
Paused
RPO Violated
Remote VRM Site
Disconnected
29. 32
“Gotchas” When Calling SRM API From PowerShell
PowerShell v3 or later
• (v2 can’t handle the WSDL)
New-WebServiceProxy
• Not a lightweight call!
• Useful for POC, exploration etc.
30. 33
SRM API – Key Takeaways
Introspect & Protect:
• Protection Group Information
• Recovery History
• Configure VMs for protection
Initiate:
• Failover
• Test
• Cancel
• Revert
• Reprotect
33. 38
Backup: Resources
Related Sessions at VMworld
• BCO4905 - Disaster Recovery Solution with Oracle Data Guard and Site
Recovery Manager
• OPT5474 - The Transformative Power and Business Case
for Cloud Automation
SRM Documentation
• http://www.vmware.com/support/pubs/srm_pubs.html
SRM Book
• Administering VMware Site Recovery Manager 5 – by Mike Laverick
Scripts From Presentation
• https://github.com/benmeadowcroft/BCO5652
[provided for illustrative purposes only]
34. 39
Backup: Managing Scripts
Source Control
• Use it (I like DVCS like mercurial and git)
Script Location
• Local Disk
• Network Share (personally not a huge fan of this, potential POF during DR)
Keeping Scripts in Sync (if stored on SRM server or VM)
• Various Options:
• Config. management tool, e.g. Puppet to distribute and ensure continued compliance
• File sync tool, e.g. rsync
35. 40
Other VMware Activities Related to This Session
HOL:
HOL-SDC-1305
Business Continuity and Disaster Recovery In Action
Group Discussions:
BCO1003-GD
Disaster Recovery and Replication with Ken Werneburg