tape: store media_uuid in PoolWriterState
This is mainly a cleanup, avoiding to access the catalog_set to get the uuid.
This commit is contained in:
parent
1037f2bc2d
commit
88bc9635aa
@ -219,6 +219,8 @@ impl Iterator for NewChunksIterator {
|
|||||||
|
|
||||||
struct PoolWriterState {
|
struct PoolWriterState {
|
||||||
drive: Box<dyn TapeDriver>,
|
drive: Box<dyn TapeDriver>,
|
||||||
|
// Media Uuid from loaded media
|
||||||
|
media_uuid: Uuid,
|
||||||
// tell if we already moved to EOM
|
// tell if we already moved to EOM
|
||||||
at_eom: bool,
|
at_eom: bool,
|
||||||
// bytes written after the last tape fush/sync
|
// bytes written after the last tape fush/sync
|
||||||
@ -368,8 +370,8 @@ impl PoolWriter {
|
|||||||
|
|
||||||
/// Load a writable media into the drive
|
/// Load a writable media into the drive
|
||||||
pub fn load_writable_media(&mut self, worker: &WorkerTask) -> Result<Uuid, Error> {
|
pub fn load_writable_media(&mut self, worker: &WorkerTask) -> Result<Uuid, Error> {
|
||||||
let last_media_uuid = match self.catalog_set.lock().unwrap().catalog {
|
let last_media_uuid = match self.status {
|
||||||
Some(ref catalog) => Some(catalog.uuid().clone()),
|
Some(PoolWriterState { ref media_uuid, ..}) => Some(media_uuid.clone()),
|
||||||
None => None,
|
None => None,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -412,7 +414,7 @@ impl PoolWriter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let (catalog, new_media) = update_media_set_label(
|
let (catalog, is_new_media) = update_media_set_label(
|
||||||
worker,
|
worker,
|
||||||
drive.as_mut(),
|
drive.as_mut(),
|
||||||
old_media_id.media_set_label,
|
old_media_id.media_set_label,
|
||||||
@ -430,9 +432,14 @@ impl PoolWriter {
|
|||||||
|
|
||||||
drive.set_encryption(encrypt_fingerprint)?;
|
drive.set_encryption(encrypt_fingerprint)?;
|
||||||
|
|
||||||
self.status = Some(PoolWriterState { drive, at_eom: false, bytes_written: 0 });
|
self.status = Some(PoolWriterState {
|
||||||
|
drive,
|
||||||
|
media_uuid: media_uuid.clone(),
|
||||||
|
at_eom: false,
|
||||||
|
bytes_written: 0,
|
||||||
|
});
|
||||||
|
|
||||||
if new_media {
|
if is_new_media {
|
||||||
// add catalogs from previous media
|
// add catalogs from previous media
|
||||||
self.append_media_set_catalogs(worker)?;
|
self.append_media_set_catalogs(worker)?;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user