VMware {code} Community
listener
Contributor
Contributor

Problem with sample code powerOn.c connecting to ESX

I changed the host connection parameters in powerOn.c to connect to my ESX server, but the script hangs.

It will sit here forever. Is there something wrong with my connection parameters? I haven't modified anything else in powerOn.c.I haven't modified the makefile

either. It's all out of the box.

thanks!

-h

/usr/share/doc/vmware-vix/samples # ./powerOn "[config] vmshe-vm-4-54/vmshe-vm-4-54.vmx"

#define CONNTYPE VIX_SERVICEPROVIDER_VMWARE_VI_SERVER

#define HOSTNAME "https://esx_host:8333/sdk"

/*

  • NOTE: HOSTPORT is ignored, so the port should be specified as part

  • of the URL.

*/

#define HOSTPORT 0

#define USERNAME "root"

#define PASSWORD "password_not_telling"

#define VMPOWEROPTIONS VIX_VMPOWEROP_NORMAL

Reply
0 Kudos
2 Replies
lemke
VMware Employee
VMware Employee

ESX usually uses port 443, so unless you've changed it, that's probably the problem.

listener
Contributor
Contributor

Thanks! The script doesn't hang now and it makes a successful connection to my ESX server and attempts to power on the guest. However, right after powering on, it aborts and the guest stops powering on.

I noticed that if I comment out the Vix_Release, the guest stays powered on. Is this a known problem?

Vix_ReleaseHandle(jobHandle);

jobHandle = VixVM_PowerOff(vmHandle,

VIX_VMPOWEROP_NORMAL,

NULL, // *callbackProc,

NULL); // *clientData);

err = VixJob_Wait(jobHandle, VIX_PROPERTY_NONE);

if (VIX_FAILED(err)) {

goto abort;

/

Reply
0 Kudos