vmm: config: Switch GenericVhostUserConfig to use PciDeviceCommonConfig

Switch GenericVhostUserConfig over to using the newly extracted struct
members as used by all PCI based devices. The use of #[serde(flatten)]
means that this change has no impact on the JSON format that the data is
stored as.

As generic vhost-user devices do not support being placed behind an
IOMMU an error is now raised if iommu is set. This can't happen via the
CLI but could via the JSON/API.

Signed-off-by: Rob Bradford <rbradford@meta.com>
This commit is contained in:
Rob Bradford
2026-04-03 11:59:42 -07:00
parent 40150dd72d
commit 0d3080e036
3 changed files with 19 additions and 32 deletions

View File

@@ -498,12 +498,10 @@ impl ApplyLandlock for FsConfig {
#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
pub struct GenericVhostUserConfig {
#[serde(flatten)]
pub pci_common: PciDeviceCommonConfig,
pub socket: PathBuf,
pub queue_sizes: Vec<u16>,
#[serde(default)]
pub id: Option<String>,
#[serde(default)]
pub pci_segment: u16,
pub device_type: u32,
}