diff --git a/pbs-api-types/src/datastore.rs b/pbs-api-types/src/datastore.rs index 9bcec719..4927f372 100644 --- a/pbs-api-types/src/datastore.rs +++ b/pbs-api-types/src/datastore.rs @@ -178,6 +178,20 @@ pub enum ChunkOrder { Inode, } +#[api] +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "lowercase")] +/// Current mounting status of a datastore, useful for removable datastores. +pub enum DataStoreMountStatus { + /// Removable datastore is currently mounted correctly. + Mounted, + /// Removable datastore is currebtly not mounted. + NotMounted, + /// Datastore is not removable, so there is no mount status. + #[default] + NonRemovable, +} + #[api] #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)] #[serde(rename_all = "lowercase")] @@ -451,6 +465,7 @@ impl DataStoreConfig { pub struct DataStoreListItem { pub store: String, pub comment: Option, + pub mount_status: DataStoreMountStatus, /// If the datastore is in maintenance mode, information about it #[serde(skip_serializing_if = "Option::is_none")] pub maintenance: Option, @@ -1456,6 +1471,7 @@ pub struct DataStoreStatusListItem { /// The available bytes of the underlying storage. (-1 on error) #[serde(skip_serializing_if = "Option::is_none")] pub avail: Option, + pub mount_status: DataStoreMountStatus, /// A list of usages of the past (last Month). #[serde(skip_serializing_if = "Option::is_none")] pub history: Option>>, @@ -1480,12 +1496,13 @@ pub struct DataStoreStatusListItem { } impl DataStoreStatusListItem { - pub fn empty(store: &str, err: Option) -> Self { + pub fn empty(store: &str, err: Option, mount_status: DataStoreMountStatus) -> Self { DataStoreStatusListItem { store: store.to_owned(), total: None, used: None, avail: None, + mount_status, history: None, history_start: None, history_delta: None,