runtime-rs: Introduce a field host_devices within NamedHypervisorConfig

This commit introduce `host_devices` to help convert vfio devices from
a generic hypervisor config to a cloud-hypervisor specific VmConfig.

Signed-off-by: alex.lyn <alex.lyn@antgroup.com>
Signed-off-by: Fupan Li <fupan.lfp@antgroup.com>
This commit is contained in:
alex.lyn
2025-07-09 11:30:54 +08:00
parent d37183d754
commit 0b5b8f549d
2 changed files with 3 additions and 2 deletions

View File

@@ -491,6 +491,7 @@ pub struct NamedHypervisorConfig {
pub shared_fs_devices: Option<Vec<FsConfig>>,
pub network_devices: Option<Vec<NetConfig>>,
pub host_devices: Option<Vec<DeviceConfig>>,
// Set to the available guest protection *iff* BOTH of the following
// conditions are true:

View File

@@ -185,8 +185,7 @@ impl CloudHypervisorInner {
}
async fn boot_vm(&mut self) -> Result<()> {
let (shared_fs_devices, network_devices, _) = self.get_shared_devices().await?;
let (shared_fs_devices, network_devices, host_devices) = self.get_shared_devices().await?;
let socket = self
.api_socket
.as_ref()
@@ -215,6 +214,7 @@ impl CloudHypervisorInner {
guest_protection_to_use: self.guest_protection_to_use.clone(),
shared_fs_devices,
network_devices,
host_devices,
};
let cfg = VmConfig::try_from(named_cfg)?;