From db0fa2426ffeea8ab0833cb491cc028809956b71 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Fri, 25 Feb 2011 19:14:25 +0100 Subject: [PATCH] Fix bug #1389 MaxUseDuration uses job start instead of first write time --- bacula/src/stored/label.c | 1 + regress/tests/maxuseduration-test | 54 +++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100755 regress/tests/maxuseduration-test diff --git a/bacula/src/stored/label.c b/bacula/src/stored/label.c index af386241a1..9fd0c3df83 100644 --- a/bacula/src/stored/label.c +++ b/bacula/src/stored/label.c @@ -512,6 +512,7 @@ bool rewrite_volume_label(DCR *dcr, bool recycle) dev->VolCatInfo.VolCatReads = 1; } Dmsg1(150, "dir_update_vol_info. Set Append vol=%s\n", dcr->VolumeName); + dev->VolCatInfo.VolFirstWritten = time(NULL); bstrncpy(dev->VolCatInfo.VolCatStatus, "Append", sizeof(dev->VolCatInfo.VolCatStatus)); dev->setVolCatName(dcr->VolumeName); if (!dir_update_volume_info(dcr, true, true)) { /* indicate doing relabel */ diff --git a/regress/tests/maxuseduration-test b/regress/tests/maxuseduration-test new file mode 100755 index 0000000000..ab552a8f57 --- /dev/null +++ b/regress/tests/maxuseduration-test @@ -0,0 +1,54 @@ +#!/bin/sh +# +# Run four jobs at the same time, with four Volumes, but set +# Maximum Job Volumes = 1 on each of the Volumes. Note, +# Volume 2 will probably have two jobs on it. Something to +# be fixed in a later version. +# +TestName="maxuseduration-test" +JobName=maxuseduration +. scripts/functions + +scripts/cleanup +scripts/copy-test-confs +echo "${cwd}/build" >${cwd}/tmp/file-list + +change_jobname NightlySave $JobName +start_test + +cat <${cwd}/tmp/bconcmds +@$out /dev/null +messages +@$out ${cwd}/tmp/log1.out +label storage=File1 volume=TestVolume001 +update Volume=TestVolume001 +3 +20 +1 +3 +18 +llist volume=TestVolume001 +@#setdebug level=100 Storage=File1 +run job=$JobName level=Full Storage=File1 yes +@sleep 30 +update Volume=TestVolume001 +1 +1 +18 +mount storage=File1 +wait +llist volume=TestVolume001 +messages +quit +END_OF_DATA + +run_bacula +check_for_zombie_jobs storage=File1 +stop_bacula + +grep "Max configured use duration" ${cwd}/tmp/log1.out +if [ $? -eq 0 ] ; then + echo "Error: max configured use duration exceeded" + estat=1 +fi +end_test -- 2.39.5