tape: correctly parse mtx import/export slots

This commit is contained in:
Dietmar Maurer
2020-12-28 13:32:56 +01:00
parent df3a74d7e0
commit e0362b0d0f
6 changed files with 29 additions and 13 deletions

View File

@ -82,9 +82,13 @@ pub async fn get_status(name: String) -> Result<Vec<MtxStatusEntry>, Error> {
list.push(entry);
}
for (id, slot_status) in status.slots.iter().enumerate() {
for (id, (import_export, slot_status)) in status.slots.iter().enumerate() {
let entry = MtxStatusEntry {
entry_kind: MtxEntryKind::Slot,
entry_kind: if *import_export {
MtxEntryKind::ImportExport
} else {
MtxEntryKind::Slot
},
entry_id: id as u64 + 1,
changer_id: match &slot_status {
ElementStatus::Empty => None,

View File

@ -44,13 +44,15 @@ pub struct ScsiTapeChanger {
#[api()]
#[derive(Serialize,Deserialize)]
#[serde(rename_all = "lowercase")]
#[serde(rename_all = "kebab-case")]
/// Mtx Entry Kind
pub enum MtxEntryKind {
/// Drive
Drive,
/// Slot
Slot,
/// Import/Export Slot
ImportExport,
}
#[api(