Skip to content

Commit b9bea7f

Browse files
committed
vmm: migration: code cleanup
On-behalf-of: SAP philipp.schuster@sap.com Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
1 parent b11f270 commit b9bea7f

1 file changed

Lines changed: 10 additions & 12 deletions

File tree

vmm/src/lib.rs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4267,26 +4267,24 @@ impl RequestHandler for Vmm {
42674267
}
42684268

42694269
// When spawning the thread fails, the VM keeps running normally.
4270-
let migration_worker = match MigrationWorker::spawn(
4270+
let migration_worker = MigrationWorker::spawn(
42714271
vm,
42724272
self.check_migration_evt.try_clone().unwrap(),
42734273
send_data_migration,
42744274
self.postponed_lifecycle_event.clone(),
42754275
#[cfg(all(feature = "kvm", target_arch = "x86_64"))]
42764276
self.hypervisor.clone(),
4277-
) {
4278-
Ok(worker) => worker,
4279-
Err((vm, e)) => {
4280-
self.vm = MaybeVmOwnership::Vmm(vm);
4277+
)
4278+
.map_err(|(vm, e)| {
4279+
self.vm = MaybeVmOwnership::Vmm(vm);
42814280

4282-
let mut lock = MIGRATION_PROGRESS_SNAPSHOT.lock().unwrap();
4283-
lock.as_mut()
4284-
.expect("live migration should be ongoing")
4285-
.mark_as_failed(&e);
4281+
let mut lock = MIGRATION_PROGRESS_SNAPSHOT.lock().unwrap();
4282+
lock.as_mut()
4283+
.expect("live migration should be ongoing")
4284+
.mark_as_failed(&e);
42864285

4287-
return Err(e);
4288-
}
4289-
};
4286+
e
4287+
})?;
42904288
let old = self.migration_thread_handle.replace(migration_worker);
42914289
// If this fails, we messed up the thread lifecycle management.
42924290
debug_assert!(old.is_none());

0 commit comments

Comments
 (0)