From 904bef02312afd9d633cda5149e37a717cf89887 Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Thu, 14 Dec 2023 10:05:19 +0100 Subject: [PATCH] tape: move 'eject-before-unload' to a plain changer config option instead of having it in a property string. For now this should be fine, and if we need many more such options, we can still move them into a property string if we want. Also update the cli command in the docs on how to set it now. Signed-off-by: Dominik Csapak --- pbs-api-types/src/tape/changer.rs | 34 ++++++------------------------- 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/pbs-api-types/src/tape/changer.rs b/pbs-api-types/src/tape/changer.rs index 9e36b12e..df3823cf 100644 --- a/pbs-api-types/src/tape/changer.rs +++ b/pbs-api-types/src/tape/changer.rs @@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize}; use proxmox_schema::{ - api, ApiStringFormat, ApiType, ArraySchema, IntegerSchema, Schema, StringSchema, Updater, + api, ApiStringFormat, ArraySchema, IntegerSchema, Schema, StringSchema, Updater, }; use crate::{OptionalDeviceIdentification, PROXMOX_SAFE_ID_FORMAT}; @@ -39,29 +39,6 @@ Import/Export, i.e. any media in those slots are considered to be .format(&ApiStringFormat::PropertyString(&SLOT_ARRAY_SCHEMA)) .schema(); -#[api( - properties: { - "eject-before-unload": { - optional: true, - default: false, - }, - }, -)] -#[derive(Serialize, Deserialize)] -#[serde(rename_all = "kebab-case")] -/// Options for Changers -pub struct ChangerOptions { - #[serde(skip_serializing_if = "Option::is_none")] - /// if set to true, tapes are ejected manually before unloading - pub eject_before_unload: Option, -} - -pub const CHANGER_OPTIONS_STRING_SCHEMA: Schema = StringSchema::new("Changer options") - .format(&ApiStringFormat::PropertyString( - &ChangerOptions::API_SCHEMA, - )) - .schema(); - #[api( properties: { name: { @@ -74,10 +51,10 @@ pub const CHANGER_OPTIONS_STRING_SCHEMA: Schema = StringSchema::new("Changer opt schema: EXPORT_SLOT_LIST_SCHEMA, optional: true, }, - options: { + "eject-before-unload": { optional: true, - schema: CHANGER_OPTIONS_STRING_SCHEMA, - }, + default: false, + } }, )] #[derive(Serialize, Deserialize, Updater)] @@ -90,7 +67,8 @@ pub struct ScsiTapeChanger { #[serde(skip_serializing_if = "Option::is_none")] pub export_slots: Option, #[serde(skip_serializing_if = "Option::is_none")] - pub options: Option, + /// if set to true, tapes are ejected manually before unloading + pub eject_before_unload: Option, } #[api(