VMware {code} Community
srimini
Contributor
Contributor

How to get the individual esx servers ServiceUtil , ServiceContent, VimPortType params

How can i get the individual esx servers ServiceUtil , ServiceContent, VimPortType params if i use VI SDK 2.5 and connect to a virtual center........am able to get all the esx servers name and ip that are managed by the VC....but i dono how to get the above mentioned fields....please help me

Regards,

Padmini

0 Kudos
8 Replies
Steve_Jin
Expert
Expert

You can connect to the VirtualCenter server, and get all the HostSystem in its inventory. From the HostSystem, you can find the IP to the service console. Then you can connect to the ESX using .

If you code in Java, you can use VI Java API ()which gives you much shorter and readable code than using Web Services directly.

teve JIN, VMware Engineering

Creator of VI Java API:

Steve JIN Author of VMware VI and vSphere SDK; Creator of open source VI Java API (http://vijava.sf.net); Blogger at http://www.doublecloud.org
0 Kudos
srimini
Contributor
Contributor

Hi,

ya am able to get the esx servers ip addresses....but do i need to do connect seperately to individual esxs under VC? or is the connetion obtained automatically we connect to VC using SDK....

if i should connect to each ESX server individually..then how can i get the username and password for each esx via SDK.....please help me on this...

Thanks in advance...

Regards,

Padmini

0 Kudos
njain
Expert
Expert

Hi Padmini,

When you connect to a VirtualCenter, you automatically get authenticated for the ESX servers managed by that VC. You do not need to create a separate connection for ESX servers, after connecting to VC, to perform operations on them.

Hope this information is helpful.

Neha

0 Kudos
Steve_Jin
Expert
Expert

njain is right. You don't have to. I thought you wanted to, since you wanted to get hold of individual ESX's serviceutil, etc.

When an ESX is added to a VC server, the root user credential is asked by the VC and a new user called "vpxuser" is created on the ESX. No authentication is needed thereafter.

Steve JIN, VMware Engineering

Creator of VI Java API: http://vijava.sf.net

Steve JIN Author of VMware VI and vSphere SDK; Creator of open source VI Java API (http://vijava.sf.net); Blogger at http://www.doublecloud.org
0 Kudos
srimini
Contributor
Contributor

Hi,

ya i got but i need the esx servers service util,vim port type parameters also....how can i get that if i get connected to VC alone?

Regards,

Padmini

0 Kudos
njain
Expert
Expert

When you create a connection to VC, you cannot get the ServiceUtil, ServiceContent, VimPortType parameters for individual ESX servers. In order to do that, you will have to connect to ESX servers separately and not use the VC connection.

Why do you need these parameters for ESX servers when connected to VC?

0 Kudos
srimini
Contributor
Contributor

Hi,

i need those parameters becos i wanted to disconnect individual servers listed under VC in my application and also do actions like edit VM settings and clone VM on each esx under VC......how can i do that by connecting to VC alone

Regards,

Padmini

0 Kudos
njain
Expert
Expert

Hi Padmini,

Once you are connected to the VirtualCenter, you can use the ServiceUtil, ServiceContent, VimPortType variables to perform any operation on these objects, that are supported by VirtualCenter. For e.g., to disconnect the ESX server under the VC using VI SDK, you can use the "DisconnectHost_Task" API. You will have access to this API even when you are connected to the VC. Similarly, to edit Virtual Machine settings, you can use the "ReconfigVM_Task" method.

Attached is a standalone JAVA sample to reconfigure Virtual Machine's memory. You can run this sample on the VirtualCenter as follows:

run.bat com.vmware.samples.support.VMExtraReconfig https://<VirtualCenter IP>/sdk/vimService <username> <password> <vmname>

Hope this information will resolve your queries.

Neha

0 Kudos