VMware {code} Community
SoMoS
Contributor
Contributor

When will be available a method to reboot [or shutdown] the guest from the API?

Hello,

as many others before I need to have a method to reboot or shutdown the guest from the API. There are alternatives but all of them have some rougth edges that cannot be avoided so would be much better to have a method from the API.

I've seen that at 2008 this was planned to be implemented. What has happened with it? Will it be implemented in any version?

Thanks for your answers.

Tags (3)
0 Kudos
8 Replies
verminator
Enthusiast
Enthusiast

As of VIX 1.10.2, there is an API available to shutdown a guest:

http://www.vmware.com/support/developer/vix-api/vix110_reference/lang/c/functions/VixVM_PowerOff.htm...

VixHandle
VixVM_PowerOff(VixHandle vmHandle,
               VixVMPowerOpOptions powerOffOptions,
               VixEventProc *callbackProc,
               void *clientData);

This function powers off a virtual machine.

I don't think there is a supported function to restart a VM using VIX api.

0 Kudos
admin
Immortal
Immortal

The function VixVM_Reset will reboot a virtual machine.  (VixVM_Reset in C, VMReset in Perl, and vm::Reset in COM).

http://www.vmware.com/support/developer/vix-api/vix110_reference/lang/c/functions/VixVM_Reset.html

VixVM_Reset

Description

VixHandle
VixVM_Reset(VixHandle vmHandle,
            VixVMPowerOpOptions powerOnOptions,
            VixEventProc *callbackProc,
            void *clientData);

This function resets a virtual machine.

Parameters

vmHandle
Identifies a virtual machine. Call VixVM_Open() to create a virtual machine handle.
powerOnOptions
Must be VIX_VMPOWEROP_NORMAL or VIX_VMPOWEROP_FROM_GUEST.
callbackProc
A callback function that will be invoked when the power operation is complete.
clientData
A parameter that will be passed to the callbackProc function.

Note that this can either be a hard reset ( VIX_VMPOWEROP_NORMAL, reboot at virtual hardware level) or a soft reset ( VIX_VMPOWEROP_FROM_GUEST, which does a "resart" in the guest operating system, and requires VMware Tools to be running in the guest.)

Hope that helps,

Matt

0 Kudos
SoMoS
Contributor
Contributor

Sorry if my explanation was not good enough, I'm talking about rebooting or shutting down the guest SO, not the virtual machine. I mean, I want to do a SO power off no a hardware power off, of course.

0 Kudos
admin
Immortal
Immortal

Calling VixVM_Reset with the option VIX_VMPOWEROP_FROM_GUEST will perform a soft restart triggered from within the guest OS.

--Matt

0 Kudos
SoMoS
Contributor
Contributor

Thanks for the information. The problem that I face now is that some guests work fine with this call while others hang when calling the wait handle and the wait never returns. Any idea?

0 Kudos
KlausK
Contributor
Contributor

I am seeing the same thing. Sometimes it works, sometimes it doesn't. I tried VixJob_Wait, VixJob_Completion and a callback procedure... none of them work reliably.

I also posted about another bug in the VIX API and funky power states that are being returned. I guess one has to pay for the developer support to really get help here.

SoMoS
Contributor
Contributor

I agree but we won't pay anymore, we already have a bunch of licenses for something that does not works accurately. We're trying to switch from VIX to vmrun and if that does not work we will switch to Virtual PC.

0 Kudos
icnocop2
Contributor
Contributor

See this related post: http://communities.vmware.com/message/1848652

"I am experiencing the same issue... Windows XP x86...

It seems that I do not experience this behavior if the guest OS is Windows XP Professional x86 Service Pack 2."

0 Kudos