/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2006 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2007 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.
* Create Job record
*/
init_jcr_job_record(jcr);
+ if (!get_or_create_client_record(jcr)) {
+ goto bail_out;
+ }
+
if (!db_create_job_record(jcr, jcr->db, &jcr->jr)) {
Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db));
goto bail_out;
Dmsg4(100, "Created job record JobId=%d Name=%s Type=%c Level=%c\n",
jcr->JobId, jcr->Job, jcr->jr.JobType, jcr->jr.JobLevel);
- if (!get_or_create_client_record(jcr)) {
- goto bail_out;
- }
-
generate_daemon_event(jcr, "JobStart");
if (job_canceled(jcr)) {
USTORE store;
if (jcr->rstorage) {
store.store = jcr->rstore;
- pm_strcpy(store.store_source, jcr->rstore_source);
} else {
store.store = jcr->wstore;
- pm_strcpy(store.store_source, jcr->wstore_source);
}
set_wstorage(ua->jcr, &store);
}
jcr->JobStatus);
}
Dmsg3(800, "MaxWaitTime result: %scancel JCR %p (%s)\n",
- cancel ? "" : "do not ", jcr, jcr->job);
+ cancel ? "" : "do not ", jcr, jcr->Job);
#endif
return cancel;
}
*/
static bool job_check_maxruntime(JCR *control_jcr, JCR *jcr)
{
- bool cancel = false;
-
if (jcr->job->MaxRunTime == 0 || job_canceled(jcr)) {
return false;
}
}
Dmsg3(200, "MaxRunTime result: %scancel JCR %p (%s)\n",
- cancel ? "" : "do not ", jcr, jcr->job);
+ cancel ? "" : "do not ", jcr, jcr->Job);
#endif
- return cancel;
+ return true;
}
/*
free_pool_memory(jcr->fname);
jcr->fname = NULL;
}
- if (jcr->pool_source) {
- free_pool_memory(jcr->pool_source);
- jcr->pool_source = NULL;
- }
- if (jcr->rpool_source) {
- free_pool_memory(jcr->rpool_source);
- jcr->rpool_source = NULL;
- }
- if (jcr->wstore_source) {
- free_pool_memory(jcr->wstore_source);
- jcr->wstore_source = NULL;
- }
- if (jcr->rstore_source) {
- free_pool_memory(jcr->rstore_source);
- jcr->rstore_source = NULL;
- }
- if (jcr->stime) {
- Dmsg0(200, "Free JCR stime\n");
- free_pool_memory(jcr->stime);
- jcr->stime = NULL;
- }
if (jcr->RestoreBootstrap) {
free(jcr->RestoreBootstrap);
jcr->RestoreBootstrap = NULL;
pthread_cond_destroy(&jcr->term_wait);
jcr->term_wait_inited = false;
}
+ if (jcr->db) {
+ db_close_database(jcr, jcr->db);
+ jcr->db = NULL;
+ }
+ if (jcr->db_batch) {
+ db_close_database(jcr, jcr->db_batch);
+ jcr->db_batch = NULL;
+ }
+ if (jcr->stime) {
+ Dmsg0(200, "Free JCR stime\n");
+ free_pool_memory(jcr->stime);
+ jcr->stime = NULL;
+ }
+ if (jcr->fname) {
+ Dmsg0(200, "Free JCR fname\n");
+ free_pool_memory(jcr->fname);
+ jcr->fname = NULL;
+ }
+ if (jcr->pool_source) {
+ free_pool_memory(jcr->pool_source);
+ jcr->pool_source = NULL;
+ }
+ if (jcr->rpool_source) {
+ free_pool_memory(jcr->rpool_source);
+ jcr->rpool_source = NULL;
+ }
+ if (jcr->wstore_source) {
+ free_pool_memory(jcr->wstore_source);
+ jcr->wstore_source = NULL;
+ }
+ if (jcr->rstore_source) {
+ free_pool_memory(jcr->rstore_source);
+ jcr->rstore_source = NULL;
+ }
/* Delete lists setup to hold storage pointers */
free_rwstorage(jcr);
case JT_RESTORE:
jcr->JobLevel = L_NONE;
break;
+ case JT_MIGRATE:
+ if (!jcr->rpool_source) {
+ jcr->rpool_source = get_pool_memory(PM_MESSAGE);
+ pm_strcpy(jcr->rpool_source, _("unknown source"));
+ }
+ /* Fall-through wanted */
default:
jcr->JobLevel = job->JobLevel;
break;
jcr->pool_source = get_pool_memory(PM_MESSAGE);
pm_strcpy(jcr->pool_source, _("unknown source"));
}
+
jcr->JobPriority = job->Priority;
/* Copy storage definitions -- deleted in dir_free_jcr above */
if (job->storage) {