Skip to content

Commit

Permalink
Some fixes to the SD Job Status handling.
Browse files Browse the repository at this point in the history
- Make JS_FatalError a separate error string.
- JS_FatalError for a SD Job means in essence the controlling Job
  also should end in JS_FatalError.
  • Loading branch information
Marco van Wieringen committed Sep 11, 2015
1 parent a8d8270 commit e715be0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
26 changes: 21 additions & 5 deletions src/dird/getmsg.c
Expand Up @@ -66,9 +66,13 @@ static char OK_msg[] =

static void set_jcr_sd_job_status(JCR *jcr, int SDJobStatus)
{
bool set_waittime=false;
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 */

/*
* If wait state is new, we keep current time for watchdog MaxWaitTime
*/
switch (SDJobStatus) {
case JS_WaitMedia:
case JS_WaitMount:
Expand All @@ -83,15 +87,27 @@ static void set_jcr_sd_job_status(JCR *jcr, int SDJobStatus)
}

if (set_waittime) {
/* set it before JobStatus */
/*
* Set it before JobStatus
*/
Dmsg0(800, "Setting wait_time\n");
jcr->wait_time = time(NULL);
}
jcr->SDJobStatus = SDJobStatus;
if (jcr->SDJobStatus == JS_Incomplete) {

/*
* Some SD Job status setting are propagated to the controlling Job.
*/
switch (jcr->SDJobStatus) {
case JS_Incomplete:
jcr->setJobStatus(JS_Incomplete);
break;
case JS_FatalError:
jcr->setJobStatus(JS_FatalError);
break;
default:
break;
}

}

/*
Expand Down
3 changes: 2 additions & 1 deletion src/lib/util.c
Expand Up @@ -220,6 +220,8 @@ void jobstatus_to_ascii(int JobStatus, char *msg, int maxlen)
jobstat = _("Error: incomplete job");
break;
case JS_FatalError:
jobstat = _("Fatal Error");
break;
case JS_ErrorTerminated:
jobstat = _("Error");
break;
Expand Down Expand Up @@ -277,7 +279,6 @@ void jobstatus_to_ascii(int JobStatus, char *msg, int maxlen)
case JS_AttrInserting:
jobstat = _("Dir inserting Attributes");
break;

default:
if (JobStatus == 0) {
buf[0] = 0;
Expand Down

0 comments on commit e715be0

Please sign in to comment.