[pbs-devel] [PATCH proxmox-backup 2/4] api2: DataStoreListItem add maintenance info
Thomas Lamprecht
t.lamprecht at proxmox.com
Mon Apr 25 08:31:41 CEST 2022
On 15.04.22 09:28, Hannes Laimer wrote:
> Signed-off-by: Hannes Laimer <h.laimer at proxmox.com>
> ---
> pbs-api-types/src/datastore.rs | 5 +++++
> src/api2/admin/datastore.rs | 1 +
> 2 files changed, 6 insertions(+)
>
> diff --git a/pbs-api-types/src/datastore.rs b/pbs-api-types/src/datastore.rs
> index 01e2319a..0fc5622e 100644
> --- a/pbs-api-types/src/datastore.rs
> +++ b/pbs-api-types/src/datastore.rs
> @@ -330,6 +330,9 @@ impl DataStoreConfig {
> optional: true,
> schema: SINGLE_LINE_COMMENT_SCHEMA,
> },
> + maintenance: {
> + type: bool,
> + }
> },
> )]
> #[derive(Serialize, Deserialize)]
> @@ -338,6 +341,8 @@ impl DataStoreConfig {
> pub struct DataStoreListItem {
> pub store: String,
> pub comment: Option<String>,
> + /// The datastore is in maintenance mode
> + pub maintenance: bool,
In addition to Fabians comment w.r.t. to keeping this backward compatible I'd also return
the message string, we already got it anyway and an API user can show that too then (e.g.,
tooltip in the nav.tree), like:
#[serde(skip_serializing_if = "Option::is_none")]
pub maintenance: Option <String>,
(String should be replaced with the specific maintenance mdoe type, if any.)
> }
>
> #[api(
> diff --git a/src/api2/admin/datastore.rs b/src/api2/admin/datastore.rs
> index ce5bd244..22bce40d 100644
> --- a/src/api2/admin/datastore.rs
> +++ b/src/api2/admin/datastore.rs
> @@ -1084,6 +1084,7 @@ pub fn get_datastore_list(
> DataStoreListItem {
> store: store.clone(),
> comment: data["comment"].as_str().map(String::from),
> + maintenance: data.get("maintenance-mode").is_some(),
> }
> );
> }
More information about the pbs-devel
mailing list