Quantcast
Channel: VMware Communities : Discussion List - vSphere SDK for Perl
Viewing all articles
Browse latest Browse all 1577

How do I get all the VC servers that are in linked mode?

$
0
0

I have the username/password/url to one VC in linked mode.  How do I get all the VCs that are in linked mode?

 

Here is my code to retrieve the UserSession.   I know it's possible if you get access to com.vmware.vise.UserSession but I'm not able to do so with com.vmware.vim25.UserSession.

 

public UserSession connServer(String vcenterIP, String username, String password) throws Exception {

       String url = "https://" + vcenterIP + "/sdk/vimService";

       try {

           ManagedObjectReference managedObjRef = new ManagedObjectReference();

           managedObjRef.setType("ServiceInstance");

           managedObjRef.setValue("ServiceInstance");

           VimService vimService = new VimService();

           VimPortType vimPort = vimService.getVimPort();

 

           Map<String, Object> ctxt = ((BindingProvider) vimPort).getRequestContext();

           ctxt.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url);

           ctxt.put(BindingProvider.SESSION_MAINTAIN_PROPERTY, true);

           serviceContent = vimPort.retrieveServiceContent(managedObjRef);

           if (serviceContent.getSessionManager() != null) {

                    currentSession = vimPort.login(serviceContent.getSessionManager(), username, password, null);

           }

       } catch (Exception e) {

           System.out.println(e);

       }

        return currentSession;

}


Viewing all articles
Browse latest Browse all 1577

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>