mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
block: disk_file: Add Resizable trait
Live disk resize support. Single method resize() taking &mut self and the new size in bytes. Implementations may return an error if the backend does not support resizing. Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
committed by
Rob Bradford
parent
a0a5718b42
commit
da1b104493
@@ -81,3 +81,12 @@ pub trait SparseCapable: Send + Debug {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
/// Live disk resize support.
|
||||
///
|
||||
/// Implementations may return an error if the backend does not
|
||||
/// support resizing (e.g. fixed size formats).
|
||||
pub trait Resizable: Send + Debug {
|
||||
/// Resizes the disk image to the given size in bytes, if the backend supports it.
|
||||
fn resize(&mut self, size: u64) -> BlockResult<()>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user