How to force shutdown a specific XCP-ng host without migrating VMs (with HA enabled)
-
Hi everyone,
I have an XCP-ng pool with High Availability (HA) enabled. Normally, when I issue a shutdown command on a host (either via xe host-shutdown or from Xen Orchestra), the system automatically starts migrating all VMs to other hosts in the pool — which makes sense for HA.
However, in my case, I’m integrating the hosts with a central UPS monitoring system (NUT), and during a power outage, I need to force a host to shut down immediately — without triggering VM migrations, even if HA is currently active.
Is there any CLI command or parameter that allows a clean, immediate shutdown of a specific host without migration attempts, or any way to temporarily suppress HA’s automatic evacuation logic for a given shutdown action?
I’m aware that disabling HA entirely (xe pool-ha-disable) before shutdown would work, but I’m looking for a faster or more direct way, ideally per-host, not affecting the whole pool.
Any suggestions or best practices for this type of emergency power management setup?
Thanks in advance!
— Samuel Olavo
-
@samuelolavo Stop the VMs ahead of your host shutdown; gracefully and have "auto power on" enabled on these so when your pool master (and slaves) come back online the VMs start on their own.
-
Host shutdown with force flag should shutdown the VM, IIRC.
-
Sorry to revive this topic... I was just wondering: which force flag are you using?
Per the docs I couldn't find it forxe host-shutdowncommand.FYI (in case it could help), my idea is to implement UPS shutdown order via SSH by using force command in
/root/.ssh/authorized_keys.command="the_force_shutdown_command_here",no-agent-forwarding,no-port-forwarding,no-pty,no-user-rc,no-X11-forwarding a_dedicated_pub_key_hereThen if you ssh in, it will force the command
command=(other command will be ignored and you can't open interactive shell).ssh -i /path/to/dedicated_private_key user@xcp-ng-host whatever_command(
whatever_commandis just there to prevent error message) -
Don't mix XO commands and xe, even if XO is on top of it, the mapping isn't exactly 1:1.
In XO, host force shutdown is preventing XAPI to try moving the VMs around to another host. So in force mode in XO, the host is disabled first, then shutdown command is sent. If you want to do the same thing, you have then 2
xecommands to do:host.disableand finallyhost.shutdown