]> git.proxmox.com Git - proxmox-backup.git/commitdiff
api-types: add MaintenanceType::Delete
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Fri, 25 Nov 2022 10:19:11 +0000 (11:19 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 28 Nov 2022 13:45:39 +0000 (14:45 +0100)
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
pbs-api-types/src/maintenance.rs

index e46ba90a76d932504763e40b6aa7ef60bb509f1c..1b03ca9421b9da858771e5b8ee37baeeb537aa91 100644 (file)
@@ -46,6 +46,8 @@ pub enum MaintenanceType {
     ReadOnly,
     /// Neither read nor write operations are allowed on the datastore.
     Offline,
+    /// The datastore is being deleted.
+    Delete,
 }
 serde_plain::derive_display_from_serialize!(MaintenanceType);
 serde_plain::derive_fromstr_from_deserialize!(MaintenanceType);
@@ -76,6 +78,10 @@ pub struct MaintenanceMode {
 
 impl MaintenanceMode {
     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(""))
             .decode_utf8()
             .unwrap_or(Cow::Borrowed(""));