]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix bug #1389 MaxUseDuration uses job start instead of first write time
authorKern Sibbald <kern@sibbald.com>
Fri, 25 Feb 2011 18:14:25 +0000 (19:14 +0100)
committerKern Sibbald <kern@sibbald.com>
Sat, 20 Apr 2013 12:43:29 +0000 (14:43 +0200)
bacula/src/stored/label.c
regress/tests/maxuseduration-test [new file with mode: 0755]

index af386241a10f7f0827335d9c33ad0c13e7624ccd..9fd0c3df83a5b5e0e2eddb2e4f6825beed11782f 100644 (file)
@@ -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 (executable)
index 0000000..ab552a8
--- /dev/null
@@ -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 <<END_OF_DATA >${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