]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Fix #9568 About "cancel inactive" command Storage Daemon selection
authorEric Bollengier <eric@baculasystems.com>
Thu, 6 Oct 2022 09:54:13 +0000 (11:54 +0200)
committerEric Bollengier <eric@baculasystems.com>
Sat, 18 Feb 2023 09:21:25 +0000 (10:21 +0100)
bacula/src/dird/job.c

index 82d44009633ce5cfe1027c9b436ad943352195be..e4199065f6c7d25df0d40a4d40014ee87bbed25b 100644 (file)
@@ -35,7 +35,7 @@ static bool job_check_maxwaittime(JCR *jcr);
 static bool job_check_maxruntime(JCR *jcr);
 static bool job_check_maxrunschedtime(JCR *jcr);
 static void set_jcr_default_store(JCR *jcr, JOB *job);
-
+static void init_store_manager(JCR *jcr, const char *policy);
 static const int dbglvl_store_mngr = 200;
 
 /* Imported subroutines and variables */
@@ -684,10 +684,12 @@ int cancel_inactive_job(UAContext *ua)
    /* At this time, we can't really guess the storage name from
     * the job record
     */
-   if (get_storage_resource(ua, &store, false/*no default*/, true/*unique*/)) {
+   get_storage_resource(ua, &store, false/*no default*/, true/*unique*/);
+   if (!store.store) {
       goto bail_out;
    }
 
+   init_store_manager(jcr, StorageManager::get_default_policy());
    jcr->store_mngr->set_wstorage(store.store, store.store_source);
    if (!cancel_sd_job(ua, "cancel", jcr)) {
       ua->error_msg(_("Failed to cancel storage dameon job for JobId=%d\n"), jcr->JobId);