[pbs-devel] [PATCH proxmox-backup v4 09/22] pbs-api-types: datastore: use new proxmox_schema::de for deserialization

Hannes Laimer h.laimer at proxmox.com
Tue Apr 16 17:24:03 CEST 2024


Signed-off-by: Hannes Laimer <h.laimer at proxmox.com>
---
 pbs-api-types/src/datastore.rs | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/pbs-api-types/src/datastore.rs b/pbs-api-types/src/datastore.rs
index 898149ea..b5b9784f 100644
--- a/pbs-api-types/src/datastore.rs
+++ b/pbs-api-types/src/datastore.rs
@@ -348,10 +348,13 @@ impl DataStoreConfig {
     }
 
     pub fn get_maintenance_mode(&self) -> Option<MaintenanceMode> {
-        self.maintenance_mode
-            .as_ref()
-            .and_then(|str| MaintenanceMode::API_SCHEMA.parse_property_string(str).ok())
-            .and_then(|value| MaintenanceMode::deserialize(value).ok())
+        self.maintenance_mode.as_ref().and_then(|str| {
+            MaintenanceMode::deserialize(proxmox_schema::de::SchemaDeserializer::new(
+                str,
+                &MaintenanceMode::API_SCHEMA,
+            ))
+            .ok()
+        })
     }
 }
 
-- 
2.39.2





More information about the pbs-devel mailing list