mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: device_manager: Add 'direct' 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 'direct' property, honor it while opening the file backing the disk image, and pass it to vm_virtio::RawFile. Fixes #631 Signed-off-by: Sergio Lopez <slp@redhat.com>
This commit is contained in:
committed by
Rob Bradford
parent
2bd90d9263
commit
925c862f98
@@ -340,6 +340,8 @@ pub struct DiskConfig {
|
||||
#[serde(default)]
|
||||
pub readonly: bool,
|
||||
#[serde(default)]
|
||||
pub direct: bool,
|
||||
#[serde(default)]
|
||||
pub iommu: bool,
|
||||
}
|
||||
|
||||
@@ -350,6 +352,7 @@ impl DiskConfig {
|
||||
|
||||
let mut path_str: &str = "";
|
||||
let mut readonly_str: &str = "";
|
||||
let mut direct_str: &str = "";
|
||||
let mut iommu_str: &str = "";
|
||||
|
||||
for param in params_list.iter() {
|
||||
@@ -357,6 +360,8 @@ impl DiskConfig {
|
||||
path_str = ¶m[5..];
|
||||
} else if param.starts_with("readonly=") {
|
||||
readonly_str = ¶m[9..];
|
||||
} else if param.starts_with("direct=") {
|
||||
direct_str = ¶m[7..];
|
||||
} else if param.starts_with("iommu=") {
|
||||
iommu_str = ¶m[6..];
|
||||
}
|
||||
@@ -365,6 +370,7 @@ impl DiskConfig {
|
||||
Ok(DiskConfig {
|
||||
path: PathBuf::from(path_str),
|
||||
readonly: parse_on_off(readonly_str)?,
|
||||
direct: parse_on_off(direct_str)?,
|
||||
iommu: parse_on_off(iommu_str)?,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user