From: Kern Sibbald Date: Wed, 22 Jul 2009 15:01:47 +0000 (+0000) Subject: Modify setJobStatus so cancel has same priority as fatal errors X-Git-Tag: Release-5.0.0~478 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=01dec5c160ba62d5cd241f5b9aa2092f8f15d092;p=bacula%2Fbacula Modify setJobStatus so cancel has same priority as fatal errors git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@9084 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/jcr.h b/bacula/src/jcr.h index 9ddbf8bc36..7a321672ff 100644 --- a/bacula/src/jcr.h +++ b/bacula/src/jcr.h @@ -182,16 +182,22 @@ public: void destroy_mutex(void) {pthread_mutex_destroy(&mutex); }; bool is_job_canceled() {return job_canceled(this); }; int32_t get_JobType() { return m_JobType; }; + int32_t getJobType() { return m_JobType; }; int32_t get_JobLevel() { return m_JobLevel; }; + int32_t getJobLevel() { return m_JobLevel; }; bool no_client_used() { return (m_JobType == JT_MIGRATE || m_JobType == JT_COPY || m_JobLevel == L_VIRTUAL_FULL); }; - const char *get_OperationName(); /* in lib/jcr.c */ + const char *get_OperationName(); /* in lib/jcr.c */ const char *get_ActionName(bool past); /* in lib/jcr.c */ - void set_JobLevel(int32_t JobLevel); /* in lib/jcr.c */ - void set_JobType(int32_t JobType); /* in lib/jcr.c */ - bool JobReads(); /* in lib/jcr.c */ + void set_JobLevel(int32_t JobLevel); /* in lib/jcr.c */ + void setJobLevel(int32_t JobLevel); /* in lib/jcr.c */ + void set_JobType(int32_t JobType); /* in lib/jcr.c */ + void setJobType(int32_t JobType); /* in lib/jcr.c */ + void setJobStatus(int JobStatus); /* in lib/jcr.c */ + bool JobReads(); /* in lib/jcr.c */ + /* Global part of JCR common to all daemons */ dlink link; /* JCR chain link */ diff --git a/bacula/src/lib/jcr.c b/bacula/src/lib/jcr.c index d599a94a14..ed245a413d 100644 --- a/bacula/src/lib/jcr.c +++ b/bacula/src/lib/jcr.c @@ -739,10 +739,8 @@ static int get_status_priority(int JobStatus) switch (JobStatus) { case JS_ErrorTerminated: case JS_FatalError: - priority = 10; - break; case JS_Canceled: - priority = 9; + priority = 10; break; case JS_Error: priority = 8; @@ -809,22 +807,28 @@ static void update_wait_time(JCR *jcr, int newJobStatus) void set_jcr_job_status(JCR *jcr, int JobStatus) { + jcr->setJobStatus(JobStatus); +} + +void JCR::setJobStatus(int JobStatus) +{ + JCR *jcr = this; int priority, old_priority; - int oldJobStatus = jcr->JobStatus; + int oldJobStatus = JobStatus; priority = get_status_priority(JobStatus); old_priority = get_status_priority(oldJobStatus); - Dmsg2(800, "set_jcr_job_status(%s, %c)\n", jcr->Job, JobStatus); + Dmsg2(800, "set_jcr_job_status(%s, %c)\n", Job, JobStatus); /* Update wait_time depending on newJobStatus and oldJobStatus */ - update_wait_time(jcr, JobStatus); + update_wait_time(this, JobStatus); /* * For a set of errors, ... keep the current status * so it isn't lost. For all others, set it. */ - Dmsg3(300, "jid=%u OnEntry JobStatus=%c set=%c\n", (uint32_t)jcr->JobId, - jcr->JobStatus, JobStatus); + Dmsg3(300, "jid=%u OnEntry JobStatus=%c set=%c\n", (uint32_t)JobId, + JobStatus, JobStatus); if (priority >= old_priority) { jcr->JobStatus = JobStatus; /* replace with new priority */ } diff --git a/bacula/technotes b/bacula/technotes index aef271e0bc..8a261b8bd5 100644 --- a/bacula/technotes +++ b/bacula/technotes @@ -2,6 +2,9 @@ General: +21Jul09 +kes Add setJobStatus method to JCR class. +kes Modify setJobStatus so cancel has same priority as fatal errors 20Jul09 kes Fix Solaris compiler warning in signal.c