mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: migration: only permit migration of running VMs
Currently, it is not possible to migrate a paused VM. It fails with
the following error:
```
[2026-03-09T14:43:42Z ERROR cloud_hypervisor] Fatal error: HttpApiClient(ServerResponse(InternalServerError, Some("[\"Error from API\",\"Error starting migration sender\",\"Failed to pause migratable component\",\"Invalid transition: InvalidStateTransition(Paused, Paused)\"]")))
Error: ch-remote exited with the following chain of errors:
0: http client error
1: Server responded with InternalServerError
2: Error from API
3: Error starting migration sender
4: Failed to pause migratable component
5: Invalid transition: InvalidStateTransition(Paused, Paused)
```
and even worse, after that, the VM is resumed on the source!
Make the behavior explicit by only allowing migration of VMs in the
Running state. This avoids unintended state transitions during
migration and clarifies the current expected semantics.
Future work could extend the migration protocol to work with paused VMs
and preserve the VM runtime state, allowing paused VMs to be migrated
without altering their state.
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
On-behalf-of: SAP philipp.schuster@sap.com
This commit is contained in:
committed by
Rob Bradford
parent
b5169ff419
commit
5c93bcf2d7
@@ -2369,6 +2369,16 @@ impl RequestHandler for Vmm {
|
||||
.as_mut()
|
||||
.ok_or_else(|| MigratableError::MigrateSend(anyhow!("VM is not running")))?;
|
||||
|
||||
// Only running VMs can be migrated: Future work can fix this to allow
|
||||
// also the migration of paused VMs while preserving the state in success
|
||||
// and error case. See #7815.
|
||||
if vm.get_state() != VmState::Running {
|
||||
return Err(MigratableError::MigrateSend(anyhow!(
|
||||
"VM is not in running state: {:?}",
|
||||
vm.get_state()
|
||||
)));
|
||||
}
|
||||
|
||||
Self::send_migration(
|
||||
vm,
|
||||
#[cfg(all(feature = "kvm", target_arch = "x86_64"))]
|
||||
|
||||
Reference in New Issue
Block a user