This article describes how to enable HA using XenServer CLI.
HA can be enabled on a pool using either XenCenter or the command-line interface. In either case, you will specify a set of priorities that determine which VMs should be given highest restart priority when a pool is over committed.1. Verify that you have a compatible Storage Repository (SR) attached to your pool. iSCSI, NFS or Fibre Channel are compatible SR types.
2. For each VM you wish to protect, set a restart priority.
You can do this as follows: xe vm-param-set uuid= ha-restart-priority= ha-always-run=true
3. Enable HA on the pool, and optionally, specify a timeout:
xe pool-ha-enable heartbeat-sr-uuids= ha-config:timeout=30
Timeout is the period during which networking or storage is not accessible by the hosts in your pool. If you do not specify a timeout when you enable HA, XenServer will use the default 30 seconds timeout. If any XenServer host is unable to access networking or storage within the timeout period, it will self-fence and restart.
4. Run the pool-ha-compute-max-host-failures-to-tolerate command. This command returns the maximum number of hosts that can fail before there are insufficient resources to run all the protected VMs in the pool.
xe pool-ha-compute-max-host-failures-to-tolerate The number of failures to tolerate determines when an alert is sent: the system will recompute a failover plan as the state of the pool changes and with this computation the system identifies the capacity of the pool and how many more failures are possible without loss of the liveness guarantee for protected VMs. A system alert is generated when this computed value falls below the specified value for ha-host-failuresto-tolerate.
5. Specify the number of failures to tolerate parameter. This should be less than or equal to the computed value:
xe pool-param-set ha-host-failures-to-tolerate= uuid=<pool-uuid>