mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: config: Switch FsConfig to use PciDeviceCommonConfig
Switch FsConfig 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 virtio-fs does not support being placed behind an IOMMU an error is now raised if iommu is set. This option is not exposed via the CLI but could happen with a miscontructed JSON/API call. Signed-off-by: Rob Bradford <rbradford@meta.com>
This commit is contained in:
@@ -3216,11 +3216,11 @@ impl DeviceManager {
|
||||
&mut self,
|
||||
fs_cfg: &mut FsConfig,
|
||||
) -> DeviceManagerResult<MetaVirtioDevice> {
|
||||
let id = if let Some(id) = &fs_cfg.id {
|
||||
let id = if let Some(id) = &fs_cfg.pci_common.id {
|
||||
id.clone()
|
||||
} else {
|
||||
let id = self.next_device_name(FS_DEVICE_NAME_PREFIX)?;
|
||||
fs_cfg.id = Some(id.clone());
|
||||
fs_cfg.pci_common.id = Some(id.clone());
|
||||
id
|
||||
};
|
||||
|
||||
@@ -3257,7 +3257,7 @@ impl DeviceManager {
|
||||
as Arc<Mutex<dyn virtio_devices::VirtioDevice>>,
|
||||
iommu: false,
|
||||
id,
|
||||
pci_segment: fs_cfg.pci_segment,
|
||||
pci_segment: fs_cfg.pci_common.pci_segment,
|
||||
dma_handler: None,
|
||||
})
|
||||
} else {
|
||||
@@ -5039,7 +5039,7 @@ impl DeviceManager {
|
||||
}
|
||||
|
||||
pub fn add_fs(&mut self, fs_cfg: &mut FsConfig) -> DeviceManagerResult<PciDeviceInfo> {
|
||||
self.validate_identifier(&fs_cfg.id)?;
|
||||
self.validate_identifier(&fs_cfg.pci_common.id)?;
|
||||
|
||||
let device = self.make_virtio_fs_device(fs_cfg)?;
|
||||
self.hotplug_virtio_pci_device(device)
|
||||
|
||||
Reference in New Issue
Block a user