Académique Documents
Professionnel Documents
Culture Documents
TheVMwareSiteRecoveryManagerAPIprovidesaninterfaceforSiteRecoveryManagerinthesameway
thattheVMwareInfrastructureAPI(VIAPI)providesinterfacesfortheVMwareVirtualInfrastructure
Management(VIM)framework.TheSRMAPIprovidesawayforthirdpartysystemstoinitiatetestsor
failoversandcollecttheresults.TheAPIsdonothelpwithsetuporfailback.TheSRMAPIprovidesthe
followingwaysforaclientapplicationtouseWebservices:
LogintotheSRMserver
ObtaintheAPIversion
GetalistofrecoveryplansattheSRMsite
GetthesettingsofaspecificrecoveryplanattheSRMsite
Startaspecificrecoveryplaninrecoveryortestmode
Pausearunningrecoveryplan
Answeraprompt
Restartapausedrecoveryplan
Cancelarecoveryplan
Getthefinalstatusofarecoveryplan
LogoutoftheSRMserver
TheSRMAPIcomplieswiththefollowingstandardsorganizations:
WebServicesInteroperabilityOrganization(WSI)BasicProfile1.0
SimpleObjectAccessProtocol(SOAP)1.1
WebServicesDescriptionLanguage(WSDL)1.1
XMLSchema1.0
WebservicesoperationsAllowyoutocreateclientapplicationsthatcanperformserverside
managementandmonitoringtasks.
WSDLTheWebservicesAPIisdefinedinaWSDLfile.TheWSDLfileisusedbyclientside,
Webservicesutilitiestocreateproxycode(stubs)thatclientapplicationsusetointeractwiththeserver.
SOAPClientapplicationsinvokeoperationsbysendingSOAPformattedmessages.Whenpassingdata
objectsbetweenclientandserver,youneedtobuildorparseaSOAPmessagethatcontainsthedataobject
propertiesasXMLelementscorrespondingtothemessagestructuresdescribedintheWSDL.
VMware, Inc.
TheSRMAPIislocatedinthefollowingdirectory:
<installdir>\www
TheSRMAPIinterfaceusesthefollowingdefaultlistenerports:
SOAP9007
WSDL9008
YoucanobtaintheWSDLfortheSRMAPIbyrequestingthefile/srm.wsdlfromtheSRMAPIWSDLport.
SrmLogin
SrmLogout
GetApiVersion
ListRecoveryPlans
RecoveryPlanSettings
RecoveryPlanStart
RecoveryPlanPause
RecoveryPlanResume
RecoveryPlanCancel
RecoveryPlanAnswerPrompt
GetFinalStatus
TheWSDLfileislocatedinthefollowingdirectory:
<installdir>\www
SNMP Traps
SRMprovidesSimpleNetworkManagementProtocol(SNMP)trapsthatcollectinformationsentbytheAPI.
AlltrapsarecompliantwiththeSNMPv1type.Informationprovidedbythetrapscanbeusedtoinitiate
actionsbyclientapplications.CallersoftheSRMAPIinterfaceshouldlistenforthefollowingSNMPtraps:
vmwareSrmRecoveryProfilePromptDisplay TheRecoveryPlan/Profileispausedwaitingforuser
input
vmwareSrmRecoveryProfilePromptResponse TheRecoveryPlanisnolongerpausedwaitingfor
userinput
vmwareSrmRecoveryVmBegin Startingtorecoveraparticularvirtualmachine
vmwareSrmRecoveryVmEnd Completedrecoveryofaparticularvirtualmachine
vmwareSrmRecoveryVmResultSuccess Aparticularvirtualmachinewasrecoveredsuccessfully
vmwareSrmRecoveryVmResultFailure Aparticularvirtualmachinefailedrecovery
vmwareSrmRecoveryVmResultWarning Aparticularvirtualmachinewasrecoveredbuttheremay
havebeenerrors
vmwareSrmRecoveryProfileExecuteTestBegin Arecoveryisstartingintestmode
vmwareSrmRecoveryProfileExecuteTestEnd ArecoveryfinishedrunninginTestmode
VMware, Inc.
vmwareSrmRecoveryProfileExecuteBegin ArecoveryisstartinginRecoverymode
vmwareSrmRecoveryProfileExecuteEnd ArecoveryfinishedrunninginRecoverymode
YoumightneedtoconfiguretheVirtualCenterServertoforwardtheSNMPtrapstotheregisteredSNMP
Server.TheMIBfileislocatedinthefollowingdirectory:
<installdir>\www\VMWARE-SRM-TRAPS-1_0.MIB
Fromyourdevelopmentworkstation,openInternetExplorer.
NavigatetotheVirtualCenterServerusingHTTPSprotocolhttps://<servername>.
ASecurityAlertmessagedisplaysawarningregardingthecertificatescertifyingauthority.
ClickViewCertificate.
ClickInstallCertificatetolaunchtheCertificateImportwizard.KeepthedefaultsettingsandclickNext.
ClickFinish.Asecuritywarningmessagedisplaysconcerningthecertificatescertifyingauthority.
ClickYes.
ACertificateImportwizardsuccessmessagedisplays.
ClickOKtodismissthesuccessmessage.
TheCertificatePropertiespagebecomesactiveagain.
ClickOKintheCertificatedialogboxtocontinuetotheserver.
TheinitialSecurityAlertmessagepresentedinstep2becomesactiveagain.
ClickYesintheSecurityAlertmessagetocontinuewiththeoriginalHTTPSrequest.
TheserverWelcomepagedisplays.ThecertificateisnowinstalledintheIEcertificatecache.
Nowthatyouhavethecertificate,yournexttaskdependsonwhatprogramminglanguageyouusetodevelop
yourclientapplications.
ForC#developers,youcancontinuesettingupyourdevelopmentenvironmentbyfollowingthe
instructionsatSettingUpforMicrosoftC#DevelopmentintheDevelopersSetupGuidelocatedat
VMwaresWebsitesupportpageunderVMwareInfrastructureSDK2.5.0.
ForJavadevelopers,youmustexportthecertificatesfromtheInternetExplorercachetoalocaldirectory.
MinimizetheInternetExplorerbrowserwindow,andexportthecertificatesasdetailedinthefollowing
procedure.
Createadirectoryforthecertificate,usingthenamesetinthevariousbatchfilesfortheVISDK:
C:\VMwareCerts.
FromtheInternetExplorerToolsmenu,selectInternetOptionstoopentheInternetOptionsproperties
page.
ClicktheContenttabtoactivatethecontentadvisor.
ClickCertificatestoopentheCertificatemanager.
VMware, Inc.
ClicktheTrustedRootCertificateAuthoritiestabtodisplaythelistoftrustedcertificates.
Scrollthroughthelistofcertificatestofindthecertificate.FortheVirtualCenterServer,thecertificate
nameisVMware.
Clickthecertificatetoselectit.
ClickExport...tolaunchtheCertificateExportWizard.
ClickNexttocontinue.TheExportFileFormatdialogdisplays.
10 Keepthedefaults(DERencodedbinaryX.509(.CER))andclickNexttocontinue.TheFileToExport
dialogdisplays,enablingyoutoenterauniquenameforthecertificate.
11
Chooseafilenameandenterit,alongwiththecompletepathtothedirectory:
C:\VMwareCerts\<servername>.cer
Ifyoudontenterthecompletepath,thecertificateisstoredinyourDocumentsandSettingsfolder.
12
ClickNexttocontinuewiththeexport.ACompletingtheCertificateExportWizardpagedisplays,
summarizingtheinformationaboutthecertificate.
13
ClickFinishtocompletetheexport.ACertificateExportWizardsuccessmessagedisplays.
14
ClickOKtodismissthesuccessmessage.
15
ClickClose.
16
ClickCanceltoclosetheInternetOptionspropertiespage.
Formoreinformationaboutsettingupyourdevelopmentenvironment,seeSettingUpforJava
DevelopmentintheDevelopersSetupGuidelocatedattheVMwareWebsitesupportpageunderVMware
InfrastructureSDK2.5.0.
ManagedObjectReference
ThemethodsforSRMusetheManagedObjectReference_this,whichisareferencetotheSessionManager
usedtomakemethodcalls.ThisisobtainedbycallingRetrieveContentontheServiceInstance.The
ServiceInstanceisobtainedbycreatingaManagedObjectReferencewhosetypeandvalueare
SrmServiceInstance.FollowingisanexampleinC#:
/// <param name="srmUrl">URL (in the form http://x.y.z.w:p/) to the SOAP port on the SRM
server</param>
public void Connect(string srmUrl)
{
_serviceRef = new ManagedObjectReference();
_serviceRef.type = "SrmServiceInstance";
_serviceRef.Value = "SrmServiceInstance";
_service = new Drextapi.SrmBinding();
_service.Url = srmUrl;
_service.CookieContainer = new System.Net.CookieContainer();
_serviceInstanceContent = _service.RetrieveContent(_serviceRef);
}
GetApiVersion
GetstheversionoftheSRMAPIontheSRMServeryouareloggedinto.
VMware, Inc.
Required Privileges
VcDr.RecoveryProfile.com.vmware.vcDr.View
Returns
returnval:theAPIversion.
GetFinalStatus
GettheXMLrepresentationoftherecoveryplanexecutiondetails.
ThismethodreturnsanXMLdocumentthatcanberetrievedoneormorelinesatatime.Youspecifywhatline
tostartatandhowmanylinesyouwant.Onlyafteryouhaveretrievedallofthelinesandputthemtogether
doyouhaveavalidXMLdocument.Thisisdonebecausethedocumentcanbeverylong(thousandsoflines).
Thedocumentreturnedisthedescriptionofthemostrecentrunofthenamedplan.
Required Privileges
VcDr.RecoveryProfile.com.vmware.vcDr.Run
Returns
return:stringarrayThisisthelistofstringsinthereturnedXMLformat:
<RecoveryPlanResult>
<RecoveryPlan>
<Name>MyPlan</Name>
<VCServer>10.18.210.221</VCServer>
<DRServer>10.18.210.222</DRServer>
</RecoveryPlan>
<Info>
<StartTime>%Y-%m-%dT%H:%M:%SZ</StartTime>
<EndTime>%Y-%m-%dT%H:%M:%SZ/EndTime>
<Mode>Test</Mode> # Mode is either test or recovery
</Info>
<Results>
# If Status is Success, then <Result> is empty
<Step type="RootStepList" status="Success">
<Name>Root</Name>
<Result/> # No Results
<Children>
<Step type="RecoveryStepGroup" status="Error">
<Name>Shutdown Protected Virtual Machines at Protected Site</Name>
<Result>
<Fault>Dr::Fault::InternalError</Fault>
<Description>error ocurred</Description>
</Result>
<Children/>
</Step>
VMware, Inc.
</Children>
</Step>
</Results>
</RecoveryPlanResult>
Faults
InvalidArgument:Thenamedplancouldnotbefound,oroffsetisnegativeortoolarge,ormaxLinesis0or
negative.
InvalidState:Thenamedplanwasnotcompleted,cancelledorerrorthrown.
ListRecoveryPlans
ListsalloftherecoveryplansatthisSRMsite.
Required Privileges
VcDr.RecoveryProfile.com.vmware.vcDr.View
Returns
returnval:AnarrayofstringslistingeveryrecoveryplanatthisSRMsite.
SrmLogin
Logsintotheserver.ThismethodfailsiftheuserIDorpasswordareinvalid.Italsofailsiftheuserisalready
loggedin.
Required Privileges
System.Anonymous
Faults
AlreadyLoggedInFault:Throwniftheuserisalreadyloggedin.
InvalidLogin:Throwniftheusernameandpasswordcombinationisinvalid.
SrmLogout
Logsoutandterminatesthecurrentsession.
Required Privileges
System.Anonymous
VMware, Inc.
Fault
NotLoggedIn:Theuserisnotloggedin.
RecoveryPlanAnswerPrompt
Answersapromptforapausedrecoveryplan.
Required Privileges
VcDr.RecoveryProfile.com.vmware.vcDr.Run
Faults
InvalidArgument:xsd:stringThenamedrecoveryplancouldnotbefound.
InvalidState:xsd:stringThenamedrecoveryplanisnotpausedorrunning.
RecoveryPlanCancel
Cancelsthenamedrecoveryplan.Therecoveryplanwillnotimmediatelycancelwhenyoucall
RecoveryPlanCancel.Itcantakeseveralminutestocanceldependingonwhatisrunningatthetime.
Required Privileges
VcDr.RecoveryProfile.com.vmware.vcDr.Run
Faults
InvalidArgument:xsd:stringThenamedrecoveryplancouldnotbefound.
InvalidState:xsd:stringThenamedrecoveryplanisnotpausedorrunning.
RecoveryPlanPause
Pausesthenamedrecoveryplan.Therecoveryplanwillnotimmediatelypausewhenyoucall
RecoveryPlanPause.Itcantakeseveralminutestopausedependingonwhatisrunningatthetime.
Required Privileges
VcDr.RecoveryProfile.com.vmware.vcDr.Run
VMware, Inc.
Faults
InvalidArgument:xsd:stringThenamedrecoveryplancouldnotbefound.
InvalidState:xsd:stringThenamedrecoveryplanisnotrunning.
RecoveryPlanResume
Resumesthenamedrecoveryplan.YoucancallRecoveryPlanResumeonarecoveryplanthatispausedonly.
YoucannotcallRecoveryPlanResumeonarecoveryplanthatisrunningorintheprocessofpausing.
Required Privileges
VcDr.RecoveryProfile.com.vmware.vcDr.Run
Faults
InvalidArgument:xsd:stringThenamedrecoveryplancouldnotbefound.
InvalidState:xsd:stringThenamedrecoveryplanisnotpaused.
RecoveryPlanSettings
Getsthesettingsforthenamedrecoveryplan.Youcanusethismethodtocheckonthestatusofarecovery
planthatisrunning.
Required Privileges
VcDr.RecoveryProfile.com.vmware.vcDr.Run
Returns
returnval:resultobject:
class Settings {
/** Name of the RecoveryPlan. */
String name;
/** Description of the RecoveryPlan. */
@optional String description;
/** The current state of the RecoveryPlan. */
RecoveryState state;
}
VMware, Inc.
Fault
InvalidArgument:xsd:stringThenamedrecoveryplancouldnotbefound.
RecoveryPlanStart
Startsthenamedrecoveryplan.
Required Privileges
VcDr.RecoveryProfile.com.vmware.vcDr.Run
Faults
InvalidArgument:xsd:stringThenamedrecoveryplancouldnotbefound.
InvalidState:xsd:stringThenamedrecoveryplanwasnotuninitialized.
Enumerations
ThissectionliststheenumerationsthatareavailablewiththeSRMAPI.Enumerationsarepredefinedvalues
usedtostoreinformationinenumeratedtypes.
Enum RecoveryMode
Theseenumerationsdeterminewhethertherecoveryplanrunsindisasterortestmode.
Recovery
Runstherecoveryplanwhenthereisadisaster.
Test
Runstherecoveryplanasatest.Itrecoversallthevirtualmachineswithinaspecified,isolatednetwork.When
thetestcompletes,alloftherecoveredvirtualmachinesarepurgedandstoragereturnedtoitsnormalstate.
Cancelled
Thenamedrecoveryplaniscancelled,butnotfinished.
Completed
Thenamedrecoveryplanhascompleted.
Error
Thenamedrecoveryplanhascompletedwithoneormoreerrors.
Paused
Thenamedrecoveryplanispaused.
VMware, Inc.
Prompting
Thenamedrecoveryplanisrunningbutrequiresauserresponsebeforecontinuing.
Running
Thenamedrecoveryplanisrunning.
Uninitialized
Thenamedrecoveryplanisnotinarunningstate.
If you have comments about this documentation, submit your feedback to: docfeedback@vmware.com
VMware, Inc. 3401 Hillview Ave., Palo Alto, CA 94304 www.vmware.com
Copyright 2008-2009 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are
covered by one or more patents listed at http://www.vmware.com/go/patents. VMware, the VMware boxes logo and design, Virtual SMP, and VMotion are registered
trademarks or trademarks of VMware, Inc. in the United States and/or other jurisdictions. All other marks and names mentioned herein may be trademarks of their respective
companies.
Item: EN-000190-00
10