VMware {code} Community
GoodGuy123
Contributor
Contributor

WaitForToolsInGuest does not return and hangs

I'm using VIX API 1.6.2 on 32 bit Windows 2003 (SP2) to control vitrual machines running on another 64-bit machine running ESXi 4.0.0 (171294).

The Virtual machine is running 32-bit Windows 2003 (SP2) and has VMWare tools installed.

Using the VIX API I first revert to a named snapshot (that has the machine in shutdown state), then I power it on and wait for tools in guest before I run programs inside the VM.

The problem is that WaitForToolsInGuest ( ) does not return and hangs indefinately even after the OS has booted up successfully.

The code below works fine for ESX 3.5 (update 3) and also VMWare Server 2.0.1 but does not work forESXi 4.0.0 (171294)

My VBScript code that uses VIX API looks like this:

' Create the VIX library

Dim lib

Set lib = CreateObject("VixCOM.VixLib")

' Connect to ESXi server

Dim jobConnect

Set jobConnect = lib.Connect(VixCOM.Constants.VIX_API_VERSION, VixCOM.Constants.VIX_SERVICEPROVIDER_VMWARE_VI_SERVER, "https://myesxiserver:443/sdk/", 0, "root", "mypwd", 0, Nothing, Nothing)

Set connectResults = Nothing

err = jobConnect.Wait(Array(VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_HANDLE), connectResults)

If lib.ErrorIndicatesFailure(err) Then

Wscript.Echo "Connecting to host failed with error code "

WScript.Quit(err)

End If

Dim host

Set host = connectResults(0)

' Open the virtual machine

Set jobOpenVM = host.OpenVM("[datastore] myvm/myvm.vmx", Nothing)

Set openVMResults = Nothing

err = jobOpenVM.Wait(Array(VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_HANDLE), openVMResults)

If lib.ErrorIndicatesFailure(err) Then

WScript.Echo "Opening virtual machine failed with error code "

WScript.Quit(err)

End If

' The vm object will be first element in the results array.

Dim vm

Set vm = openVMResults(0)

' Power on the virtual machine

Dim jobPowerOn

Set jobPowerOn = vm.PowerOn(VixCOM.Constants.VIX_VMPOWEROP_NORMAL, Nothing, Nothing)

err = jobPowerOn.WaitWithoutResults()

If lib.ErrorIndicatesFailure(err) Then

WScript.Echo "Powering on guest failed with error code "

WScript.Quit(err)

End If

' Wait until VMWare tools starts inside the guest

Dim jobWaitForTools

Set jobWaitForTools = vm.WaitForToolsInGuest(0, Nothing)

err = jobWaitForTools.WaitWithoutResults()

If lib.ErrorIndicatesFailure(err) Then

WScript.Echo "Waiting for tools in guest failed with error code "

WScript.Quit(err)

End If

Thanks in advance.

0 Kudos
5 Replies
fixitchris
Hot Shot
Hot Shot

Try the VI Toolkit : http://communities.vmware.com/thread/162967?tstart=0

Also, you can try dblock's VMwareTasks library which is able to make that call async.

GoodGuy123
Contributor
Contributor

So is this a problem with esxi 4.0.0 (build 171294)?

Will it be fixed in a future patch or update?

0 Kudos
jimirving
Contributor
Contributor

I'm also getting this problem on ESX u4 and vix 1.6.2. Not only does waitForTools hang, but every function on the guest hangs as well. Does anyone know of a fix?

0 Kudos
GoodGuy123
Contributor
Contributor

I have now gone back to using ESXi 3.5 (update 3) where this problem does not occur.

0 Kudos
fkollmann
Contributor
Contributor

Did anyone spoke to the VMware support about this? Our whole integration environment stopped working after upgrading to ESXi 4.0!!!

Greetz Felix

0 Kudos