VM Failover Test¶
This guide walks through testing VM failover by creating a RHEL 9 virtual machine, simulating a node failure, and verifying the VM restarts on a healthy node within the 120-second target. This assumes Workload Availability is fully configured with the 120-second failover settings.
Prerequisites¶
- OpenShift Virtualization installed and configured
- Workload Availability operators installed (NHC, SNR, Descheduler)
- RWX-capable StorageClass available (required for VM failover)
- At least 3 worker nodes
Create the Virtual Machine¶
-
Create a namespace for the test:
-
Go to Virtualization -> VirtualMachines -> ensure you are in the
vm-failover-testproject -> click "Create VirtualMachine" - Select "From template" and choose "Red Hat Enterprise Linux 9"
- Give it a name (e.g.,
failover-test-vm) - Ensure the VM is configured with:
-
runStrategy: Always(this is what tells the cluster to restart the VM if it stops unexpectedly) -evictionStrategy: LiveMigrate - Click "Customize VirtualMachine" to edit the details before creating
Add a Data Disk¶
- Click on the "Disks" tab
- Click "Add disk"
- Configure the data disk:
- Name:
data-disk- Source: Blank - Size: 10 GiB - Type: Disk - StorageClass: your RWX-capable StorageClass - Access Mode: ReadWriteMany (RWX)
Warning
Both the root disk and the data disk must use RWX access mode for failover to work. If either disk is RWO, the VM cannot start on a new node until the old node's lease expires (6+ minutes).
- Click Add
- Also verify the root disk is using RWX access mode — edit it if necessary
Start the VM¶
- Click "Create VirtualMachine"
- Wait for the VM status to show "Running"
Verify the VM is Running¶
-
From the CLI, confirm the VM is running and note which node it is on:
The
NODEcolumn shows where the VM is currently scheduled. -
Check the IP address assigned to the VM via IPAM. This IP is assigned by the CUDN (ClusterUserDefinedNetwork) and persists with the VM across node migrations and failovers:
Record the IP address — you will verify it stays the same after failover.
-
Optionally, open the VM console from the WebUI to confirm the guest OS is up: - Virtualization -> VirtualMachines -> click
failover-test-vm-> Console tab
Simulate Node Failure¶
-
Record the node name where the VM is running:
-
Start a timer and then restart the node to simulate a failure:
Note
This simulates an unexpected node reboot. In a real failure scenario (power loss, kernel panic), the node would simply stop responding without a graceful shutdown.
Watch the Failover¶
-
Immediately watch the VM instance for changes:
You should see the following sequence: - VM status remains
Runninginitially (node hasn't been marked unhealthy yet) - After ~50s: node is markedNotReady- After ~80s: NHC creates aSelfNodeRemediationCR - After ~85-90s: node gets theout-of-servicetaint, pods are deleted - After ~100-120s: VM restarts on a different node -
Once the VM shows
Runningagain, check the timestamp:The
NODEcolumn should show a different node than before.
Verify the Failover¶
-
Confirm the VM is fully running on the new node:
Should output:
Running -
Verify the IP address followed the VM to the new node:
The IP address should be identical to what was recorded before the failover. This is because the CUDN with persistent IPAM allocates the IP to the VM itself (not the node), so when the VM restarts on a different node, it retains the same IP. Clients connecting to this IP will be able to reach the VM on its new node without any DNS or configuration changes.
-
Check the data disk is still attached:
-
Open the VM console from the WebUI to confirm the guest OS has booted: - Virtualization -> VirtualMachines -> click
failover-test-vm-> Console tab - Login and verify the data disk is mounted (if it was mounted in the guest) - Runip addrinside the guest to confirm the IP matches -
Review the remediation events:
Expected Timeline¶
| Time | Event |
|---|---|
| T+0s | Node reboots — stops responding |
| T+~50s | API server marks node Ready=Unknown |
| T+~80s | NHC threshold (30s) breached, remediation CR created |
| T+~85s | SNR applies out-of-service taint |
| T+~90s | Pods force-deleted, volumes detached |
| T+~100s | New VMI scheduled on healthy node, storage attached |
| T+~120s | VM fully running on new node |
Cleanup¶
-
Delete the test VM:
-
Wait for the rebooted node to come back and verify it rejoins the cluster:
The node should return to
Readystatus after it finishes rebooting. -
Delete the test namespace:
Tip
If the failover took significantly longer than 120 seconds, check:
- Storage access mode (must be RWX)
- NHC
unhealthyConditions.durationis set to30s - Self Node Remediation pods are running on all nodes:
oc get pods -n openshift-workload-availability - Hardware watchdog is available:
oc debug node/<node> -- chroot /host ls /dev/watchdog*