tape: scan - print more debug info
This commit is contained in:
parent
ac461bd651
commit
3f803af00b
|
@ -9,10 +9,18 @@ use proxmox::{
|
||||||
RpcEnvironment,
|
RpcEnvironment,
|
||||||
section_config::SectionConfigData,
|
section_config::SectionConfigData,
|
||||||
},
|
},
|
||||||
|
tools::{
|
||||||
|
Uuid,
|
||||||
|
time::strftime_local,
|
||||||
|
io::ReadExt,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
use proxmox_backup::{
|
use proxmox_backup::{
|
||||||
tools::format::render_epoch,
|
tools::format::{
|
||||||
|
HumanByte,
|
||||||
|
render_epoch,
|
||||||
|
},
|
||||||
server::{
|
server::{
|
||||||
UPID,
|
UPID,
|
||||||
worker_is_active_local,
|
worker_is_active_local,
|
||||||
|
@ -451,10 +459,11 @@ fn move_to_eom(param: Value) -> Result<(), Error> {
|
||||||
},
|
},
|
||||||
)]
|
)]
|
||||||
/// Rewind, then read media contents and print debug info
|
/// Rewind, then read media contents and print debug info
|
||||||
|
///
|
||||||
|
/// Note: This reads unless the driver returns an IO Error, so this
|
||||||
|
/// method is expected to fails when we reach EOT.
|
||||||
fn debug_scan(param: Value) -> Result<(), Error> {
|
fn debug_scan(param: Value) -> Result<(), Error> {
|
||||||
|
|
||||||
use proxmox::tools::io::ReadExt;
|
|
||||||
|
|
||||||
let (config, _digest) = config::drive::config()?;
|
let (config, _digest) = config::drive::config()?;
|
||||||
|
|
||||||
let drive = lookup_drive_name(¶m, &config)?;
|
let drive = lookup_drive_name(¶m, &config)?;
|
||||||
|
@ -482,6 +491,10 @@ fn debug_scan(param: Value) -> Result<(), Error> {
|
||||||
} else {
|
} else {
|
||||||
if let Some(name) = PROXMOX_BACKUP_CONTENT_NAME.get(&header.content_magic) {
|
if let Some(name) = PROXMOX_BACKUP_CONTENT_NAME.get(&header.content_magic) {
|
||||||
println!("got content header: {}", name);
|
println!("got content header: {}", name);
|
||||||
|
println!(" uuid: {}", Uuid::from(header.uuid));
|
||||||
|
println!(" ctime: {}", strftime_local("%c", header.ctime)?);
|
||||||
|
println!(" hsize: {}", HumanByte::from(header.size as usize));
|
||||||
|
println!(" part: {}", header.part_number);
|
||||||
} else {
|
} else {
|
||||||
println!("got unknown content header: {:?}", header.content_magic);
|
println!("got unknown content header: {:?}", header.content_magic);
|
||||||
}
|
}
|
||||||
|
@ -492,7 +505,7 @@ fn debug_scan(param: Value) -> Result<(), Error> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let bytes = reader.skip_to_end()?;
|
let bytes = reader.skip_to_end()?;
|
||||||
println!("skipped {} bytes", bytes);
|
println!("skipped {}", HumanByte::from(bytes));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue