Setting VM Failover
The storage system supports VM failover. If a controller fails, VMs can be automatically switched to another functional controller to resume services.
Live migration is unavailable for VMs in the event of a controller fault.
Prerequisites
Failover takes effect on a VM. To enable the failover function, the peer controller must meet the following requirements.
- The remaining memory resources meet VM requirements after the failover. To view the remaining memory resources, run show vm_container general. To view the memory resource of the VM to be migrated, run show virtual_machine general vm_id=?.
- If vCPU isolation is enabled, check whether the remaining number of CPUs in the container meets VM requirements after the failover. You can run show vm_container general to view the remaining number of CPUs in the container and run show virtual_machine general vm_id=? to view the number of vCPUs of the VMs to be migrated.
- Free network adapters exist on the secondary controller and have been added to the VM to be migrated as secondary network ports. To add secondary network ports to the VM, run add virtual_machine secondary_port. Then configure parameters vm_id, port_type, port_id and primary_port_id to set the VM ID, secondary port type, secondary port ID, and primary port ID.
Context
VM failover uses the cold backup mode. In this mode, services are unavailable when VMs are being started on the peer controller.
Precautions
The screenshots in this section are for reference only.
Procedure
- Go to the CLI.
- Check whether remaining memory resources of the secondary controller meet the migration requirements.
- Run show vm_container general to view the remaining memory resources.
Free memory of VM containers = Total memory of VM containers – VM memory of the active container – Memory of VMs (in the standby container) whose failover function is enabled.
- Run show virtual_machine general vm_id=? to view the memory resource of the VM to be migrated.
- Run show vm_container general to view the remaining memory resources.
- If vCPU isolation is enabled, check whether the remaining number of CPUs in the container meets migration requirements.
- Run show virtual_machine vcpu_isolate_switch to check whether vCPU isolation is enabled.
- Run show vm_container general to check the number of available CPUs.
- Run show virtual_machine general vm_id=? to view the number of vCPUs of the VMs to be migrated.
The value of CPU Counts should be less than or equal to that of Available CPU Counts.
- Run show virtual_machine vcpu_isolate_switch to check whether vCPU isolation is enabled.
- Add free network ports on the secondary controller to the VM to be migrated as secondary network ports.
- Run the show virtual_machine port vm_id=? command to view the used ports.
- Run the add virtual_machine secondary_port command to add secondary port, use parameters vm_id, port_type, port_id, and primary_port_id to specify the VM ID, secondary port type, secondary port ID, and primary port ID.
You can user Ctrl+A view the available ports when using this command.
- Run the show virtual_machine port vm_id=? command to view the used ports.
- Run the change virtual_machine general vm_id=? failover_switch=? command.Table 7-12 describes the related parameters.
- Confirm the parameter settings.
After executing the command, run the show virtual_machine general vm_id=? command to view the status of VM failover.
Example
Enable failover.
admin:/>change virtual_machine general vm_id=1 failover_switch=on
Command executed successfully.
Follow-up Procedure
After failover is enabled, if the working controller is faulty, VMs fail over to another functional controller. After the faulty controller recovers, the VMs fail back to the controller by default. If failback is disabled, the VMs cannot fail back. You can view and set the failback mode for VMs as follows:
- Run the show virtual_machine failback_switch command to view the failback mode of VMs.
- Run the change virtual_machine failback_switch status=? command to enable or disable failback for VMs.
For V500R007C72 and later versions:
If failback is disabled before a controller becomes faulty, and failover is enabled only for some VMs on the controller:
- If the controller becomes faulty, failover is performed for the VMs on which failover has been enabled.
- After the controller recovers, VMs that have been migrated are automatically failed back to the controller.
If failback is disabled after a controller becomes faulty, VMs that have been migrated cannot be automatically failed back after the controller recovers.