From a81d65747936da45ad76e167051c7300ec926a44 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Sat, 5 May 2007 13:32:02 +0000 Subject: [PATCH] ebl Works with maxtime-test regression test git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4705 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/patches/testing/real_maxwaittime.patch | 95 +++++++++++++++++-- 1 file changed, 85 insertions(+), 10 deletions(-) diff --git a/bacula/patches/testing/real_maxwaittime.patch b/bacula/patches/testing/real_maxwaittime.patch index f757cf19b0..e25a45db72 100644 --- a/bacula/patches/testing/real_maxwaittime.patch +++ b/bacula/patches/testing/real_maxwaittime.patch @@ -1,18 +1,68 @@ +Index: src/dird/getmsg.c +=================================================================== +--- src/dird/getmsg.c (révision 4696) ++++ src/dird/getmsg.c (copie de travail) +@@ -70,6 +70,33 @@ + + static char OK_msg[] = "1000 OK\n"; + ++ ++void set_jcr_sd_job_status(JCR *jcr, int SDJobStatus) ++{ ++ bool set_waittime=false; ++ Dmsg2(800, "set_jcr_sd_job_status(%s, %c)\n", jcr->Job, SDJobStatus); ++ /* if wait state is new, we keep current time for watchdog MaxWaitTime */ ++ switch (SDJobStatus) { ++ case JS_WaitMedia: ++ case JS_WaitMount: ++ case JS_WaitMaxJobs: ++ set_waittime = true; ++ default: ++ break; ++ } ++ ++ if (job_waiting(jcr)) { ++ set_waittime = false; ++ } ++ ++ if (set_waittime) { ++ /* set it before JobStatus */ ++ Dmsg0(800, "Setting wait_time\n"); ++ jcr->wait_time = time(NULL); ++ } ++ jcr->SDJobStatus = SDJobStatus; ++} ++ + /* + * Get a message + * Call appropriate processing routine +@@ -230,7 +257,7 @@ + int JobStatus; + char Job[MAX_NAME_LENGTH]; + if (sscanf(bs->msg, Job_status, &Job, &JobStatus) == 2) { +- jcr->SDJobStatus = JobStatus; /* current status */ ++ set_jcr_sd_job_status(jcr,JobStatus); /* current status */ + } else { + Emsg1(M_ERROR, 0, _("Malformed message: %s\n"), bs->msg); + } Index: src/dird/job.c =================================================================== --- src/dird/job.c (révision 4696) +++ src/dird/job.c (copie de travail) -@@ -487,21 +487,24 @@ - if (job_canceled(jcr)) { - return false; /* already canceled */ - } +@@ -484,24 +484,25 @@ + bool cancel = false; + JOB *job = jcr->job; + +- if (job_canceled(jcr)) { +- return false; /* already canceled */ + if (!job_waiting(jcr)) { + return false; -+ } + } if (job->MaxWaitTime == 0 && job->FullMaxWaitTime == 0 && job->IncMaxWaitTime == 0 && job->DiffMaxWaitTime == 0) { return false; } ++ Dmsg3(20, "check maxwaittime %u - %u >= %u\n", watchdog_time, jcr->wait_time, job->MaxWaitTime); if (jcr->JobLevel == L_FULL && job->FullMaxWaitTime != 0 && - (watchdog_time - jcr->start_time) >= job->FullMaxWaitTime) { + (watchdog_time - jcr->wait_time) >= job->FullMaxWaitTime) { @@ -31,11 +81,31 @@ Index: src/dird/job.c cancel = true; } +Index: src/dird/dird_conf.c +=================================================================== +--- src/dird/dird_conf.c (révision 4696) ++++ src/dird/dird_conf.c (copie de travail) +@@ -627,6 +627,15 @@ + if (res->res_job.WriteBootstrap) { + sendit(sock, _(" --> WriteBootstrap=%s\n"), NPRT(res->res_job.WriteBootstrap)); + } ++ if (res->res_job.MaxRunTime) { ++ sendit(sock, _(" --> MaxRunTime=%u\n"), res->res_job.MaxRunTime); ++ } ++ if (res->res_job.MaxWaitTime) { ++ sendit(sock, _(" --> MaxWaitTime=%u\n"), res->res_job.MaxWaitTime); ++ } ++ if (res->res_job.MaxStartDelay) { ++ sendit(sock, _(" --> MaxStartDelay=%u\n"), res->res_job.MaxStartDelay); ++ } + if (res->res_job.storage) { + STORE *store; + foreach_alist(store, res->res_job.storage) { Index: src/jcr.h =================================================================== --- src/jcr.h (révision 4696) +++ src/jcr.h (copie de travail) -@@ -105,6 +105,18 @@ +@@ -105,6 +105,22 @@ jcr->JobStatus == JS_ErrorTerminated || \ jcr->JobStatus == JS_FatalError) @@ -48,13 +118,17 @@ Index: src/jcr.h + jcr->JobStatus == JS_WaitJobRes || \ + jcr->JobStatus == JS_WaitClientRes|| \ + jcr->JobStatus == JS_WaitMaxJobs || \ -+ jcr->JobStatus == JS_WaitPriority) ++ jcr->JobStatus == JS_WaitPriority || \ ++ jcr->SDJobStatus == JS_WaitMedia || \ ++ jcr->SDJobStatus == JS_WaitMount || \ ++ jcr->SDJobStatus == JS_WaitMaxJobs) ++ + + #define foreach_jcr(jcr) \ for (jcr=jcr_walk_start(); jcr; (jcr=jcr_walk_next(jcr)) ) -@@ -166,6 +178,7 @@ +@@ -166,6 +182,7 @@ time_t start_time; /* when job actually started */ time_t run_time; /* used for computing speed */ time_t end_time; /* job end time */ @@ -66,12 +140,12 @@ Index: src/lib/jcr.c =================================================================== --- src/lib/jcr.c (révision 4696) +++ src/lib/jcr.c (copie de travail) -@@ -546,18 +546,53 @@ +@@ -546,18 +546,54 @@ void set_jcr_job_status(JCR *jcr, int JobStatus) { + bool set_waittime=false; -+ ++ Dmsg2(800, "set_jcr_job_status(%s, %c)\n", jcr->Job, JobStatus); + /* if wait state is new, we keep current time for watchdog MaxWaitTime */ + switch (JobStatus) { + case JS_WaitFD: @@ -116,6 +190,7 @@ Index: src/lib/jcr.c default: + if (set_waittime) { + /* set it before JobStatus */ ++ Dmsg0(800, "Setting wait_time\n"); + jcr->wait_time = time(NULL); + } jcr->JobStatus = JobStatus; -- 2.39.5