[pbs-devel] [PATCH proxmox v2 1/1] pbs-api-types: Added changer schema for automatic drive assignment

Laurențiu Leahu-Vlăducu l.leahu-vladucu at proxmox.com
Thu Feb 6 13:28:31 CET 2025


While the current changer schema is technically able to do the same
checks as the new one, the new schema has been added to improve the
description of the changer parameter for this specific use case,
in order to have proper documentation for the proxmox-tape CLI tool,
making it clear to the user what the parameter is supposed to do.

Signed-off-by: Laurențiu Leahu-Vlăducu <l.leahu-vladucu at proxmox.com>
---
 pbs-api-types/src/tape/changer.rs | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/pbs-api-types/src/tape/changer.rs b/pbs-api-types/src/tape/changer.rs
index df3823cf..704ef989 100644
--- a/pbs-api-types/src/tape/changer.rs
+++ b/pbs-api-types/src/tape/changer.rs
@@ -8,12 +8,22 @@ use proxmox_schema::{
 
 use crate::{OptionalDeviceIdentification, PROXMOX_SAFE_ID_FORMAT};
 
+const TAPE_CHANGER_MIN_LENGTH: usize = 3;
+const TAPE_CHANGER_MAX_LENGTH: usize = 32;
+
 pub const CHANGER_NAME_SCHEMA: Schema = StringSchema::new("Tape Changer Identifier.")
     .format(&PROXMOX_SAFE_ID_FORMAT)
-    .min_length(3)
-    .max_length(32)
+    .min_length(TAPE_CHANGER_MIN_LENGTH)
+    .max_length(TAPE_CHANGER_MAX_LENGTH)
     .schema();
 
+pub const CHANGER_NAME_SCHEMA_AUTOMATIC_DRIVE_ASSIGNMENT: Schema =
+    StringSchema::new("Tape Changer Identifier to be used for automatic tape drive assignment.")
+        .format(&PROXMOX_SAFE_ID_FORMAT)
+        .min_length(TAPE_CHANGER_MIN_LENGTH)
+        .max_length(TAPE_CHANGER_MAX_LENGTH)
+        .schema();
+
 pub const SCSI_CHANGER_PATH_SCHEMA: Schema =
     StringSchema::new("Path to Linux generic SCSI device (e.g. '/dev/sg4')").schema();
 
-- 
2.39.5





More information about the pbs-devel mailing list