]> git.sur5r.net Git - bacula/bacula/commitdiff
Add PurgeMigrateJob Job resource option to purge job on successful migration
authorEric Bollengier <eric@eb.homelinux.org>
Thu, 25 Nov 2010 14:49:45 +0000 (15:49 +0100)
committerKern Sibbald <kern@sibbald.com>
Sat, 20 Apr 2013 12:37:12 +0000 (14:37 +0200)
Submited by Blake Dunlap work.

bacula/src/dird/dird_conf.c
bacula/src/dird/dird_conf.h
bacula/src/dird/migrate.c

index a82289878cc61072b36201c6f2b208bc8dc7145c..2440f2e9695f1c9c4f668dd0bcc603da1ad6b5c3 100644 (file)
@@ -311,6 +311,7 @@ RES_ITEM job_items[] = {
    {"prunejobs",   store_bool, ITEM(res_job.PruneJobs), 0, ITEM_DEFAULT, false},
    {"prunefiles",  store_bool, ITEM(res_job.PruneFiles), 0, ITEM_DEFAULT, false},
    {"prunevolumes",store_bool, ITEM(res_job.PruneVolumes), 0, ITEM_DEFAULT, false},
+   {"purgemigratejob",   store_bool, ITEM(res_job.PurgeMigrateJob), 0, ITEM_DEFAULT, false},
    {"enabled",     store_bool, ITEM(res_job.enabled), 0, ITEM_DEFAULT, true},
    {"spoolattributes",store_bool, ITEM(res_job.SpoolAttributes), 0, ITEM_DEFAULT, false},
    {"spooldata",   store_bool, ITEM(res_job.spool_data), 0, ITEM_DEFAULT, false},
index 48bb7703d54ba2d7d53da6a22c1b156e1cad8913..1c5154012eabc3170f88d0702df071ea53d0e8d7 100644 (file)
@@ -436,6 +436,8 @@ public:
    bool CancelLowerLevelDuplicates;   /* Cancel lower level backup jobs */
    bool CancelQueuedDuplicates;       /* Cancel queued jobs */
    bool CancelRunningDuplicates;      /* Cancel Running jobs */
+   bool PurgeMigrateJob;              /* Purges source job on completion */
+
    alist *base;                       /* Base jobs */   
 
    /* Methods */
index 357250b3348bd826814674f494d8bae965cdf0a8..2104b4deb2d3bf9846031f83bcabb24a34b15afd 100644 (file)
@@ -1179,8 +1179,15 @@ void migration_cleanup(JCR *jcr, int TermCode)
          Mmsg(query, "UPDATE Log SET JobId=%s WHERE JobId=%s",
            new_jobid, old_jobid);
          db_sql_query(mig_jcr->db, query.c_str(), NULL, NULL);
-         /* Purge all old file records, but leave Job record */
-         purge_files_from_jobs(ua, old_jobid);
+
+         if (jcr->job->PurgeMigrateJob) {
+            /* Purge old Job record */
+            purge_jobs_from_catalog(ua, old_jobid);
+         } else {
+            /* Purge all old file records, but leave Job record */
+            purge_files_from_jobs(ua, old_jobid);
+         }
+
          free_ua_context(ua);
       }