VM HA Policy

HA Policy controls the automatic recovery behavior of VMs when a VM stops unexpectedly, is shut down as planned, or encounters related resource failures. Administrators can use the global HA policy, the VM HA switch, and failover policies to automatically restart critical services or migrate them to other hosts after a failure.

Core Concepts

VM HA
Specifies whether a VM automatically restarts after a planned or unexpected shutdown. If the platform HA policy is not enabled, turning on the VM HA switch takes effect after the platform HA policy is enabled.
Failover policy
Specifies whether a VM is migrated to another host and started when compute, storage, network, or other related resources of the VM fail.

Detection Items

  • Management network connection status: Detects the network connection status between the host where the VM is located and the management node. A management node failure or management network interruption causes a management network connection status failure.
  • Storage network connection status: Detects the network connection status between the VM and the data storage resource where its system disk is located. A failure of the data storage where the system disk is located or a storage network interruption causes a storage network connection status failure.
  • Business NIC status: A failure of the host business NIC associated with the business VM or the switch port directly connected to the business NIC causes a business NIC failure for the VM.

Typical Failover Scenarios

Typical Scenario Management Network Connection Status Storage Network Connection Status Business NIC Status Migrate on Failure?
Scenario A Normal Normal Failure Migrate / Do Not Migrate
Scenario B Normal Failure Normal Migrate / Do Not Migrate
Scenario C Normal Failure Failure Migrate / Do Not Migrate
Scenario D Failure Normal Normal Do Not Migrate

How It Works

When a VM stops because of an unexpected condition or a planned shutdown, ZSphere checks the VM HA switch status. If the switch is turned on, the system restarts the VM on the current host or another host.

When the management network connection status, storage network connection status, or business NIC status of the host where a VM is located becomes abnormal, ZSphere checks the fault migration policy and the VM HA switch status. If the corresponding fault migration switch and the VM HA switch are both turned on, the VM is migrated to another host and started.

Configure HA Policy

Procedure

  1. In the navigation pane, choose Reliability > HA Policy.
  2. Enable HA Policy.

    HA Policy is enabled by default. If it has been disabled, turn on the switch at the top of the HA Policy page.

  3. On the Migration Policy page, set the failover policy.
    Typical Scenario Management Network Connection Status Storage Network Connection Status Business NIC Status Migrate on Failure? Migration Description
    Scenario A Normal Normal Failure Migrate / Do Not Migrate Supports setting the policy to migrate or do not migrate.
    Scenario B Normal Failure Normal Migrate / Do Not Migrate Supports setting the policy to migrate or do not migrate. In a SAN storage environment, if this policy is set to do not migrate, a storage network connection status failure still triggers automatic migration.
    Scenario C Normal Failure Failure Migrate / Do Not Migrate

    The migration policy for simultaneous storage connection status and business NIC status failures follows the migration policy configured for either individual failure:

    • If the migration policy for both storage connection status failure and business NIC status failure is do not migrate, this policy is set to do not migrate.
    • If the migration policy for either failure scenario is migrate, this policy is set to migrate.
    Scenario D Failure Normal Normal Do Not Migrate When the management network status is faulty, setting a fault migration policy is not supported.
    Note: Storage network connection status detection supports only shared storage and does not currently support local storage.
  4. On the Migration Policy page, set the host error detection policy.
    Host Fault Detection Item Description
    Host Self-Inspection Interval Specifies the interval for host status self-inspection. Default: 5 seconds.
    Maximum Host Self-Inspection Attempts Specifies the maximum number of host self-inspection attempts. If all attempts fail, the system determines that a network error has occurred on the host. Default: 6 attempts.
  5. On the Advanced Settings page, configure advanced HA policy settings as needed.
    Category Name Description
    Virtual Machine Maximum Interval for VM HA Restart Attempts Specifies the maximum interval for the system to execute the GC task and retry starting a VM after the VM stops unexpectedly. Default: 300 seconds.
    VM HA Restart Retry Delay Specifies the delay before the next restart attempt if the previous restart attempt fails for a VM with HA enabled. Default: 60 seconds.
    HA VM State Scanning Interval Specifies the interval for scanning the state of a VM with HA enabled after restart fails. Default: 60 seconds.
    HA VM State Update Speed
    • Specifies the response speed for updating the UI state list when the enabled state of an HA VM changes. Default: 1. Valid values: -1 to 5.
    • A smaller value indicates faster response. A larger value indicates slower response, but the system ignores more outdated state change notifications and reduces system load.
    • -1 indicates that the UI state list is not actively updated.
    Host Timeout for Host Connection to Data Storage Specifies the timeout for a host to check its connection to data storage. Default: 5 seconds.
    Abnormal Host Status Update Interval Specifies the interval for checking and updating the status of abnormal hosts. Default: 5 seconds.
    Connection Attempts to Determine Host Disconnection Specifies the maximum number of attempts to reconnect to a host. If all attempts fail, the system determines that the host is disconnected. Default: 12 attempts.
    Ping Response Time to Determine Successful Host Connection Specifies the time for determining whether a host is successfully connected to the management node by ping. If the host responds within this time, the connection is considered successful. Default: 5 seconds.
    Connection Success Rate to Determine Host Recovery Specifies the success rate used to determine whether the host has reconnected to the management node when both successful and failed connection attempts occur within the specified number of attempts. Default: 50%.
    Minimum Successful Connections to Determine Host Recovery Specifies the minimum number of successful connections that a host must establish with the management node before the host is determined to be reconnected. Default: 5.

View HA Tasks

About this task

After HA Policy is enabled, HA task records are generated when the platform triggers the HA mechanism.

Procedure

  1. In the navigation pane, choose O&M Management > Task > HA Task.
  2. View HA task information.

    The HA task page shows task result, VM name, VM owner, previous host, target host, start time, and completion time, which can be used to audit and trace HA execution.

Disable HA Policy

Procedure

  1. In the navigation pane, choose Reliability > HA Policy.
  2. On the HA Policy page, click Disable.
    Note: After HA Policy is disabled, VMs no longer automatically restart after shutdown, which might cause service interruptions. Proceed with caution.

HA Policy Practice

About this task

Assume that four business VMs are deployed on Host A to run MySQL database services. To ensure service high availability, all four VMs must be migrated to another host when the business NIC of Host A fails. In this scenario, set the HA mode of these VMs to NeverStop, configure migration to be triggered when the business NIC status fails, and ensure that sufficient host resources are available in the platform.

Procedure

  1. Enable HA Policy.

    In the navigation pane, choose Reliability > HA Policy. Turn on the switch at the top of the HA Policy page.

  2. Turn on the HA switch for VMs.

    The VM HA switch can be configured at the VM level or cluster level. The VM-level configuration takes precedence over the cluster-level configuration.

    • When creating a VM, turn on the HA switch.
    • Go to the cluster where the VM resides, choose Modify Configuration > Advanced Settings > VM Settings, and turn on the VM HA switch. After this setting is enabled, the VM HA switch is turned on by default for new VMs created in the cluster.
  3. Configure the VM fault migration policy.

    Go to the HA Policy > Migration Policy page and turn on the Failover switch for Scenario A. When this switch is turned on, the Failover switch for Scenario C is automatically turned on.

Results

After the VM HA policy is configured, if the business NIC of Host A fails, the four VMs on Host A are automatically migrated to Host B and started. You can search for related task records in O&M Management > Task > HA Task.