Eds89
Enthusiast
Enthusiast

How to shutdown VMs during host poweroff, without using autostart

Jump to solution

I have a scenario whereby I have a single ESXi host, and would like VMs to gracefully shutdown when a shutdown command is issued to the host.

For reasons I won't go into, I do not wish for VMs to autostart when the host is powered on.

Is it possible to configure autostart to stop VMs during a host shutdown, but not have them startup during host power on?

Cheers

Eds

1 Solution

Accepted Solutions
Eds89
Enthusiast
Enthusiast

I finally came up with something homebrew;

shell - Linux - trim table of text and store values as variables - Stack Overflow

I managed to get a scripted created that is triggered via a connection by SSH, which shuts down all running VMs.

Please see my other post here:

Re: Help scripting graceful shutdown of VMs via SSH

Eds

View solution in original post

0 Kudos
5 Replies
SHANKAR046
Contributor
Contributor

Please go through below..

1

In the vSphere Web Client, navigate to the host where the virtual machine is located.

2

Select Manage > Settings.

3

Under Virtual Machines, select VM Startup/Shutdown and click Edit.

The Edit VM Startup and Shutdown dialog box opens.

4

Select Allow virtual machines to start and stop automatically with the system.

5

(Optional) In the Default VM Settings pane, configure the default startup and shutdown behavior for all virtual machines on the host.

Option

Action

Startup Delay

After you start the ESXi host, it starts powering on the virtual machines that are configured for automatic startup. After the ESXi host powers on the first virtual machine, the host waits for the specified delay time and then powers on the next virtual machine. The virtual machines are powered on in the startup order specified in the Per-VM Overrides pane.

Continue immediately if VMware Tools starts

Shortens the startup delay of the virtual machine. If VMware Tools starts before the specified delay time passes, the ESXi host powers on the next virtual machine without waiting for the delay time to pass.

Shutdown Delay

When you power off the ESXi host, it starts powering off the virtual machines that run on it. The order in which virtual machines are powered off is the reverse of their startup order. After the ESXi host powers off the first virtual machine, the host waits for the specified shutdown delay time and then powers off the next virtual machine. The ESXi host shuts down only after all virtual machines are powered off.

Shutdown Action

Select a shutdown action that is applicable to the virtual machines on the host when the host shuts down.

Power Off

Suspend

Guest Shutdown

6

(Optional) In the Per-VM Overrides pane, configure the startup order and behavior for individual virtual machines.

Use this option when you need the delay of the virtual machine to be different than the default delay for all machines. The settings that you configure for individual virtual machines override the default settings for all machines.

a

To change the startup order of virtual machines, select one from the Manual Startup category and use the up arrow to move it up to Automatic Startup or Any Order.

Use the up and down arrows to change the startup order for virtual machines in the Automatic Startup category. During shutdown, the virtual machines shut down in the reverse order.

b

Click Startup Behavior, select Custom, and configure the startup delay before the next virtual machine in the sequence is powered on.

c

Click VMware Tools, and select whether the ESXi host waits for the delay to pass when VMware Tools is already installed on the virtual machine.

If you select the Continue if VMware Tools is installed the ESXi host powers on the next virtual machine without waiting for the delay to pass. If you select the Do not continue if VMware Tools is installed the ESXi host waits for the delay to pass.

d

Click Shutdown Behavior, select Custom, and configure the shutdown action and delay.

7

Click OK to close the dialog box and save your settings.

0 Kudos
Eds89
Enthusiast
Enthusiast

Thanks, but your description of the UI does not match my web client.

Using ESXi 6.7 free, as a standalone host obviously, in the web client under host I see manage.

Then, I see the system tab, with an autostart section in that.

This is where I would assume you are referring to, however if autostart is not enabled for a VM, the VM is simply powered off when the host powers off, and ignores my stop action.

See UI below:

snip.PNG

How do I configure this, so that VMs will shutdown gracefully with the host, but not auto power on with the host?

Thanks

Eds

0 Kudos
Eds89
Enthusiast
Enthusiast

Anyone have any additional advice please?

Thanks

Eds

0 Kudos
Eds89
Enthusiast
Enthusiast

Can anyone assist me with achieving this please?


Thanks

Eds

0 Kudos
Eds89
Enthusiast
Enthusiast

I finally came up with something homebrew;

shell - Linux - trim table of text and store values as variables - Stack Overflow

I managed to get a scripted created that is triggered via a connection by SSH, which shuts down all running VMs.

Please see my other post here:

Re: Help scripting graceful shutdown of VMs via SSH

Eds

0 Kudos