Jmsg(jcr, M_INFO, 0, _("Start Admin JobId %d, Job=%s\n"),
jcr->JobId, jcr->Job);
- set_jcr_job_status(jcr, JS_Running);
+ jcr->setJobStatus(JS_Running);
admin_cleanup(jcr, JS_Terminated);
return true;
}
if (!db_get_job_record(jcr, jcr->db, &jcr->jr)) {
Jmsg(jcr, M_WARNING, 0, _("Error getting Job record for Job report: ERR=%s"),
db_strerror(jcr->db));
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
}
msg_type = M_INFO; /* by default INFO message */
}
if (fd == NULL) {
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
return 0;
}
Dmsg0(10, "Opened connection with File daemon\n");
}
fd->res = (RES *)jcr->client; /* save resource in BSOCK */
jcr->file_bsock = fd;
- set_jcr_job_status(jcr, JS_Running);
+ jcr->setJobStatus(JS_Running);
if (!authenticate_file_daemon(jcr)) {
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
return 0;
}
if (strncmp(fd->msg, OKjob, strlen(OKjob)) != 0) {
Jmsg(jcr, M_FATAL, 0, _("File daemon \"%s\" rejected Job command: %s\n"),
jcr->client->hdr.name, fd->msg);
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
return 0;
} else if (jcr->db) {
CLIENT_DBR cr;
} else {
Jmsg(jcr, M_FATAL, 0, _("FD gave bad response to JobId command: %s\n"),
bnet_strerror(fd));
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
return 0;
}
return 1;
return true;
bail_out:
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
return false;
}
if ((len = sscanf(fd->msg, "%ld %d %s", &file_index, &stream, Digest)) != 3) {
Jmsg(jcr, M_FATAL, 0, _("<filed: bad attributes, expected 3 fields got %d\n"
"msglen=%d msg=%s\n"), len, fd->msglen, fd->msg);
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
return 0;
}
p = fd->msg;
}
jcr->cached_attribute = false;
}
- set_jcr_job_status(jcr, JS_Terminated);
+ jcr->setJobStatus(JS_Terminated);
return 1;
}
Dmsg0(2300, "Enter sched_wait.\n");
free(arg);
time_t wtime = jcr->sched_time - time(NULL);
- set_jcr_job_status(jcr, JS_WaitStartTime);
+ jcr->setJobStatus(JS_WaitStartTime);
/* Wait until scheduled time arrives */
if (wtime > 0) {
Jmsg(jcr, M_INFO, 0, _("Job %s waiting %d seconds for scheduled start time.\n"),
if (!(jcr->JobPriority == Priority
|| (jcr->JobPriority < Priority &&
jcr->job->allow_mixed_priority && running_allow_mix))) {
- set_jcr_job_status(jcr, JS_WaitPriority);
+ jcr->setJobStatus(JS_WaitPriority);
break;
}
jcr->Job, dt, (int)jcr->job->RescheduleInterval, dt2);
dird_free_jcr_pointers(jcr); /* partial cleanup old stuff */
jcr->JobStatus = -1;
- set_jcr_job_status(jcr, JS_WaitStartTime);
+ jcr->setJobStatus(JS_WaitStartTime);
jcr->SDJobStatus = 0;
jcr->JobErrors = 0;
if (!allow_duplicate_job(jcr)) {
njcr->run_inc_pool_override = jcr->run_inc_pool_override;
njcr->diff_pool = jcr->diff_pool;
njcr->JobStatus = -1;
- set_jcr_job_status(njcr, jcr->JobStatus);
+ njcr->setJobStatus(jcr->JobStatus);
if (jcr->rstore) {
copy_rstorage(njcr, jcr->rstorage, _("previous Job"));
} else {
Jmsg(jcr, M_FATAL, 0, _("Job canceled. Attempt to read and write same device.\n"
" Read storage \"%s\" (From %s) -- Write storage \"%s\" (From %s)\n"),
jcr->rstore->name(), jcr->rstore_source, jcr->wstore->name(), jcr->wstore_source);
- set_jcr_job_status(jcr, JS_Canceled);
+ jcr->setJobStatus(JS_Canceled);
return false;
}
#endif
Dmsg1(200, "Rstore=%s\n", jcr->rstore->name());
if (!inc_read_store(jcr)) {
Dmsg1(200, "Fail rncj=%d\n", jcr->rstore->NumConcurrentJobs);
- set_jcr_job_status(jcr, JS_WaitStoreRes);
+ jcr->setJobStatus(JS_WaitStoreRes);
return false;
}
}
}
}
if (skip_this_jcr) {
- set_jcr_job_status(jcr, JS_WaitStoreRes);
+ jcr->setJobStatus(JS_WaitStoreRes);
return false;
}
/* Back out previous locks */
dec_write_store(jcr);
dec_read_store(jcr);
- set_jcr_job_status(jcr, JS_WaitClientRes);
+ jcr->setJobStatus(JS_WaitClientRes);
return false;
}
if (jcr->job->NumConcurrentJobs < jcr->job->MaxConcurrentJobs) {
dec_write_store(jcr);
dec_read_store(jcr);
jcr->client->NumConcurrentJobs--;
- set_jcr_job_status(jcr, JS_WaitJobRes);
+ jcr->setJobStatus(JS_WaitJobRes);
return false;
}
}
if (jcr->previous_jr.JobId == 0 || jcr->ExpectedFiles == 0) {
- set_jcr_job_status(jcr, JS_Terminated);
+ jcr->setJobStatus(JS_Terminated);
Dmsg1(dbglevel, "JobId=%d expected files == 0\n", (int)jcr->JobId);
if (jcr->previous_jr.JobId == 0) {
Jmsg(jcr, M_INFO, 0, _("No previous Job found to %s.\n"), jcr->get_ActionName(0));
* so set a normal status, cleanup and return OK.
*/
if (!mig_jcr) {
- set_jcr_job_status(jcr, JS_Terminated);
+ jcr->setJobStatus(JS_Terminated);
migration_cleanup(jcr, jcr->JobStatus);
return true;
}
edit_int64(jcr->previous_jr.JobId, ed1),
jcr->get_ActionName(0),
db_strerror(jcr->db));
- set_jcr_job_status(jcr, JS_Terminated);
+ jcr->setJobStatus(JS_Terminated);
migration_cleanup(jcr, jcr->JobStatus);
return true;
}
edit_int64(jcr->previous_jr.JobId, ed1),
jcr->get_ActionName(1),
jcr->get_OperationName());
- set_jcr_job_status(jcr, JS_Terminated);
+ jcr->setJobStatus(JS_Terminated);
migration_cleanup(jcr, jcr->JobStatus);
return true;
}
*
*/
Dmsg0(110, "Open connection with storage daemon\n");
- set_jcr_job_status(jcr, JS_WaitSD);
- set_jcr_job_status(mig_jcr, JS_WaitSD);
+ jcr->setJobStatus(JS_WaitSD);
+ mig_jcr->setJobStatus(JS_WaitSD);
/*
* Start conversation with Storage daemon
*/
jcr->start_time = time(NULL);
jcr->jr.StartTime = jcr->start_time;
jcr->jr.JobTDate = jcr->start_time;
- set_jcr_job_status(jcr, JS_Running);
+ jcr->setJobStatus(JS_Running);
/* Update job start record for this migration control job */
if (!db_update_job_start_record(jcr, jcr->db, &jcr->jr)) {
mig_jcr->start_time = time(NULL);
mig_jcr->jr.StartTime = mig_jcr->start_time;
mig_jcr->jr.JobTDate = mig_jcr->start_time;
- set_jcr_job_status(mig_jcr, JS_Running);
+ mig_jcr->setJobStatus(JS_Running);
/* Update job start record for the real migration backup job */
if (!db_update_job_start_record(mig_jcr, mig_jcr->db, &mig_jcr->jr)) {
}
- set_jcr_job_status(jcr, JS_Running);
- set_jcr_job_status(mig_jcr, JS_Running);
+ jcr->setJobStatus(JS_Running);
+ mig_jcr->setJobStatus(JS_Running);
/* Pickup Job termination data */
/* Note, the SD stores in jcr->JobFiles/ReadBytes/JobBytes/JobErrors */
wait_for_storage_daemon_termination(jcr);
- set_jcr_job_status(jcr, jcr->SDJobStatus);
+ jcr->setJobStatus(jcr->SDJobStatus);
db_write_batch_file_records(jcr); /* used by bulk batch file insert */
if (jcr->JobStatus != JS_Terminated) {
return false;
if (!db_get_job_record(jcr, jcr->db, &jcr->jr)) {
Jmsg(jcr, M_WARNING, 0, _("Error getting Job record for Job report: ERR=%s"),
db_strerror(jcr->db));
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
}
update_bootstrap_file(mig_jcr);
break;
}
}
- set_jcr_job_status(jcr, JS_Terminated);
+ jcr->setJobStatus(JS_Terminated);
}
/*
berrno be;
Jmsg(jcr, M_FATAL, 0, _("Could not open bootstrap file %s: ERR=%s\n"),
jcr->RestoreBootstrap, be.bstrerror());
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
return false;
}
sd->fsend(bootstrap);
berrno be;
Jmsg(jcr, M_FATAL, 0, _("Could not open bootstrap file %s: ERR=%s\n"),
jcr->RestoreBootstrap, be.bstrerror());
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
return false;
}
if (!new_store) {
Jmsg(jcr, M_FATAL, 0,
_("Could not get storage resource '%s'.\n"), new_one);
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
return false;
}
/* if Port and Hostname/IP are same, we are talking to the same
if (!(ustore.store = (STORE *)GetResWithName(R_STORAGE,info.storage))) {
Jmsg(jcr, M_FATAL, 0,
_("Could not get storage resource '%s'.\n"), info.storage);
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
return false;
}
dec_read_store(jcr);
free_rstorage(jcr);
set_rstorage(jcr, &ustore);
- set_jcr_job_status(jcr, JS_WaitSD);
+ jcr->setJobStatus(JS_WaitSD);
/*
* Wait for up to 6 hours to increment read stoage counter
*/
for (i=0; i < MAX_TRIES; i++) {
/* try to get read storage counter incremented */
if (inc_read_store(jcr)) {
- set_jcr_job_status(jcr, JS_Running);
+ jcr->setJobStatus(JS_Running);
return true;
}
bmicrosleep(10, 0); /* sleep 10 secs */
*
*/
Dmsg0(10, "Open connection with storage daemon\n");
- set_jcr_job_status(jcr, JS_WaitSD);
+ jcr->setJobStatus(JS_WaitSD);
/*
* Start conversation with Storage daemon
*/
/*
* Start conversation with File daemon
*/
- set_jcr_job_status(jcr, JS_WaitFD);
+ jcr->setJobStatus(JS_WaitFD);
jcr->keep_sd_auth_key = true; /* don't clear the sd_auth_key now */
if (!connect_to_file_daemon(jcr, 10, FDConnectTimeout, 1)) {
goto bail_out;
fd = jcr->file_bsock;
}
- set_jcr_job_status(jcr, JS_WaitSD);
+ jcr->setJobStatus(JS_WaitSD);
/*
* Send the bootstrap file -- what Volumes/files to restore
jcr->sched_time = jcr->start_time;
jcr->setJobType(job_type);
jcr->setJobLevel(L_NONE);
- set_jcr_job_status(jcr, JS_Running);
+ jcr->setJobStatus(JS_Running);
jcr->JobId = 0;
return jcr;
}
*
*/
Dmsg0(110, "Open connection with storage daemon\n");
- set_jcr_job_status(jcr, JS_WaitSD);
+ jcr->setJobStatus(JS_WaitSD);
/*
* Start conversation with Storage daemon
*/
jcr->start_time = time(NULL);
jcr->jr.StartTime = jcr->start_time;
jcr->jr.JobTDate = jcr->start_time;
- set_jcr_job_status(jcr, JS_Running);
+ jcr->setJobStatus(JS_Running);
/* Update job start record */
if (!db_update_job_start_record(jcr, jcr->db, &jcr->jr)) {
return false;
}
- set_jcr_job_status(jcr, JS_Running);
+ jcr->setJobStatus(JS_Running);
/* Pickup Job termination data */
/* Note, the SD stores in jcr->JobFiles/ReadBytes/JobBytes/JobErrors */
wait_for_storage_daemon_termination(jcr);
- set_jcr_job_status(jcr, jcr->SDJobStatus);
+ jcr->setJobStatus(jcr->SDJobStatus);
db_write_batch_file_records(jcr); /* used by bulk batch file insert */
if (jcr->JobStatus != JS_Terminated) {
return false;
if (!db_get_job_record(jcr, jcr->db, &jcr->jr)) {
Jmsg(jcr, M_WARNING, 0, _("Error getting Job record for Job report: ERR=%s"),
db_strerror(jcr->db));
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
}
bstrncpy(cr.Name, jcr->client->name(), sizeof(cr.Name));
if (!db_get_media_record(jcr, jcr->db, &mr)) {
Jmsg(jcr, M_WARNING, 0, _("Error getting Media record for Volume \"%s\": ERR=%s"),
mr.VolumeName, db_strerror(jcr->db));
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
}
update_bootstrap_file(jcr);
/*
* Start conversation with Storage daemon
*/
- set_jcr_job_status(jcr, JS_Blocked);
+ jcr->setJobStatus(JS_Blocked);
if (!connect_to_storage_daemon(jcr, 10, SDConnectTimeout, 1)) {
return false;
}
* OK, now connect to the File daemon
* and ask him for the files.
*/
- set_jcr_job_status(jcr, JS_Blocked);
+ jcr->setJobStatus(JS_Blocked);
if (!connect_to_file_daemon(jcr, 10, FDConnectTimeout, 1)) {
goto bail_out;
}
- set_jcr_job_status(jcr, JS_Running);
+ jcr->setJobStatus(JS_Running);
fd = jcr->file_bsock;
&jcr->previous_jr, &fdbr)) {
Jmsg(jcr, M_INFO, 0, _("New file: %s\n"), jcr->fname);
Dmsg1(020, _("File not in catalog: %s\n"), jcr->fname);
- set_jcr_job_status(jcr, JS_Differences);
+ jcr->setJobStatus(JS_Differences);
continue;
} else {
/*
Jmsg(jcr, M_INFO, 0, _(" st_ino differ. Cat: %s File: %s\n"),
edit_uint64((uint64_t)statc.st_ino, ed1),
edit_uint64((uint64_t)statf.st_ino, ed2));
- set_jcr_job_status(jcr, JS_Differences);
+ jcr->setJobStatus(JS_Differences);
}
break;
case 'p': /* permissions bits */
prt_fname(jcr);
Jmsg(jcr, M_INFO, 0, _(" st_mode differ. Cat: %x File: %x\n"),
(uint32_t)statc.st_mode, (uint32_t)statf.st_mode);
- set_jcr_job_status(jcr, JS_Differences);
+ jcr->setJobStatus(JS_Differences);
}
break;
case 'n': /* number of links */
prt_fname(jcr);
Jmsg(jcr, M_INFO, 0, _(" st_nlink differ. Cat: %d File: %d\n"),
(uint32_t)statc.st_nlink, (uint32_t)statf.st_nlink);
- set_jcr_job_status(jcr, JS_Differences);
+ jcr->setJobStatus(JS_Differences);
}
break;
case 'u': /* user id */
prt_fname(jcr);
Jmsg(jcr, M_INFO, 0, _(" st_uid differ. Cat: %u File: %u\n"),
(uint32_t)statc.st_uid, (uint32_t)statf.st_uid);
- set_jcr_job_status(jcr, JS_Differences);
+ jcr->setJobStatus(JS_Differences);
}
break;
case 'g': /* group id */
prt_fname(jcr);
Jmsg(jcr, M_INFO, 0, _(" st_gid differ. Cat: %u File: %u\n"),
(uint32_t)statc.st_gid, (uint32_t)statf.st_gid);
- set_jcr_job_status(jcr, JS_Differences);
+ jcr->setJobStatus(JS_Differences);
}
break;
case 's': /* size */
Jmsg(jcr, M_INFO, 0, _(" st_size differ. Cat: %s File: %s\n"),
edit_uint64((uint64_t)statc.st_size, ed1),
edit_uint64((uint64_t)statf.st_size, ed2));
- set_jcr_job_status(jcr, JS_Differences);
+ jcr->setJobStatus(JS_Differences);
}
break;
case 'a': /* access time */
if (statc.st_atime != statf.st_atime) {
prt_fname(jcr);
Jmsg(jcr, M_INFO, 0, _(" st_atime differs\n"));
- set_jcr_job_status(jcr, JS_Differences);
+ jcr->setJobStatus(JS_Differences);
}
break;
case 'm':
if (statc.st_mtime != statf.st_mtime) {
prt_fname(jcr);
Jmsg(jcr, M_INFO, 0, _(" st_mtime differs\n"));
- set_jcr_job_status(jcr, JS_Differences);
+ jcr->setJobStatus(JS_Differences);
}
break;
case 'c': /* ctime */
if (statc.st_ctime != statf.st_ctime) {
prt_fname(jcr);
Jmsg(jcr, M_INFO, 0, _(" st_ctime differs\n"));
- set_jcr_job_status(jcr, JS_Differences);
+ jcr->setJobStatus(JS_Differences);
}
break;
case 'd': /* file size decrease */
Jmsg(jcr, M_INFO, 0, _(" st_size decrease. Cat: %s File: %s\n"),
edit_uint64((uint64_t)statc.st_size, ed1),
edit_uint64((uint64_t)statf.st_size, ed2));
- set_jcr_job_status(jcr, JS_Differences);
+ jcr->setJobStatus(JS_Differences);
}
break;
case '5': /* compare MD5 */
prt_fname(jcr);
Jmsg(jcr, M_INFO, 0, _(" %s differs. File=%s Cat=%s\n"),
stream_to_ascii(stream), buf, fdbr.Digest);
- set_jcr_job_status(jcr, JS_Differences);
+ jcr->setJobStatus(JS_Differences);
}
do_Digest = CRYPTO_DIGEST_NONE;
}
/* missing_handler is called for each file found */
db_sql_query(jcr->db, buf, missing_handler, (void *)jcr);
if (jcr->fn_printed) {
- set_jcr_job_status(jcr, JS_Differences);
+ jcr->setJobStatus(JS_Differences);
}
free_pool_memory(fname);
}
sd = jcr->store_bsock;
- set_jcr_job_status(jcr, JS_Running);
+ jcr->setJobStatus(JS_Running);
Dmsg1(300, "bfiled: opened data connection %d to stored\n", sd->m_fd);
buf_size = 0; /* use default */
}
if (!sd->set_buffer_size(buf_size, BNET_SETBUF_WRITE)) {
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
Jmsg(jcr, M_FATAL, 0, _("Cannot set buffer size FD->SD.\n"));
return false;
}
/** Subroutine save_file() is called for each file */
if (!find_files(jcr, (FF_PKT *)jcr->ff, save_file, plugin_save)) {
ok = false; /* error */
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
}
if (have_acl && jcr->acl_data->nr_errors > 0) {
if ((zstat=deflateParams((z_stream*)jcr->pZLIB_compress_workset,
ff_pkt->GZIP_level, Z_DEFAULT_STRATEGY)) != Z_OK) {
Jmsg(jcr, M_FATAL, 0, _("Compression deflateParams error: %d\n"), zstat);
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
goto err;
}
}
if ((zstat=deflate((z_stream*)jcr->pZLIB_compress_workset, Z_FINISH)) != Z_STREAM_END) {
Jmsg(jcr, M_FATAL, 0, _("Compression deflate error: %d\n"), zstat);
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
goto err;
}
compress_len = ((z_stream*)jcr->pZLIB_compress_workset)->total_out;
/** reset zlib stream to be able to begin from scratch again */
if ((zstat=deflateReset((z_stream*)jcr->pZLIB_compress_workset)) != Z_OK) {
Jmsg(jcr, M_FATAL, 0, _("Compression deflateReset error: %d\n"), zstat);
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
goto err;
}
{
int stat;
- set_jcr_job_status(jcr, JS_Running);
+ jcr->setJobStatus(JS_Running);
set_find_options((FF_PKT *)jcr->ff, jcr->incremental, jcr->mtime);
/* in accurate mode, we overwrite the find_one check function */
dir->fsend(_("2901 Job %s not found.\n"), Job);
} else {
generate_plugin_event(cjcr, bEventCancelCommand, NULL);
- set_jcr_job_status(cjcr, JS_Canceled);
+ cjcr->setJobStatus(JS_Canceled);
if (cjcr->store_bsock) {
cjcr->store_bsock->set_timed_out();
cjcr->store_bsock->set_terminated();
while (dir->recv() >= 0)
{ }
free_bootstrap(jcr);
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
return 0;
}
goto cleanup;
}
- set_jcr_job_status(jcr, JS_Blocked);
+ jcr->setJobStatus(JS_Blocked);
jcr->setJobType(JT_BACKUP);
Dmsg1(100, "begin backup ff=%p\n", jcr->ff);
*/
Dmsg1(110, "begin blast ff=%p\n", (FF_PKT *)jcr->ff);
if (!blast_data_to_storage_daemon(jcr, NULL)) {
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
bnet_suppress_error_messages(sd, 1);
Dmsg0(110, "Error in blast_data.\n");
} else {
- set_jcr_job_status(jcr, JS_Terminated);
+ jcr->setJobStatus(JS_Terminated);
/* Note, the above set status will not override an error */
if (!(jcr->JobStatus == JS_Terminated || jcr->JobStatus == JS_Warnings)) {
bnet_suppress_error_messages(sd, 1);
* Expect to get response to append_data from Storage daemon
*/
if (!response(jcr, sd, OK_append, "Append Data")) {
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
goto cleanup;
}
sd->fsend(append_end, jcr->Ticket);
/* Get end OK */
if (!response(jcr, sd, OK_end, "Append End")) {
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
goto cleanup;
}
jcr->setJobType(JT_RESTORE);
- set_jcr_job_status(jcr, JS_Blocked);
+ jcr->setJobStatus(JS_Blocked);
if (!open_sd_read_session(jcr)) {
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
goto bail_out;
}
- set_jcr_job_status(jcr, JS_Running);
+ jcr->setJobStatus(JS_Running);
/**
* Do restore of files and data
do_restore(jcr);
stop_dir_heartbeat(jcr);
- set_jcr_job_status(jcr, JS_Terminated);
+ jcr->setJobStatus(JS_Terminated);
if (jcr->JobStatus != JS_Terminated) {
bnet_suppress_error_messages(sd, 1);
}
bfree_and_null(jcr->where);
if (jcr->JobErrors) {
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
}
Dmsg0(100, "Done in job.c\n");
berrno be;
Jmsg(jcr, M_FATAL, 0, _("Could not open bootstrap file %s: ERR=%s\n"),
jcr->RestoreBootstrap, be.bstrerror());
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
goto bail_out;
}
sd->msglen = pm_strcpy(sd->msg, bootstrap);
sd->signal(BNET_EOD);
fclose(bs);
if (!response(jcr, sd, OKSDbootstrap, "Bootstrap")) {
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
goto bail_out;
}
stat = 1;
int non_support_xattr = 0;
sd = jcr->store_bsock;
- set_jcr_job_status(jcr, JS_Running);
+ jcr->setJobStatus(JS_Running);
LockRes();
CLIENT *client = (CLIENT *)GetNextRes(R_CLIENT, NULL);
buf_size = 0; /* use default */
}
if (!bnet_set_buffer_size(sd, buf_size, BNET_SETBUF_WRITE)) {
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
return;
}
jcr->buf_size = sd->msglen;
}
close_previous_stream(rctx);
- set_jcr_job_status(jcr, JS_Terminated);
+ jcr->setJobStatus(JS_Terminated);
goto ok_out;
bail_out:
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
ok_out:
/*
*/
void do_verify(JCR *jcr)
{
- set_jcr_job_status(jcr, JS_Running);
+ jcr->setJobStatus(JS_Running);
jcr->buf_size = DEFAULT_NETWORK_BUFFER_SIZE;
if ((jcr->big_buf = (char *) malloc(jcr->buf_size)) == NULL) {
Jmsg1(jcr, M_ABORT, 0, _("Cannot malloc %d network read buffer\n"),
free(jcr->big_buf);
jcr->big_buf = NULL;
}
- set_jcr_job_status(jcr, JS_Terminated);
+ jcr->setJobStatus(JS_Terminated);
}
/*
sd = jcr->store_bsock;
if (!sd) {
Jmsg(jcr, M_FATAL, 0, _("Storage command not issued before Verify.\n"));
- set_jcr_job_status(jcr, JS_FatalError);
+ jcr->setJobStatus(JS_FatalError);
return;
}
dir = jcr->dir_bsock;
- set_jcr_job_status(jcr, JS_Running);
+ jcr->setJobStatus(JS_Running);
LockRes();
CLIENT *client = (CLIENT *)GetNextRes(R_CLIENT, NULL);
buf_size = 0; /* use default */
}
if (!bnet_set_buffer_size(sd, buf_size, BNET_SETBUF_WRITE)) {
- set_jcr_job_status(jcr, JS_FatalError);
+ jcr->setJobStatus(JS_FatalError);
return;
}
jcr->buf_size = sd->msglen;
} /* end switch */
} /* end while bnet_get */
- set_jcr_job_status(jcr, JS_Terminated);
+ jcr->setJobStatus(JS_Terminated);
goto ok_out;
bail_out:
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
ok_out:
if (jcr->compress_buf) {
bool is_JobStatus(int32_t aJobStatus) { return aJobStatus == JobStatus; };
void setJobLevel(int32_t JobLevel) { m_JobLevel = JobLevel; };
void setJobType(int32_t JobType) { m_JobType = JobType; };
+ void forceJobStatus(int32_t aJobStatus) { JobStatus = aJobStatus; };
int32_t getJobType() const { return m_JobType; };
int32_t getJobLevel() const { return m_JobLevel; };
int32_t getJobStatus() const { return JobStatus; };
return priority;
}
-
-void set_jcr_job_status(JCR *jcr, int JobStatus)
-{
- jcr->setJobStatus(JobStatus);
-}
-
void JCR::setJobStatus(int newJobStatus)
{
JCR *jcr = this;
}
if (oldJobStatus != jcr->JobStatus) {
- Dmsg2(800, "leave set_job_status old=%c new=%c\n", oldJobStatus, newJobStatus);
+ Dmsg2(800, "leave setJobStatus old=%c new=%c\n", oldJobStatus, newJobStatus);
// generate_plugin_event(jcr, bEventStatusChange, NULL);
}
}
case M_FATAL:
len = bsnprintf(rbuf, sizeof(rbuf), _("%s JobId %u: Fatal error: "), my_name, JobId);
if (jcr) {
- set_jcr_job_status(jcr, JS_FatalError);
+ jcr->setJobStatus(JS_FatalError);
}
if (jcr && jcr->JobErrors == 0) {
jcr->JobErrors = 1;
bail_out:
/* cancel running job properly */
if (fail_on_error) {
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
}
Dmsg1(100, "runscript failed. fail_on_error=%d\n", fail_on_error);
return false;
dev->clear_append();
dev->set_read();
- set_jcr_job_status(jcr, JS_Running);
+ jcr->setJobStatus(JS_Running);
dir_send_job_status(jcr);
Jmsg(jcr, M_INFO, 0, _("Ready to read from volume \"%s\" on device %s.\n"),
dcr->VolumeName, dev->print_name());
memset(&rec, 0, sizeof(rec));
if (!fd->set_buffer_size(dcr->device->max_network_buffer_size, BNET_SETBUF_WRITE)) {
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
Jmsg0(jcr, M_FATAL, 0, _("Unable to set network buffer size.\n"));
return false;
}
if (!acquire_device_for_append(dcr)) {
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
return false;
}
- set_jcr_job_status(jcr, JS_Running);
+ jcr->setJobStatus(JS_Running);
dir_send_job_status(jcr);
if (dev->VolCatInfo.VolCatName[0] == 0) {
if (!write_session_label(dcr, SOS_LABEL)) {
Jmsg1(jcr, M_FATAL, 0, _("Write session label failed. ERR=%s\n"),
dev->bstrerror());
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
ok = false;
}
if (dev->VolCatInfo.VolCatName[0] == 0) {
}
/* Create Job status for end of session label */
- set_jcr_job_status(jcr, ok?JS_Terminated:JS_ErrorTerminated);
+ jcr->setJobStatus(ok?JS_Terminated:JS_ErrorTerminated);
if (ok) {
/* Terminate connection with FD */
dev->bstrerror());
possible_incomplete_job(jcr, last_file_index);
}
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
ok = false;
}
if (dev->VolCatInfo.VolCatName[0] == 0) {
Dmsg0(100, _("Set ok=FALSE after write_block_to_device.\n"));
possible_incomplete_job(jcr, last_file_index);
}
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
ok = false;
}
}
}
}
- set_jcr_job_status(jcr, JS_WaitMedia);
+ jcr->setJobStatus(JS_WaitMedia);
dir_send_job_status(jcr);
stat = wait_for_sysop(dcr);
}
get_out:
- set_jcr_job_status(jcr, JS_Running);
+ jcr->setJobStatus(JS_Running);
dir_send_job_status(jcr);
Dmsg0(100, "leave dir_ask_sysop_to_mount_create_appendable_volume\n");
return true;
dcr->VolumeName, dev->print_name(), jcr->Job);
}
- set_jcr_job_status(jcr, JS_WaitMount);
+ jcr->setJobStatus(JS_WaitMount);
dir_send_job_status(jcr);
stat = wait_for_sysop(dcr); /* wait on device */
}
get_out:
- set_jcr_job_status(jcr, JS_Running);
+ jcr->setJobStatus(JS_Running);
dir_send_job_status(jcr);
Dmsg0(400, "leave dir_ask_sysop_to_mount_volume\n");
return true;
*/
Dmsg0(100, "just before acquire_device\n");
if (!acquire_device_for_append(dcr)) {
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
exit_code = 1;
return;
}
* Write Begin Session Record
*/
if (!write_session_label(dcr, SOS_LABEL)) {
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
Jmsg1(jcr, M_FATAL, 0, _("Write session label failed. ERR=%s\n"),
dev->bstrerror());
ok = false;
Dmsg0(100, "Write_end_session_label()\n");
/* Create Job status for end of session label */
if (!job_canceled(jcr) && ok) {
- set_jcr_job_status(jcr, JS_Terminated);
+ jcr->setJobStatus(JS_Terminated);
} else if (!ok) {
Pmsg0(000, _("Job canceled.\n"));
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
exit_code = 1;
}
if (!write_session_label(dcr, EOS_LABEL)) {
dir->fsend(Job_start, jcr->Job);
jcr->start_time = time(NULL);
jcr->run_time = jcr->start_time;
- set_jcr_job_status(jcr, JS_Running);
+ jcr->setJobStatus(JS_Running);
dir_send_job_status(jcr); /* update director */
do_fd_commands(jcr);
jcr->end_time = time(NULL);
dequeue_messages(jcr); /* send any queued messages */
- set_jcr_job_status(jcr, JS_Terminated);
+ jcr->setJobStatus(JS_Terminated);
generate_daemon_event(jcr, "JobEnd");
dir->fsend(Job_end, jcr->Job, jcr->JobStatus, jcr->JobFiles,
edit_uint64(jcr->JobBytes, ec1), jcr->JobErrors);
} else {
Jmsg0(jcr, M_FATAL, 0, _("Command error with FD, hanging up.\n"));
}
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
}
quit = true;
}
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);
+ jcr->setJobStatus(JS_ErrorTerminated);
return false;
}
Dmsg3(100, "==== incomplete=%d VolSesId=%d VolSesTime=%d\n", jcr->incomplete,
return false;
}
- set_jcr_job_status(jcr, JS_WaitFD); /* wait for FD to connect */
+ jcr->setJobStatus(JS_WaitFD); /* wait for FD to connect */
dir_send_job_status(jcr);
gettimeofday(&tv, &tz);
}
if (!jcr->authenticated) {
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
}
pthread_cond_signal(&jcr->job_start_wait); /* wake waiting job */
free_jcr(jcr);
/* Ready devices for reading and writing */
if (!acquire_device_for_read(jcr->read_dcr) ||
!acquire_device_for_append(jcr->dcr)) {
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
goto bail_out;
}
Dmsg2(200, "===== After acquire pos %u:%u\n", jcr->dcr->dev->file, jcr->dcr->dev->block_num);
- set_jcr_job_status(jcr, JS_Running);
+ jcr->setJobStatus(JS_Running);
dir_send_job_status(jcr);
begin_data_spool(jcr->dcr);
jcr->end_time = time(NULL);
dequeue_messages(jcr); /* send any queued messages */
if (ok) {
- set_jcr_job_status(jcr, JS_Terminated);
+ jcr->setJobStatus(JS_Terminated);
}
generate_daemon_event(jcr, "JobEnd");
dir->fsend(Job_end, jcr->Job, jcr->JobStatus, jcr->JobFiles,
/* Tell File daemon we will send data */
fd->fsend(OK_data);
- set_jcr_job_status(jcr, JS_Running);
+ jcr->setJobStatus(JS_Running);
dir_send_job_status(jcr);
ok = read_records(dcr, record_cb, mount_next_read_volume);
* Get the device, media, and pool information
*/
if (!use_storage_cmd(jcr)) {
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
memset(jcr->sd_auth_key, 0, strlen(jcr->sd_auth_key));
return false;
}
Jmsg(jcr, M_INFO, 0, _("Committing spooled data to Volume \"%s\". Despooling %s bytes ...\n"),
jcr->dcr->VolumeName,
edit_uint64_with_commas(jcr->dcr->job_spool_size, ec1));
- set_jcr_job_status(jcr, JS_DataCommitting);
+ jcr->setJobStatus(JS_DataCommitting);
} else {
Jmsg(jcr, M_INFO, 0, _("Writing spooled data to Volume. Despooling %s bytes ...\n"),
edit_uint64_with_commas(jcr->dcr->job_spool_size, ec1));
- set_jcr_job_status(jcr, JS_DataDespooling);
+ jcr->setJobStatus(JS_DataDespooling);
}
- set_jcr_job_status(jcr, JS_DataDespooling);
+ jcr->setJobStatus(JS_DataDespooling);
dir_send_job_status(jcr);
dcr->despool_wait = true;
dcr->spooling = false;
dcr->dev->print_name(), dcr->dev->bstrerror());
Dmsg2(000, "Fatal append error on device %s: ERR=%s\n",
dcr->dev->print_name(), dcr->dev->bstrerror());
+ /* Force in case Incomplete set */
+ jcr->forceJobStatus(JS_FatalError);
}
Dmsg3(800, "Write block ok=%d FI=%d LI=%d\n", ok, block->FirstIndex, block->LastIndex);
}
if (!dir_create_jobmedia_record(dcr)) {
Jmsg2(jcr, M_FATAL, 0, _("Could not create JobMedia record for Volume=\"%s\" Job=%s\n"),
dcr->getVolCatName(), jcr->Job);
+ jcr->forceJobStatus(JS_FatalError); /* override any Incomplete */
}
/* Set new file/block parameters for current dcr */
set_new_file_parameters(dcr);
despool_elapsed = 1;
}
- Jmsg(dcr->jcr, M_INFO, 0, _("Despooling elapsed time = %02d:%02d:%02d, Transfer rate = %s Bytes/second\n"),
+ Jmsg(jcr, M_INFO, 0, _("Despooling elapsed time = %02d:%02d:%02d, Transfer rate = %s Bytes/second\n"),
despool_elapsed / 3600, despool_elapsed % 3600 / 60, despool_elapsed % 60,
edit_uint64_with_suffix(jcr->dcr->job_spool_size / despool_elapsed, ec1));
lseek(rdcr->spool_fd, 0, SEEK_SET); /* rewind */
if (ftruncate(rdcr->spool_fd, 0) != 0) {
berrno be;
- Jmsg(dcr->jcr, M_ERROR, 0, _("Ftruncate spool file failed: ERR=%s\n"),
+ Jmsg(jcr, M_ERROR, 0, _("Ftruncate spool file failed: ERR=%s\n"),
be.bstrerror());
/* Note, try continuing despite ftruncate problem */
}
if (!commit) {
dcr->dev->dunblock();
}
- set_jcr_job_status(jcr, JS_Running);
+ jcr->setJobStatus(JS_Running);
dir_send_job_status(jcr);
return ok;
}
ssize_t stat;
spool_hdr hdr;
DEV_BLOCK *block = dcr->block;
+ JCR *jcr = dcr->jcr;
rlen = sizeof(hdr);
stat = read(dcr->spool_fd, (char *)&hdr, (size_t)rlen);
be.bstrerror());
} else {
Pmsg2(000, _("Spool read error. Wanted %u bytes, got %d\n"), rlen, stat);
- Jmsg2(dcr->jcr, M_FATAL, 0, _("Spool header read error. Wanted %u bytes, got %d\n"), rlen, stat);
+ Jmsg2(jcr, M_FATAL, 0, _("Spool header read error. Wanted %u bytes, got %d\n"), rlen, stat);
}
+ jcr->forceJobStatus(JS_FatalError); /* override any Incomplete */
return RB_ERROR;
}
rlen = hdr.len;
if (rlen > block->buf_len) {
Pmsg2(000, _("Spool block too big. Max %u bytes, got %u\n"), block->buf_len, rlen);
- Jmsg2(dcr->jcr, M_FATAL, 0, _("Spool block too big. Max %u bytes, got %u\n"), block->buf_len, rlen);
+ Jmsg2(jcr, M_FATAL, 0, _("Spool block too big. Max %u bytes, got %u\n"), block->buf_len, rlen);
+ jcr->forceJobStatus(JS_FatalError); /* override any Incomplete */
return RB_ERROR;
}
stat = read(dcr->spool_fd, (char *)block->buf, (size_t)rlen);
if (stat != (ssize_t)rlen) {
Pmsg2(000, _("Spool data read error. Wanted %u bytes, got %d\n"), rlen, stat);
Jmsg2(dcr->jcr, M_FATAL, 0, _("Spool data read error. Wanted %u bytes, got %d\n"), rlen, stat);
+ jcr->forceJobStatus(JS_FatalError); /* override any Incomplete */
return RB_ERROR;
}
/* Setup write pointers */
spool_hdr hdr;
ssize_t stat;
DEV_BLOCK *block = dcr->block;
+ JCR *jcr = dcr->jcr;
hdr.FirstIndex = block->FirstIndex;
hdr.LastIndex = block->LastIndex;
stat = write(dcr->spool_fd, (char*)&hdr, sizeof(hdr));
if (stat == -1) {
berrno be;
- Jmsg(dcr->jcr, M_FATAL, 0, _("Error writing header to spool file. ERR=%s\n"),
+ Jmsg(jcr, M_FATAL, 0, _("Error writing header to spool file. ERR=%s\n"),
be.bstrerror());
+ jcr->forceJobStatus(JS_FatalError); /* override any Incomplete */
}
if (stat != (ssize_t)sizeof(hdr)) {
- Jmsg(dcr->jcr, M_ERROR, 0, _("Error writing header to spool file."
+ Jmsg(jcr, M_ERROR, 0, _("Error writing header to spool file."
" Disk probably full. Attempting recovery. Wanted to write=%d got=%d\n"),
(int)stat, (int)sizeof(hdr));
/* If we wrote something, truncate it, then despool */
}
}
if (!despool_data(dcr, false)) {
- Jmsg(dcr->jcr, M_FATAL, 0, _("Fatal despooling error."));
+ Jmsg(jcr, M_FATAL, 0, _("Fatal despooling error."));
+ jcr->forceJobStatus(JS_FatalError); /* override any Incomplete */
return false;
}
continue; /* try again */
}
return true;
}
- Jmsg(dcr->jcr, M_FATAL, 0, _("Retrying after header spooling error failed.\n"));
+ Jmsg(jcr, M_FATAL, 0, _("Retrying after header spooling error failed.\n"));
+ jcr->forceJobStatus(JS_FatalError); /* override any Incomplete */
return false;
}
{
ssize_t stat;
DEV_BLOCK *block = dcr->block;
+ JCR *jcr = dcr->jcr;
/* Write data */
for (int retry=0; retry<=1; retry++) {
stat = write(dcr->spool_fd, block->buf, (size_t)block->binbuf);
if (stat == -1) {
berrno be;
- Jmsg(dcr->jcr, M_FATAL, 0, _("Error writing data to spool file. ERR=%s\n"),
+ Jmsg(jcr, M_FATAL, 0, _("Error writing data to spool file. ERR=%s\n"),
be.bstrerror());
+ jcr->forceJobStatus(JS_FatalError); /* override any Incomplete */
}
if (stat != (ssize_t)block->binbuf) {
/*
}
}
if (!despool_data(dcr, false)) {
- Jmsg(dcr->jcr, M_FATAL, 0, _("Fatal despooling error."));
+ Jmsg(jcr, M_FATAL, 0, _("Fatal despooling error."));
+ jcr->forceJobStatus(JS_FatalError); /* override any Incomplete */
return false;
}
if (!write_spool_header(dcr)) {
}
return true;
}
- Jmsg(dcr->jcr, M_FATAL, 0, _("Retrying after data spooling error failed.\n"));
+ Jmsg(jcr, M_FATAL, 0, _("Retrying after data spooling error failed.\n"));
+ jcr->forceJobStatus(JS_FatalError); /* override any Incomplete */
return false;
}
if (jcr->dir_bsock->recv() <= 0) {
Jmsg(jcr, M_FATAL, 0, _("Network error on BlastAttributes.\n"));
+ jcr->forceJobStatus(JS_FatalError); /* override any Incomplete */
return false;
}
berrno be;
Jmsg(jcr, M_FATAL, 0, _("Fseek on attributes file failed: ERR=%s\n"),
be.bstrerror());
+ jcr->forceJobStatus(JS_FatalError); /* override any Incomplete */
goto bail_out;
}
size = ftello(dir->m_spool_fd);
berrno be;
Jmsg(jcr, M_FATAL, 0, _("Truncate on attributes file failed: ERR=%s\n"),
be.bstrerror());
+ jcr->forceJobStatus(JS_FatalError); /* override any Incomplete */
goto bail_out;
}
Dmsg2(100, "=== Attrib spool truncated from %lld to %lld\n",
berrno be;
Jmsg(jcr, M_FATAL, 0, _("Fseek on attributes file failed: ERR=%s\n"),
be.bstrerror());
+ jcr->forceJobStatus(JS_FatalError); /* override any Incomplete */
goto bail_out;
}
P(mutex);
}
spool_stats.attr_size += size;
V(mutex);
- set_jcr_job_status(jcr, JS_AttrDespooling);
+ jcr->setJobStatus(JS_AttrDespooling);
dir_send_job_status(jcr);
Jmsg(jcr, M_INFO, 0, _("Sending spooled attrs to the Director. Despooling %s bytes ...\n"),
edit_uint64_with_commas(size, ec1));
berrno be;
Jmsg(jcr, M_FATAL, 0, _("fopen attr spool file %s failed: ERR=%s\n"), name,
be.bstrerror());
+ jcr->forceJobStatus(JS_FatalError); /* override any Incomplete */
free_pool_memory(name);
return false;
}
free_jcr(jcr);
continue; /* ignore console */
}
- set_jcr_job_status(jcr, JS_Canceled);
+ jcr->setJobStatus(JS_Canceled);
fd = jcr->file_bsock;
if (fd) {
fd->set_timed_out();