Connect the extension to vCenter ServerLast Updated December 16, 2024
vCenter Server
You must provide information about the
vCenter Server
instance to which you connect an extension. Set the details of the connection to vCenter Server
in the client-side stub of the extension.If you deploy your extension using the Open Virtualization Format (OVF), you can integrate it with the vCenter Extension vService. The vCenter Extension vService automates the process of registering extension with
vCenter Server
, so you do not need to provide any connection parameters. See How do I integrate an extension with the vCenter Extension vService.To connect an extension to
vCenter Server
, provide the following information to the client-side stub of the connection.- A username and password for avCenter Serveradministrator account, if you do not use the vCenter Extension vService
- The extension key for the extension
- A reference to theSessionManagerinstance in thevCenter Server
You can define the connection to
vCenter Server
in the MyVimConnection
class.The
MyManager
class can perform the following functions.- Implement theMyVimConnectionclass to establish the connection tovCenter Serverwhen the My Solution starts.
- Uses the Spring framework to obtain the connection information from themysolution.propertiesfile that you configure when you set up My Solution.
- Passes the connection property values toMyVimConnection.
- Create an instance of theManagedObjectReferencedata object to define the connection to the extension.TheMyVimConnectionclass creates aManagedObjectReferenceobject of typeServiceInstance, named_siRef.
- Define methods to get and set thevCenter Serverhost, ports, username, password, connection timeout, and session cookie.TheMyVimConnectionconstructor defines methods to obtain the host, ports, username, password, connection timeout, and session cookie from the information that you set in themysolution.propertiesfile.
- Connect tovCenter Serverby obtaining theSessionManagermanaged object for thevCenter Server.MyVimConnection.javadefines a method namedconnect(). Theconnect()method defines a standard connection tovCenter Serverthat uses WSDL. The following segment shows the calls to theSessionManager.login()andSessionManager.loginExtensionByCertificate()methods that establish the connection tovCenter Server. The_stubvariable is an instance ofVimPortType,_scis aServiceContentobject, and_siRefis theManagedObjectReferenceobject of typeServiceInstance.
- Register the extension by calling theExtensionManager.registerExtension()method.MyVimConnectiondefines aregisterExtension()method that implementsExtensionManager.registerExtension().MyManagercallsMyVimConnection.registerExtension()after it has set the properties for the extension.
You registered an extension with
vCenter Server
.Provide an extension key with which to register the extension with
vCenter Server
.