[pbs-devel] [PATCH proxmox-backup v3 09/24] pbs-api-types: datastore: use new proxmox_scheme::de for deserialization

Hannes Laimer h.laimer at proxmox.com
Tue Apr 9 12:59:57 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 b6d238ed..738ba96f 100644
--- a/pbs-api-types/src/datastore.rs
+++ b/pbs-api-types/src/datastore.rs
@@ -346,10 +346,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()
+        })
     }
 
     pub fn set_maintenance_mode(&mut self, mode: Option<MaintenanceMode>) {
-- 
2.39.2





More information about the pbs-devel mailing list