runtime-rs: Convert host devices within VmConfig for cloud-hypervisor

This PR adds support for adding a network device before starting the
cloud-hypervisor VM.
This commit will get the host devices from NamedHypervisorConfig and
assign it to VmConfig's devices which is for vfio devices when clh
starts launching.
And with this, it successfully finish the vfio devices conversion from
a generic Hypervisor config to a clh 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:35:51 +08:00
parent 0b5b8f549d
commit 3fbe493edc

View File

@ -109,6 +109,7 @@ impl TryFrom<NamedHypervisorConfig> for VmConfig {
let fs = n.shared_fs_devices; let fs = n.shared_fs_devices;
let net = n.network_devices; let net = n.network_devices;
let host_devices = n.host_devices;
let cpus = CpusConfig::try_from((cfg.cpu_info, guest_protection_to_use.clone())) let cpus = CpusConfig::try_from((cfg.cpu_info, guest_protection_to_use.clone()))
.map_err(VmConfigError::CPUError)?; .map_err(VmConfigError::CPUError)?;
@ -197,6 +198,7 @@ impl TryFrom<NamedHypervisorConfig> for VmConfig {
payload, payload,
fs, fs,
net, net,
devices: host_devices,
pmem, pmem,
disks, disks,
vsock: Some(vsock), vsock: Some(vsock),