[pbs-devel] [PATCH proxmox-backup 2/2] sync: push: use min version helper for api compatibility checks

Christian Ebner c.ebner at proxmox.com
Thu Nov 28 13:49:25 CET 2024


Use the compatibility check helper to reduce possible errors when
comparing api version.

No functional change intended.

Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
 src/server/push.rs | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/server/push.rs b/src/server/push.rs
index 95c7c6bff..957eb1ab2 100644
--- a/src/server/push.rs
+++ b/src/server/push.rs
@@ -129,13 +129,12 @@ impl PushParameters {
         let api_version = ApiVersion::try_from(version_info)?;
 
         // push assumes namespace support on the remote side, fail early if missing
-        if api_version.major < 2 || (api_version.major == 2 && api_version.minor < 2) {
+        if !api_version.is_min_required(ApiVersion::new(2, 2, 0, String::new())) {
             bail!("Unsupported remote api version, minimum v2.2 required");
         }
 
-        let supports_prune_delete_stats = api_version.major > 3
-            || (api_version.major == 3 && api_version.minor >= 3)
-            || (api_version.major == 3 && api_version.minor == 2 && api_version.release >= 11);
+        let supports_prune_delete_stats =
+            api_version.is_min_required(ApiVersion::new(3, 2, 11, String::new()));
 
         let target = PushTarget {
             remote,
-- 
2.39.5





More information about the pbs-devel mailing list