/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2009 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2010 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
*
* Kern Sibbald, MM
*
- * Version $Id$
- *
*/
#include "bacula.h"
extern bool do_mac(JCR *jcr);
/* Requests from the Director daemon */
+/* Added in 3.1.4 14Sep09 KES */
static char jobcmd[] = "JobId=%d job=%127s job_name=%127s client_name=%127s "
"type=%d level=%d FileSet=%127s NoAttr=%d SpoolAttr=%d FileSetMD5=%127s "
- "SpoolData=%d WritePartAfterJob=%d PreferMountedVols=%d SpoolSize=%s\n";
+ "SpoolData=%d WritePartAfterJob=%d PreferMountedVols=%d SpoolSize=%s "
+ "Resched=%d\n";
static char oldjobcmd[] = "JobId=%d job=%127s job_name=%127s client_name=%127s "
+ "type=%d level=%d FileSet=%127s NoAttr=%d SpoolAttr=%d FileSetMD5=%127s "
+ "SpoolData=%d WritePartAfterJob=%d PreferMountedVols=%d SpoolSize=%s\n";
+static char oldoldjobcmd[] = "JobId=%d job=%127s job_name=%127s client_name=%127s "
"type=%d level=%d FileSet=%127s NoAttr=%d SpoolAttr=%d FileSetMD5=%127s "
"SpoolData=%d WritePartAfterJob=%d PreferMountedVols=%d\n";
POOL_MEM job_name, client_name, job, fileset_name, fileset_md5;
int JobType, level, spool_attributes, no_attributes, spool_data;
int write_part_after_job, PreferMountedVols;
+ int Resched = 0;
int stat;
JCR *ojcr;
client_name.c_str(),
&JobType, &level, fileset_name.c_str(), &no_attributes,
&spool_attributes, fileset_md5.c_str(), &spool_data,
- &write_part_after_job, &PreferMountedVols, spool_size);
- if (stat != 14) {
+ &write_part_after_job, &PreferMountedVols, spool_size,
+ &Resched);
+ if (stat != 15) {
/* Try old version */
stat = sscanf(dir->msg, oldjobcmd, &JobId, job.c_str(), job_name.c_str(),
- client_name.c_str(),
- &JobType, &level, fileset_name.c_str(), &no_attributes,
- &spool_attributes, fileset_md5.c_str(), &spool_data,
- &write_part_after_job, &PreferMountedVols);
- if (stat != 13) {
- pm_strcpy(jcr->errmsg, dir->msg);
- dir->fsend(BAD_job, stat, jcr->errmsg);
- Dmsg1(100, ">dird: %s", dir->msg);
- set_jcr_job_status(jcr, JS_ErrorTerminated);
- return false;
+ client_name.c_str(),
+ &JobType, &level, fileset_name.c_str(), &no_attributes,
+ &spool_attributes, fileset_md5.c_str(), &spool_data,
+ &write_part_after_job, &PreferMountedVols, spool_size);
+ if (stat != 14) {
+ /* Try oldold version */
+ stat = sscanf(dir->msg, oldoldjobcmd, &JobId, job.c_str(), job_name.c_str(),
+ client_name.c_str(),
+ &JobType, &level, fileset_name.c_str(), &no_attributes,
+ &spool_attributes, fileset_md5.c_str(), &spool_data,
+ &write_part_after_job, &PreferMountedVols);
+ if (stat != 13) {
+ pm_strcpy(jcr->errmsg, dir->msg);
+ dir->fsend(BAD_job, stat, jcr->errmsg);
+ Dmsg1(100, ">dird: %s", dir->msg);
+ set_jcr_job_status(jcr, JS_ErrorTerminated);
+ return false;
+ }
}
}
/*
free_jcr(ojcr);
}
jcr->JobId = JobId;
+ Dmsg2(800, "Start JobId=%d %p\n", JobId, jcr);
jcr->VolSessionId = newVolSessionId();
jcr->VolSessionTime = VolSessionTime;
bstrncpy(jcr->Job, job, sizeof(jcr->Job));
pm_strcpy(jcr->fileset_md5, fileset_md5);
jcr->PreferMountedVols = PreferMountedVols;
+
jcr->authenticated = false;
/*
Dmsg3(50, "%s waiting %d sec for FD to contact SD key=%s\n",
jcr->Job, (int)(timeout.tv_sec-time(NULL)), jcr->sd_auth_key);
+ Dmsg2(800, "Wait FD for jid=%d %p\n", jcr->JobId, jcr);
/*
* Wait for the File daemon to contact us to start the Job,
if (errstat == ETIMEDOUT || errstat == EINVAL || errstat == EPERM) {
break;
}
+ Dmsg1(800, "=== Auth cond errstat=%d\n", errstat);
}
Dmsg3(50, "Auth=%d canceled=%d errstat=%d\n", jcr->authenticated,
job_canceled(jcr), errstat);
V(mutex);
+ Dmsg2(800, "Auth fail or cancel for jid=%d %p\n", jcr->JobId, jcr);
memset(jcr->sd_auth_key, 0, strlen(jcr->sd_auth_key));
if (jcr->authenticated && !job_canceled(jcr)) {
- Dmsg1(50, "Running job %s\n", jcr->Job);
+ Dmsg2(800, "Running jid=%d %p\n", jcr->JobId, jcr);
run_job(jcr); /* Run the job */
}
+ Dmsg2(800, "Done jid=%d %p\n", jcr->JobId, jcr);
return false;
}
*/
void stored_free_jcr(JCR *jcr)
{
- Dmsg1(900, "stored_free_jcr JobId=%u\n", jcr->JobId);
+ Dmsg2(800, "End Job JobId=%u %p\n", jcr->JobId, jcr);
+ if (jcr->dir_bsock) {
+ Dmsg2(800, "Send terminate jid=%d %p\n", jcr->JobId, jcr);
+ jcr->dir_bsock->signal(BNET_EOD);
+ jcr->dir_bsock->signal(BNET_TERMINATE);
+ }
if (jcr->file_bsock) {
jcr->file_bsock->close();
jcr->file_bsock = NULL;