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 <alex.lyn@antgroup.com>
This commit is contained in:
alex.lyn 2023-12-10 19:01:48 +08:00
parent 1c42d94550
commit 80d631ee84

View File

@ -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<String, String>,
/// Additional mount options.
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub options: Vec<String>,
}