mirror of
https://git.proxmox.com/git/proxmox-backup
synced 2025-08-06 07:59:26 +00:00
api-types: add MaintenanceType::Delete
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
8729f0a549
commit
b9f76a427e
@ -46,6 +46,8 @@ pub enum MaintenanceType {
|
|||||||
ReadOnly,
|
ReadOnly,
|
||||||
/// Neither read nor write operations are allowed on the datastore.
|
/// Neither read nor write operations are allowed on the datastore.
|
||||||
Offline,
|
Offline,
|
||||||
|
/// The datastore is being deleted.
|
||||||
|
Delete,
|
||||||
}
|
}
|
||||||
serde_plain::derive_display_from_serialize!(MaintenanceType);
|
serde_plain::derive_display_from_serialize!(MaintenanceType);
|
||||||
serde_plain::derive_fromstr_from_deserialize!(MaintenanceType);
|
serde_plain::derive_fromstr_from_deserialize!(MaintenanceType);
|
||||||
@ -76,6 +78,10 @@ pub struct MaintenanceMode {
|
|||||||
|
|
||||||
impl MaintenanceMode {
|
impl MaintenanceMode {
|
||||||
pub fn check(&self, operation: Option<Operation>) -> Result<(), Error> {
|
pub fn check(&self, operation: Option<Operation>) -> Result<(), Error> {
|
||||||
|
if self.ty == MaintenanceType::Delete {
|
||||||
|
bail!("datastore is being deleted");
|
||||||
|
}
|
||||||
|
|
||||||
let message = percent_encoding::percent_decode_str(self.message.as_deref().unwrap_or(""))
|
let message = percent_encoding::percent_decode_str(self.message.as_deref().unwrap_or(""))
|
||||||
.decode_utf8()
|
.decode_utf8()
|
||||||
.unwrap_or(Cow::Borrowed(""));
|
.unwrap_or(Cow::Borrowed(""));
|
||||||
|
Loading…
Reference in New Issue
Block a user