tape: fix wrong media set expire time

This commit is contained in:
Dietmar Maurer 2021-03-04 12:36:45 +01:00
parent ab77d660cc
commit 1bed3aedc8
3 changed files with 5 additions and 7 deletions

View File

@ -513,7 +513,7 @@ impl Inventory {
}
}
MediaSetPolicy::AlwaysCreate => {
set_start_time + 1
set_start_time
}
MediaSetPolicy::CreateAt(ref event) => {
match compute_next_event(event, set_start_time, false) {

View File

@ -289,7 +289,7 @@ impl MediaPool {
let expire_time = self.inventory.media_expire_time(
media.id(), &self.media_set_policy, &self.retention);
current_time > expire_time
current_time >= expire_time
}
// check if a location is considered on site

View File

@ -173,16 +173,14 @@ fn test_alloc_writable_media_4() -> Result<(), Error> {
// next call fail because there is no free media
assert!(pool.alloc_writable_media(start_time + 5).is_err());
// Create new nedia set, so that revious set can expire
// Create new nedia set, so that previous set can expire
pool.start_write_session(start_time + 10)?;
assert!(pool.alloc_writable_media(start_time + 10).is_err());
assert!(pool.alloc_writable_media(start_time + 11).is_err());
assert!(pool.alloc_writable_media(start_time + 12).is_err());
assert!(pool.alloc_writable_media(start_time + 13).is_err());
// tape1 is now expired
assert_eq!(pool.alloc_writable_media(start_time + 14)?, tape1_uuid);
assert_eq!(pool.alloc_writable_media(start_time + 12)?, tape1_uuid);
Ok(())
}