VM double-start protection
A virtual machine (VM) runs on only one node. Therefore, before each start, Center and the node check whether the VM is running somewhere else and refuse the start if it is.
How the protection works
- Center polls the nodes. Before a start, Center asks all online nodes which VMs are running on them and waits up to 10 seconds for their responses. If the VM is running on another node, the start is rejected. The node number is not included in the response: it stays in the service log.
- A node did not respond. In this case, the node where the VM is starting checks the start (step 4), so a failed node does not prevent the VM from being started after a failure.
- One operation at a time. Start, stop and restart of the same VM do not run in parallel: of two simultaneous starts on different nodes, only one goes through. The second request is rejected immediately and is not queued:
Unable to start VM having admin_status==3 already(code -457). If a task is already in progress on the VM — a start, a stop, a migration, a snapshot, a change of disks or network — the start is rejected even earlier:VM is locked(code -409), and the refusal names the task in progress. All tasks on the VM are visible in the Tasks section — Tasks. - Check on the node. The node refuses if the VM is already running on this node or if the VM disks are already connected, which means the VM is running on another node. If a connection is left over from a start that ended abnormally, the node removes it and starts the VM.
- Auto-restart skips a VM that the poll sees running on any node, and a VM whose start command has already been sent — VM auto-restart after a failure.
- Stop. If a node responds that the VM is not running on it, Center first checks the other nodes and does not mark the VM as stopped if it is running there.
In the diagram, a start passes two checks: the node poll in Center and the check on the node where the VM starts. A refusal at either check stops the start.
What you see
-
Center refused — a notification:
VM is running on another cluster node; unable to startThe VM is already running. You do not need to repeat the start; the status updates when Center polls the nodes.
-
The node refused — the VM may show Start failed even though it is already running. Before you start it again, check the VM console.
-
After a node failure, the guest OS reports file system errors or the VM responds intermittently — do not perform any actions on the VM and contact vStack support immediately: File system errors in the guest after a node failure.
You can find out where the VM actually runs by checking the nodes. The command only reads the state. If two nodes show the same VM number at the same time, contact vStack support immediately.
ls /dev/vmm
The vstack-vm vm list output is not suitable for this check. The pool node shows the VMs of its pool that run on other nodes as Offline, and the execution node shows them as Started, marked remote. That is why almost every VM appears in the lists of two nodes, and this is expected behavior.
What not to do
- Do not stop the VM yourself if the guest OS reports file system errors after a node failure. Contact vStack support immediately.
- Do not stop VMs based on the
vstack-vm vm listoutput. It shows a VM both on the pool node and on the execution node, and this is expected behavior. - Do not restart the VM controller on a node.
- Do not edit VM configuration files on the nodes or in the management VM.
- Do not start a VM on another node after a failed stop until you make sure that it is not running anywhere.
- Do not manually start the VMs of a failed node until the node is powered off or has returned to the cluster.
- Do not start VMs with commands on a node. Start VMs only from the Center web interface or API.