tape: rename changer_drive_id to changer_drivenum
This commit is contained in:
parent
5fdaecf6f4
commit
d737adc6be
@ -10,7 +10,7 @@ use crate::{
|
|||||||
PROXMOX_CONFIG_DIGEST_SCHEMA,
|
PROXMOX_CONFIG_DIGEST_SCHEMA,
|
||||||
DRIVE_NAME_SCHEMA,
|
DRIVE_NAME_SCHEMA,
|
||||||
CHANGER_NAME_SCHEMA,
|
CHANGER_NAME_SCHEMA,
|
||||||
CHANGER_DRIVE_ID_SCHEMA,
|
CHANGER_DRIVENUM_SCHEMA,
|
||||||
LINUX_DRIVE_PATH_SCHEMA,
|
LINUX_DRIVE_PATH_SCHEMA,
|
||||||
DriveListEntry,
|
DriveListEntry,
|
||||||
LinuxTapeDrive,
|
LinuxTapeDrive,
|
||||||
@ -36,8 +36,8 @@ use crate::{
|
|||||||
schema: CHANGER_NAME_SCHEMA,
|
schema: CHANGER_NAME_SCHEMA,
|
||||||
optional: true,
|
optional: true,
|
||||||
},
|
},
|
||||||
"changer-drive-id": {
|
"changer-drivenum": {
|
||||||
schema: CHANGER_DRIVE_ID_SCHEMA,
|
schema: CHANGER_DRIVENUM_SCHEMA,
|
||||||
optional: true,
|
optional: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -129,8 +129,8 @@ pub fn list_drives(
|
|||||||
pub enum DeletableProperty {
|
pub enum DeletableProperty {
|
||||||
/// Delete the changer property.
|
/// Delete the changer property.
|
||||||
changer,
|
changer,
|
||||||
/// Delete the changer-drive-id property.
|
/// Delete the changer-drivenum property.
|
||||||
changer_drive_id,
|
changer_drivenum,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[api(
|
#[api(
|
||||||
@ -148,8 +148,8 @@ pub enum DeletableProperty {
|
|||||||
schema: CHANGER_NAME_SCHEMA,
|
schema: CHANGER_NAME_SCHEMA,
|
||||||
optional: true,
|
optional: true,
|
||||||
},
|
},
|
||||||
"changer-drive-id": {
|
"changer-drivenum": {
|
||||||
schema: CHANGER_DRIVE_ID_SCHEMA,
|
schema: CHANGER_DRIVENUM_SCHEMA,
|
||||||
optional: true,
|
optional: true,
|
||||||
},
|
},
|
||||||
delete: {
|
delete: {
|
||||||
@ -172,7 +172,7 @@ pub fn update_drive(
|
|||||||
name: String,
|
name: String,
|
||||||
path: Option<String>,
|
path: Option<String>,
|
||||||
changer: Option<String>,
|
changer: Option<String>,
|
||||||
changer_drive_id: Option<u64>,
|
changer_drivenum: Option<u64>,
|
||||||
delete: Option<Vec<DeletableProperty>>,
|
delete: Option<Vec<DeletableProperty>>,
|
||||||
digest: Option<String>,
|
digest: Option<String>,
|
||||||
_param: Value,
|
_param: Value,
|
||||||
@ -194,9 +194,9 @@ pub fn update_drive(
|
|||||||
match delete_prop {
|
match delete_prop {
|
||||||
DeletableProperty::changer => {
|
DeletableProperty::changer => {
|
||||||
data.changer = None;
|
data.changer = None;
|
||||||
data.changer_drive_id = None;
|
data.changer_drivenum = None;
|
||||||
},
|
},
|
||||||
DeletableProperty::changer_drive_id => { data.changer_drive_id = None; },
|
DeletableProperty::changer_drivenum => { data.changer_drivenum = None; },
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -212,14 +212,14 @@ pub fn update_drive(
|
|||||||
data.changer = Some(changer);
|
data.changer = Some(changer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(changer_drive_id) = changer_drive_id {
|
if let Some(changer_drivenum) = changer_drivenum {
|
||||||
if changer_drive_id == 0 {
|
if changer_drivenum == 0 {
|
||||||
data.changer_drive_id = None;
|
data.changer_drivenum = None;
|
||||||
} else {
|
} else {
|
||||||
if data.changer.is_none() {
|
if data.changer.is_none() {
|
||||||
bail!("Option 'changer-drive-id' requires option 'changer'.");
|
bail!("Option 'changer-drive-id' requires option 'changer'.");
|
||||||
}
|
}
|
||||||
data.changer_drive_id = Some(changer_drive_id);
|
data.changer_drivenum = Some(changer_drivenum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1128,7 +1128,7 @@ pub fn list_drives(
|
|||||||
name: drive.name,
|
name: drive.name,
|
||||||
path: drive.path.clone(),
|
path: drive.path.clone(),
|
||||||
changer: drive.changer,
|
changer: drive.changer,
|
||||||
changer_drivenum: drive.changer_drive_id,
|
changer_drivenum: drive.changer_drivenum,
|
||||||
vendor: None,
|
vendor: None,
|
||||||
model: None,
|
model: None,
|
||||||
serial: None,
|
serial: None,
|
||||||
|
@ -24,7 +24,7 @@ pub const LINUX_DRIVE_PATH_SCHEMA: Schema = StringSchema::new(
|
|||||||
"The path to a LINUX non-rewinding SCSI tape device (i.e. '/dev/nst0')")
|
"The path to a LINUX non-rewinding SCSI tape device (i.e. '/dev/nst0')")
|
||||||
.schema();
|
.schema();
|
||||||
|
|
||||||
pub const CHANGER_DRIVE_ID_SCHEMA: Schema = IntegerSchema::new(
|
pub const CHANGER_DRIVENUM_SCHEMA: Schema = IntegerSchema::new(
|
||||||
"Associated changer drive number (requires option changer)")
|
"Associated changer drive number (requires option changer)")
|
||||||
.minimum(0)
|
.minimum(0)
|
||||||
.maximum(8)
|
.maximum(8)
|
||||||
@ -62,8 +62,8 @@ pub struct VirtualTapeDrive {
|
|||||||
schema: CHANGER_NAME_SCHEMA,
|
schema: CHANGER_NAME_SCHEMA,
|
||||||
optional: true,
|
optional: true,
|
||||||
},
|
},
|
||||||
"changer-drive-id": {
|
"changer-drivenum": {
|
||||||
schema: CHANGER_DRIVE_ID_SCHEMA,
|
schema: CHANGER_DRIVENUM_SCHEMA,
|
||||||
optional: true,
|
optional: true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -77,7 +77,7 @@ pub struct LinuxTapeDrive {
|
|||||||
#[serde(skip_serializing_if="Option::is_none")]
|
#[serde(skip_serializing_if="Option::is_none")]
|
||||||
pub changer: Option<String>,
|
pub changer: Option<String>,
|
||||||
#[serde(skip_serializing_if="Option::is_none")]
|
#[serde(skip_serializing_if="Option::is_none")]
|
||||||
pub changer_drive_id: Option<u64>,
|
pub changer_drivenum: Option<u64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[api()]
|
#[api()]
|
||||||
|
@ -420,7 +420,7 @@ impl MtxMediaChanger {
|
|||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
drive_name: drive_config.name.clone(),
|
drive_name: drive_config.name.clone(),
|
||||||
drive_number: drive_config.changer_drive_id.unwrap_or(0),
|
drive_number: drive_config.changer_drivenum.unwrap_or(0),
|
||||||
config: changer_config,
|
config: changer_config,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user