Skip to content

Commit 78699eb

Browse files
committed
vmm: remove unnecessary Result
On-behalf-of: SAP [email protected] Signed-off-by: Philipp Schuster <[email protected]>
1 parent 152713c commit 78699eb

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

vmm/src/api/mod.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,9 @@ pub trait RequestHandler {
408408

409409
fn vm_nmi(&mut self) -> Result<(), VmError>;
410410

411-
fn vm_migration_progress(&mut self) -> Result<Option<MigrationProgressAndStatus>, VmError>;
411+
/// Returns the progress of the currently active migration or any previous
412+
/// failed or canceled migration.
413+
fn vm_migration_progress(&mut self) -> Option<MigrationProgressAndStatus>;
412414
}
413415

414416
/// It would be nice if we could pass around an object like this:
@@ -1552,8 +1554,8 @@ impl ApiAction for VmMigrationProgress {
15521554
Box::new(move |vmm| {
15531555
info!("API request event: VmMigrationProgress");
15541556

1555-
let response = vmm
1556-
.vm_migration_progress()
1557+
let snapshot = Ok(vmm.vm_migration_progress());
1558+
let response = snapshot
15571559
.map(Box::new)
15581560
.map(ApiResponsePayload::VmMigrationProgress)
15591561
.map_err(ApiError::VmMigrationProgress);

vmm/src/lib.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3571,14 +3571,9 @@ impl RequestHandler for Vmm {
35713571
Ok(())
35723572
}
35733573

3574-
fn vm_migration_progress(
3575-
&mut self,
3576-
) -> result::Result<Option<MigrationProgressAndStatus>, VmError> {
3577-
// We explicitly do not check here for `is VM running?` to always
3578-
// enable querying the state of the last failed migration.
3574+
fn vm_migration_progress(&mut self) -> Option<MigrationProgressAndStatus> {
35793575
let lock = MIGRATION_PROGRESS_SNAPSHOT.lock().unwrap();
3580-
let maybe_snapshot = lock.clone();
3581-
Ok(maybe_snapshot)
3576+
lock.clone()
35823577
}
35833578
}
35843579

0 commit comments

Comments
 (0)