tape/changer: add vendor/model to DriveStatus
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
8306b8b1a5
commit
2da7aca8e8
|
@ -38,6 +38,10 @@ pub struct DriveStatus {
|
|||
pub status: ElementStatus,
|
||||
/// Drive Identifier (Serial number)
|
||||
pub drive_serial_number: Option<String>,
|
||||
/// Drive Vendor
|
||||
pub vendor: Option<String>,
|
||||
/// Drive Model
|
||||
pub model: Option<String>,
|
||||
/// Element Address
|
||||
pub element_address: u16,
|
||||
}
|
||||
|
|
|
@ -46,6 +46,8 @@ fn parse_drive_status(i: &str, id: u64) -> IResult<&str, DriveStatus> {
|
|||
loaded_slot,
|
||||
status: ElementStatus::Empty,
|
||||
drive_serial_number: None,
|
||||
vendor: None,
|
||||
model: None,
|
||||
element_address: id as u16,
|
||||
};
|
||||
return Ok((empty, status));
|
||||
|
@ -71,6 +73,8 @@ fn parse_drive_status(i: &str, id: u64) -> IResult<&str, DriveStatus> {
|
|||
loaded_slot,
|
||||
status: ElementStatus::VolumeTag(tag.to_string()),
|
||||
drive_serial_number: None,
|
||||
vendor: None,
|
||||
model: None,
|
||||
element_address: id as u16,
|
||||
};
|
||||
return Ok((i, status));
|
||||
|
@ -82,6 +86,8 @@ fn parse_drive_status(i: &str, id: u64) -> IResult<&str, DriveStatus> {
|
|||
loaded_slot,
|
||||
status: ElementStatus::Full,
|
||||
drive_serial_number: None,
|
||||
vendor: None,
|
||||
model: None,
|
||||
element_address: id as u16,
|
||||
};
|
||||
Ok((i, status))
|
||||
|
|
|
@ -641,23 +641,25 @@ fn decode_element_status_page(
|
|||
|
||||
let dvcid: DvcidHead = unsafe { reader.read_be_value()? };
|
||||
|
||||
let drive_serial_number = match (dvcid.code_set, dvcid.identifier_type) {
|
||||
let (drive_serial_number, vendor, model) = match (dvcid.code_set, dvcid.identifier_type) {
|
||||
(2, 0) => { // Serial number only (Quantum Superloader3 uses this)
|
||||
let serial = reader.read_exact_allocated(dvcid.identifier_len as usize)?;
|
||||
let serial = scsi_ascii_to_string(&serial);
|
||||
Some(serial)
|
||||
(Some(serial), None, None)
|
||||
}
|
||||
(2, 1) => {
|
||||
if dvcid.identifier_len != 34 {
|
||||
bail!("got wrong DVCID length");
|
||||
}
|
||||
let _vendor = reader.read_exact_allocated(8)?;
|
||||
let _product = reader.read_exact_allocated(16)?;
|
||||
let vendor = reader.read_exact_allocated(8)?;
|
||||
let vendor = scsi_ascii_to_string(&vendor);
|
||||
let model = reader.read_exact_allocated(16)?;
|
||||
let model = scsi_ascii_to_string(&model);
|
||||
let serial = reader.read_exact_allocated(10)?;
|
||||
let serial = scsi_ascii_to_string(&serial);
|
||||
Some(serial)
|
||||
(Some(serial), Some(vendor), Some(model))
|
||||
}
|
||||
_ => None,
|
||||
_ => (None, None, None),
|
||||
};
|
||||
|
||||
result.last_element_address = Some(desc.element_address);
|
||||
|
@ -666,6 +668,8 @@ fn decode_element_status_page(
|
|||
loaded_slot,
|
||||
status: create_element_status(full, volume_tag),
|
||||
drive_serial_number,
|
||||
vendor,
|
||||
model,
|
||||
element_address: desc.element_address,
|
||||
};
|
||||
result.drives.push(drive);
|
||||
|
|
|
@ -399,6 +399,8 @@ impl MediaChange for VirtualTapeHandle {
|
|||
loaded_slot: None,
|
||||
status: ElementStatus::VolumeTag(current_tape.name.clone()),
|
||||
drive_serial_number: None,
|
||||
vendor: None,
|
||||
model: None,
|
||||
element_address: 0,
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue