datastore status: impl empty-status constructor for item type

we can now use it for the error case and will further use it for the
can access namespace but not datastore case in a future patch

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2022-05-26 13:33:58 +02:00
parent f6a37f40f6
commit 79cf434a79

View File

@ -1361,6 +1361,23 @@ pub struct DataStoreStatusListItem {
pub gc_status: Option<GarbageCollectionStatus>, pub gc_status: Option<GarbageCollectionStatus>,
} }
impl DataStoreStatusListItem {
pub fn empty(store: &str, err: Option<String>) -> Self {
DataStoreStatusListItem {
store: store.to_owned(),
total: -1,
used: -1,
avail: -1,
history: None,
history_start: None,
history_delta: None,
estimated_full_date: None,
error: err,
gc_status: None,
}
}
}
pub const ADMIN_DATASTORE_LIST_SNAPSHOTS_RETURN_TYPE: ReturnType = ReturnType { pub const ADMIN_DATASTORE_LIST_SNAPSHOTS_RETURN_TYPE: ReturnType = ReturnType {
optional: false, optional: false,
schema: &ArraySchema::new( schema: &ArraySchema::new(