Hi,
What I am trying to achieve is this:
Create a new Home View where the user can enter some config info. When the user clicks the submit button, trigger a background job to traverse the vCenter tree (as can be seen in the MOB), and retrieve information about the ESX Servers and Virtual Machines as well. (Assume I have a single vCenter Server).
I wanted to use the default utilities (QueryUtil, ObjectUtil, etc.) and not have to munge using the vSphere SDK (the vim25.jar classes that is) if possible. However, I am stuck at how to retrieve the "objectId" of the vCenter server itself. The sample code shows how to send the objectId from the GUI depending on the current context (for instance if I am at the ESXi node in the inventory tree, I can get its objectId from the URI), but there is no way I could find to simply get a handle to the objectId of the vCenter Server itself, or even a MOR.
When I tried retrieving the ServerInfo object from the UserSession object, I could see the "ServiceContent" and "ServiceInstance" objects inside the actual runtime object, but these are clearly not accessible from client code! So how do I go about it?
In brief, I want minimal code to get a handle to the vcenter server root and be able to retrieve the ESX Server and VM (and their properties) information! I am on a severe time crunch, and hence the extreme need to go down the easiest path!
P.S: In the worst case, I wouldn't mind writing classic vSphere SDK code to retrieve the information, but when I took a look at the SDK samples for the vSphere WebServices SDK, the login process has been made extremely compliccated, and the username/password method is deprecated! Just curious - can I use the security token from the UserSession object and pass this to logon to the vSphere Web Service? Or can I still use the classic username/password combination?
Any help or suggestions will be much appreciated!
Thanks!
↧
Need some help with retrieving objectId for the vCenter Server from the Home View
↧