Skip to content

Commit

Permalink
Fix problem with copy/migrate jobs.
Browse files Browse the repository at this point in the history
Now we select the right catalog and not always set a pool override of
the catalog we run into a crash in set_jcr_defaults as that now
derefences the job->client pointer which for copy/migrate jobs may not
have been set. This patch adds an extra catalog override method to
allow you to set a job specfic catalog setting. If none is set the
default (first) catalog is choosen for the copy/migration Job.
  • Loading branch information
Marco van Wieringen committed Feb 17, 2015
1 parent f0e8965 commit f198f37
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/dird/dird_conf.c
Expand Up @@ -1687,6 +1687,7 @@ void save_resource(int type, RES_ITEM *items, int pass)
res->res_job.client = res_all.res_job.client;
res->res_job.fileset = res_all.res_job.fileset;
res->res_job.storage = res_all.res_job.storage;
res->res_job.catalog = res_all.res_job.catalog;
res->res_job.base = res_all.res_job.base;
res->res_job.pool = res_all.res_job.pool;
res->res_job.full_pool = res_all.res_job.full_pool;
Expand Down
1 change: 1 addition & 0 deletions src/dird/dird_conf.h
Expand Up @@ -434,6 +434,7 @@ class JOBRES {
SCHEDRES *schedule; /* When -- Automatic schedule */
CLIENTRES *client; /* Who to backup */
FILESETRES *fileset; /* What to backup -- Fileset */
CATRES *catalog; /* Which Catalog to use */
alist *storage; /* Where is device -- list of Storage to be used */
POOLRES *pool; /* Where is media -- Media Pool */
POOLRES *full_pool; /* Pool for Full backups */
Expand Down
16 changes: 14 additions & 2 deletions src/dird/job.c
Expand Up @@ -1479,13 +1479,25 @@ void set_jcr_defaults(JCR *jcr, JOBRES *job)
jcr->res.full_pool = job->full_pool;
jcr->res.inc_pool = job->inc_pool;
jcr->res.diff_pool = job->diff_pool;

if (job->pool->catalog) {
jcr->res.catalog = job->pool->catalog;
pm_strcpy(jcr->res.catalog_source, _("Pool resource"));
} else {
jcr->res.catalog = job->client->catalog;
pm_strcpy(jcr->res.catalog_source, _("Client resource"));
if (job->catalog) {
jcr->res.catalog = job->catalog;
pm_strcpy(jcr->res.catalog_source, _("Job resource"));
} else {
if (job->client) {
jcr->res.catalog = job->client->catalog;
pm_strcpy(jcr->res.catalog_source, _("Client resource"));
} else {
jcr->res.catalog = (CATRES *)my_config->GetNextRes(R_CATALOG, NULL);
pm_strcpy(jcr->res.catalog_source, _("Default catalog"));
}
}
}

jcr->res.fileset = job->fileset;
jcr->accurate = job->accurate;
jcr->res.messages = job->messages;
Expand Down

0 comments on commit f198f37

Please sign in to comment.