XCP-ng
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    How to force shutdown a specific XCP-ng host without migrating VMs (with HA enabled)

    Scheduled Pinned Locked Moved Hardware
    5 Posts 4 Posters 492 Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S Offline
      samuelolavo
      last edited by

      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

      D 1 Reply Last reply Reply Quote 0
      • D Offline
        DustinB @samuelolavo
        last edited by

        @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.

        1 Reply Last reply Reply Quote 0
        • olivierlambertO Offline
          olivierlambert Vates 🪐 Co-Founder CEO
          last edited by

          Host shutdown with force flag should shutdown the VM, IIRC.

          GuillaumeHullinG 1 Reply Last reply Reply Quote 0
          • GuillaumeHullinG Offline
            GuillaumeHullin @olivierlambert
            last edited by

            Sorry to revive this topic... I was just wondering: which force flag are you using?
            Per the docs I couldn't find it for xe host-shutdown command.

            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_here
            

            Then 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_command is just there to prevent error message)

            1 Reply Last reply Reply Quote 0
            • olivierlambertO Offline
              olivierlambert Vates 🪐 Co-Founder CEO
              last edited by olivierlambert

              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 xe commands to do: host.disable and finally host.shutdown

              1 Reply Last reply Reply Quote 0
              • First post
                Last post