From f1f8c65c70dbfdececdef6f91a245cbac6f00968 Mon Sep 17 00:00:00 2001 From: Hannes Laimer Date: Tue, 26 Nov 2024 12:43:21 +0100 Subject: [PATCH] api: types: add 'mount_status' to schema ... and deserialize with default if field is missing in data. Reported-by: Aaron Lauterer Fixes: 35fb5d4f7f ("pbs-api-types: add mount_status field to DataStoreListItem") Signed-off-by: Hannes Laimer --- pbs-api-types/src/datastore.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pbs-api-types/src/datastore.rs b/pbs-api-types/src/datastore.rs index 203e75e3..90f1195b 100644 --- a/pbs-api-types/src/datastore.rs +++ b/pbs-api-types/src/datastore.rs @@ -452,6 +452,9 @@ impl DataStoreConfig { optional: true, schema: SINGLE_LINE_COMMENT_SCHEMA, }, + "mount-status": { + type: DataStoreMountStatus, + }, maintenance: { optional: true, format: &ApiStringFormat::PropertyString(&MaintenanceMode::API_SCHEMA), @@ -465,6 +468,7 @@ impl DataStoreConfig { pub struct DataStoreListItem { pub store: String, pub comment: Option, + #[serde(default)] pub mount_status: DataStoreMountStatus, /// If the datastore is in maintenance mode, information about it #[serde(skip_serializing_if = "Option::is_none")] @@ -1447,6 +1451,9 @@ pub struct DataStoreStatus { store: { schema: DATASTORE_SCHEMA, }, + "mount-status": { + type: DataStoreMountStatus, + }, history: { type: Array, optional: true, @@ -1471,6 +1478,7 @@ pub struct DataStoreStatusListItem { /// The available bytes of the underlying storage. (-1 on error) #[serde(skip_serializing_if = "Option::is_none")] pub avail: Option, + #[serde(default)] pub mount_status: DataStoreMountStatus, /// A list of usages of the past (last Month). #[serde(skip_serializing_if = "Option::is_none")]