From 80d631ee848c55a5f23c2a5db0c60093a5f7add7 Mon Sep 17 00:00:00 2001 From: "alex.lyn" Date: Sun, 10 Dec 2023 19:01:48 +0800 Subject: [PATCH] runtime-rs: Add attribute serde rename to each field of DirectVolume. DirectVolume structure in runtime-rs is different from it in kata-runtime, which causes they has no unified handling method for DirectVolumeMountInfo and MountInfo. We should align the two by simply adding the attribute #[serde(rename="x") to each field in DirectVolumeMountInfo Fixes: #8619 Signed-off-by: alex.lyn --- src/libs/kata-types/src/mount.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libs/kata-types/src/mount.rs b/src/libs/kata-types/src/mount.rs index d5e378e7de..b6d8784317 100644 --- a/src/libs/kata-types/src/mount.rs +++ b/src/libs/kata-types/src/mount.rs @@ -94,14 +94,18 @@ impl Mount { #[derive(Debug, Clone, Eq, PartialEq, Default, Serialize, Deserialize)] pub struct DirectVolumeMountInfo { /// The type of the volume (ie. block) + #[serde(rename = "volume-type")] pub volume_type: String, /// The device backing the volume. pub device: String, /// The filesystem type to be mounted on the volume. + #[serde(rename = "fstype")] pub fs_type: String, /// Additional metadata to pass to the agent regarding this volume. + #[serde(default, skip_serializing_if = "HashMap::is_empty")] pub metadata: HashMap, /// Additional mount options. + #[serde(default, skip_serializing_if = "Vec::is_empty")] pub options: Vec, }