vmm: config: Switch DiskConfig to use PciDeviceCommonConfig

Switch DiskConfig 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.

Signed-off-by: Rob Bradford <rbradford@meta.com>
This commit is contained in:
Rob Bradford
2026-04-03 11:18:09 -07:00
parent a96da9d4bc
commit d2ce7667bc
3 changed files with 46 additions and 55 deletions

View File

@@ -285,13 +285,13 @@ pub struct PciDeviceCommonConfig {
#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
pub struct DiskConfig {
#[serde(flatten)]
pub pci_common: PciDeviceCommonConfig,
pub path: Option<PathBuf>,
#[serde(default)]
pub readonly: bool,
#[serde(default)]
pub direct: bool,
#[serde(default)]
pub iommu: bool,
#[serde(default = "default_diskconfig_num_queues")]
pub num_queues: usize,
#[serde(default = "default_diskconfig_queue_size")]
@@ -303,8 +303,6 @@ pub struct DiskConfig {
pub rate_limit_group: Option<String>,
#[serde(default)]
pub rate_limiter_config: Option<RateLimiterConfig>,
#[serde(default)]
pub id: Option<String>,
// For testing use only. Not exposed in API.
#[serde(default)]
pub disable_io_uring: bool,
@@ -312,8 +310,6 @@ pub struct DiskConfig {
#[serde(default)]
pub disable_aio: bool,
#[serde(default)]
pub pci_segment: u16,
#[serde(default)]
pub serial: Option<String>,
#[serde(default)]
pub queue_affinity: Option<Vec<VirtQueueAffinity>>,