mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: Make vhost-user configuration owned
Convert Path to PathBuf, &str to String 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
5f8a62f3d0
commit
3dc7aff00e
@@ -463,13 +463,13 @@ impl DeviceConfig {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct VhostUserNetConfig<'a> {
|
||||
pub struct VhostUserNetConfig {
|
||||
pub mac: MacAddr,
|
||||
pub vu_cfg: VhostUserConfig<'a>,
|
||||
pub vu_cfg: VhostUserConfig,
|
||||
}
|
||||
|
||||
impl<'a> VhostUserNetConfig<'a> {
|
||||
pub fn parse(vhost_user_net: &'a str) -> Result<Self> {
|
||||
impl VhostUserNetConfig {
|
||||
pub fn parse(vhost_user_net: &str) -> Result<Self> {
|
||||
// Split the parameters based on the comma delimiter
|
||||
let params_list: Vec<&str> = vhost_user_net.split(',').collect();
|
||||
|
||||
@@ -512,7 +512,7 @@ impl<'a> VhostUserNetConfig<'a> {
|
||||
}
|
||||
|
||||
let vu_cfg = VhostUserConfig {
|
||||
sock,
|
||||
sock: sock.to_string(),
|
||||
num_queues,
|
||||
queue_size,
|
||||
};
|
||||
@@ -553,13 +553,13 @@ impl<'a> VsockConfig<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct VhostUserBlkConfig<'a> {
|
||||
pub struct VhostUserBlkConfig {
|
||||
pub wce: bool,
|
||||
pub vu_cfg: VhostUserConfig<'a>,
|
||||
pub vu_cfg: VhostUserConfig,
|
||||
}
|
||||
|
||||
impl<'a> VhostUserBlkConfig<'a> {
|
||||
pub fn parse(vhost_user_blk: &'a str) -> Result<Self> {
|
||||
impl VhostUserBlkConfig {
|
||||
pub fn parse(vhost_user_blk: &str) -> Result<Self> {
|
||||
// Split the parameters based on the comma delimiter
|
||||
let params_list: Vec<&str> = vhost_user_blk.split(',').collect();
|
||||
|
||||
@@ -599,7 +599,7 @@ impl<'a> VhostUserBlkConfig<'a> {
|
||||
}
|
||||
|
||||
let vu_cfg = VhostUserConfig {
|
||||
sock,
|
||||
sock: sock.to_string(),
|
||||
num_queues,
|
||||
queue_size,
|
||||
};
|
||||
@@ -621,8 +621,8 @@ pub struct VmConfig<'a> {
|
||||
pub serial: ConsoleConfig,
|
||||
pub console: ConsoleConfig,
|
||||
pub devices: Option<Vec<DeviceConfig>>,
|
||||
pub vhost_user_net: Option<Vec<VhostUserNetConfig<'a>>>,
|
||||
pub vhost_user_blk: Option<Vec<VhostUserBlkConfig<'a>>>,
|
||||
pub vhost_user_net: Option<Vec<VhostUserNetConfig>>,
|
||||
pub vhost_user_blk: Option<Vec<VhostUserBlkConfig>>,
|
||||
pub vsock: Option<Vec<VsockConfig<'a>>>,
|
||||
}
|
||||
|
||||
|
||||
@@ -773,7 +773,7 @@ impl DeviceManager {
|
||||
for vhost_user_net_cfg in vhost_user_net_list_cfg.iter() {
|
||||
let vhost_user_net_device = vm_virtio::vhost_user::Net::new(
|
||||
vhost_user_net_cfg.mac,
|
||||
vhost_user_net_cfg.vu_cfg,
|
||||
vhost_user_net_cfg.vu_cfg.clone(),
|
||||
)
|
||||
.map_err(DeviceManagerError::CreateVhostUserNet)?;
|
||||
|
||||
@@ -793,7 +793,7 @@ impl DeviceManager {
|
||||
for vhost_user_blk_cfg in vhost_user_blk_list_cfg.iter() {
|
||||
let vhost_user_blk_device = vm_virtio::vhost_user::Blk::new(
|
||||
vhost_user_blk_cfg.wce,
|
||||
vhost_user_blk_cfg.vu_cfg,
|
||||
vhost_user_blk_cfg.vu_cfg.clone(),
|
||||
)
|
||||
.map_err(DeviceManagerError::CreateVhostUserBlk)?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user