Skip to content

Commit 3de96a9

Browse files
committed
refactor(block): refactor of VirtIOBlock
Simplified `DiskProperties` implementation. Removed a lot of getters from `VirtIOBlock` Removed `CacheTypeState` because it is same as `CacheType` Signed-off-by: Egor Lazarchuk <[email protected]>
1 parent d0885e1 commit 3de96a9

File tree

8 files changed

+133
-189
lines changed

8 files changed

+133
-189
lines changed

src/vmm/src/builder.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -889,19 +889,19 @@ fn attach_block_devices<'a, I: Iterator<Item = &'a BlockDeviceType> + Debug>(
889889
BlockDeviceType::VirtioBlock(block) => {
890890
let id = {
891891
let locked = block.lock().expect("Poisoned lock");
892-
if locked.is_root_device() {
893-
cmdline.insert_str(if let Some(partuuid) = locked.partuuid() {
892+
if locked.root_device {
893+
cmdline.insert_str(if let Some(ref partuuid) = locked.partuuid {
894894
format!("root=PARTUUID={}", partuuid)
895895
} else {
896896
// If no PARTUUID was specified for the root device, try with the
897897
// /dev/vda.
898898
"root=/dev/vda".to_string()
899899
})?;
900900

901-
let flags = if locked.is_read_only() { "ro" } else { "rw" };
901+
let flags = if locked.read_only { "ro" } else { "rw" };
902902
cmdline.insert_str(flags)?;
903903
}
904-
locked.id().clone()
904+
locked.id.clone()
905905
};
906906
// The device mutex mustn't be locked here otherwise it will deadlock.
907907
attach_virtio_device(event_manager, vmm, id, block.clone(), cmdline)?;

0 commit comments

Comments
 (0)