mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: device_manager: Add read-only support for virtio-blk
vhost_user_blk already has it, so it's only fair to give it to virtio-blk too. Extend DiskConfig with a 'readonly' properly, and pass it to vm_virtio::Block. Signed-off-by: Sergio Lopez <slp@redhat.com>
This commit is contained in:
committed by
Rob Bradford
parent
9ac06bf613
commit
fb79e75afc
@@ -938,7 +938,7 @@ impl DeviceManager {
|
||||
// Open block device path
|
||||
let image: File = OpenOptions::new()
|
||||
.read(true)
|
||||
.write(true)
|
||||
.write(!disk_cfg.readonly)
|
||||
.open(&disk_cfg.path)
|
||||
.map_err(DeviceManagerError::Disk)?;
|
||||
|
||||
@@ -951,7 +951,7 @@ impl DeviceManager {
|
||||
let dev = vm_virtio::Block::new(
|
||||
raw_img,
|
||||
disk_cfg.path.clone(),
|
||||
false,
|
||||
disk_cfg.readonly,
|
||||
disk_cfg.iommu,
|
||||
)
|
||||
.map_err(DeviceManagerError::CreateVirtioBlock)?;
|
||||
@@ -970,7 +970,7 @@ impl DeviceManager {
|
||||
let dev = vm_virtio::Block::new(
|
||||
qcow_img,
|
||||
disk_cfg.path.clone(),
|
||||
false,
|
||||
disk_cfg.readonly,
|
||||
disk_cfg.iommu,
|
||||
)
|
||||
.map_err(DeviceManagerError::CreateVirtioBlock)?;
|
||||
|
||||
Reference in New Issue
Block a user