Skip to content

Commit

Permalink
dird: Interactive run doesn't update pool on level change.
Browse files Browse the repository at this point in the history
In interactive mode when changing the level we correctly call
apply_pool_overrides() which sets the new pool right but then we
call reset_restore_context() which sets the pool back to rc.pool
(e.g. restore context pool definition which still points to the original
 pool defined in the Job resource.)

This patch updates the rc.pool to point to the pool which was set by
the call to apply_pool_overrides() and set a variable in the restore
context which keeps track that we got a level override so we don't
overwrite the pool_source which is also set by apply_pool_overrides()
in reset_restore_context().

When we get a real pool override via the mod pool option we reset this
level override flag so we set the right pool_source in
reset_restore_context() again.

Fixes #633: Interactive run doesn't update pool on level change.
  • Loading branch information
Marco van Wieringen authored and pstorz committed Mar 24, 2016
1 parent 97161d3 commit b39591e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/dird/ua.h
Expand Up @@ -171,6 +171,7 @@ class RUN_CTX {
CATRES *catalog;
int Priority;
int files;
bool level_override;
bool spool_data;
bool accurate;
bool ignoreduplicatecheck;
Expand Down
11 changes: 6 additions & 5 deletions src/dird/ua_run.c
Expand Up @@ -371,8 +371,7 @@ int do_run_cmd(UAContext *ua, const char *cmd)
}

/*
* Create JCR to run job. NOTE!!! after this point, free_jcr()
* before returning.
* Create JCR to run job. NOTE!!! after this point, free_jcr() before returning.
*/
if (!jcr) {
jcr = new_jcr(sizeof(JCR), dird_free_jcr);
Expand Down Expand Up @@ -602,6 +601,8 @@ int modify_job_parameters(UAContext *ua, JCR *jcr, RUN_CTX &rc)
case JT_BACKUP:
if (!jcr->is_JobLevel(L_VIRTUAL_FULL)) {
apply_pool_overrides(jcr, true);
rc.pool = jcr->res.pool;
rc.level_override = true;
}
break;
default:
Expand Down Expand Up @@ -688,6 +689,7 @@ int modify_job_parameters(UAContext *ua, JCR *jcr, RUN_CTX &rc)
rc.pool = select_pool_resource(ua);
if (rc.pool) {
jcr->res.pool = rc.pool;
rc.level_override = false;
Dmsg1(100, "Set new pool=%s\n", jcr->res.pool->name());
goto try_again;
}
Expand Down Expand Up @@ -826,8 +828,7 @@ int modify_job_parameters(UAContext *ua, JCR *jcr, RUN_CTX &rc)

/*
* Reset the restore context.
* This subroutine can be called multiple times, so it
* must keep any prior settings.
* This subroutine can be called multiple times, so it must keep any prior settings.
*/
static bool reset_restore_context(UAContext *ua, JCR *jcr, RUN_CTX &rc)
{
Expand All @@ -845,7 +846,7 @@ static bool reset_restore_context(UAContext *ua, JCR *jcr, RUN_CTX &rc)
if (rc.pool_name) {
pm_strcpy(jcr->res.pool_source, _("command line"));
jcr->IgnoreLevelPoolOverides = true;
} else if (jcr->res.pool != jcr->res.job->pool) {
} else if (!rc.level_override && jcr->res.pool != jcr->res.job->pool) {
pm_strcpy(jcr->res.pool_source, _("user input"));
}
set_rwstorage(jcr, rc.store);
Expand Down

0 comments on commit b39591e

Please sign in to comment.