api: types: add 'mount_status' to schema

... and deserialize with default if field is missing in data.

Reported-by: Aaron Lauterer <a.lauterer@proxmox.com>
Fixes: 35fb5d4f7f ("pbs-api-types: add mount_status field to DataStoreListItem")
Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
This commit is contained in:
Hannes Laimer 2024-11-26 12:43:21 +01:00 committed by Fabian Grünbichler
parent 2ed9c4bfca
commit f1f8c65c70

View File

@ -452,6 +452,9 @@ impl DataStoreConfig {
optional: true, optional: true,
schema: SINGLE_LINE_COMMENT_SCHEMA, schema: SINGLE_LINE_COMMENT_SCHEMA,
}, },
"mount-status": {
type: DataStoreMountStatus,
},
maintenance: { maintenance: {
optional: true, optional: true,
format: &ApiStringFormat::PropertyString(&MaintenanceMode::API_SCHEMA), format: &ApiStringFormat::PropertyString(&MaintenanceMode::API_SCHEMA),
@ -465,6 +468,7 @@ impl DataStoreConfig {
pub struct DataStoreListItem { pub struct DataStoreListItem {
pub store: String, pub store: String,
pub comment: Option<String>, pub comment: Option<String>,
#[serde(default)]
pub mount_status: DataStoreMountStatus, pub mount_status: DataStoreMountStatus,
/// If the datastore is in maintenance mode, information about it /// If the datastore is in maintenance mode, information about it
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
@ -1447,6 +1451,9 @@ pub struct DataStoreStatus {
store: { store: {
schema: DATASTORE_SCHEMA, schema: DATASTORE_SCHEMA,
}, },
"mount-status": {
type: DataStoreMountStatus,
},
history: { history: {
type: Array, type: Array,
optional: true, optional: true,
@ -1471,6 +1478,7 @@ pub struct DataStoreStatusListItem {
/// The available bytes of the underlying storage. (-1 on error) /// The available bytes of the underlying storage. (-1 on error)
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub avail: Option<u64>, pub avail: Option<u64>,
#[serde(default)]
pub mount_status: DataStoreMountStatus, pub mount_status: DataStoreMountStatus,
/// A list of usages of the past (last Month). /// A list of usages of the past (last Month).
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]