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 <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2023-12-14 10:05:19 +01:00 committed by Dietmar Maurer
parent 2cfa31a218
commit 904bef0231

View File

@ -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<bool>,
}
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<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub options: Option<String>,
/// if set to true, tapes are ejected manually before unloading
pub eject_before_unload: Option<bool>,
}
#[api(