mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: Make DiskConfig owned
Convert Path to PathBuf and remove the associated lifetime. Fixes #298 Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
committed by
Rob Bradford
parent
036890e5be
commit
675e46355c
@@ -540,7 +540,7 @@ impl DeviceManager {
|
||||
let raw_img: File = OpenOptions::new()
|
||||
.read(true)
|
||||
.write(true)
|
||||
.open(disk_cfg.path)
|
||||
.open(&disk_cfg.path)
|
||||
.map_err(DeviceManagerError::Disk)?;
|
||||
|
||||
let image_type = qcow::detect_image_type(&raw_img)
|
||||
@@ -548,17 +548,15 @@ impl DeviceManager {
|
||||
let block = match image_type {
|
||||
ImageType::Raw => {
|
||||
let raw_img = vm_virtio::RawFile::new(raw_img);
|
||||
let dev =
|
||||
vm_virtio::Block::new(raw_img, disk_cfg.path.to_path_buf(), false)
|
||||
.map_err(DeviceManagerError::CreateVirtioBlock)?;
|
||||
let dev = vm_virtio::Block::new(raw_img, disk_cfg.path.clone(), false)
|
||||
.map_err(DeviceManagerError::CreateVirtioBlock)?;
|
||||
Box::new(dev) as Box<dyn vm_virtio::VirtioDevice>
|
||||
}
|
||||
ImageType::Qcow2 => {
|
||||
let qcow_img = QcowFile::from(raw_img)
|
||||
.map_err(DeviceManagerError::QcowDeviceCreate)?;
|
||||
let dev =
|
||||
vm_virtio::Block::new(qcow_img, disk_cfg.path.to_path_buf(), false)
|
||||
.map_err(DeviceManagerError::CreateVirtioBlock)?;
|
||||
let dev = vm_virtio::Block::new(qcow_img, disk_cfg.path.clone(), false)
|
||||
.map_err(DeviceManagerError::CreateVirtioBlock)?;
|
||||
Box::new(dev) as Box<dyn vm_virtio::VirtioDevice>
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user