[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bacula-devel] Clone jobs and pool


Hi,

when using "clone jobs" (i.e. "run" statements inside a job), the target pool 
for the cloned jobs is set/defined by the respective "JobDefs" statement. In 
many cases (well, in my case, that is ;), it may be more sensible to back up 
to the same pool as the original pool.

By using the attached patch, one can use a "pool=%p" in the run statement to 
do this. The patch uses the callback code that I have submitted a while ago 
(in the thread "Accessing fileset in lib/util.c?"); this code has been in the 
public svn for a while now.

Sorry for not providing a docu patch :(

Thx, best regards,
   Bastian

-- 
Collax GmbH . Burkheimer Straße 3 . 79111 Freiburg . Germany
p: +49 (0) 761-45684-24
f: +49 (0) 761-45684-10        www.collax.com

Geschäftsführer: William K. Hite / Boris Nalbach
AG München HRB 158898 . Ust.-IdNr: DE 814464942
\ In politics stupidity is not a handicap.
Index: bacula-2.2-20080404svn/src/dird/job.c
===================================================================
--- bacula-2.2-20080404svn/src/dird/job.c	(revision 6786)
+++ bacula-2.2-20080404svn/src/dird/job.c	(working copy)
@@ -1272,6 +1272,14 @@
    jcr->wstore = NULL;
 }
 
+char *job_code_callback_clones(JCR *jcr, const char* param) {
+	if (param[0] == 'p') {
+		return jcr->pool->name();
+	} else {
+		return NULL;
+	}
+}
+
 void create_clones(JCR *jcr)
 {
    /*
@@ -1285,7 +1293,7 @@
       UAContext *ua = new_ua_context(jcr);
       ua->batch = true;
       foreach_alist(runcmd, job->run_cmds) {
-         cmd = edit_job_codes(jcr, cmd, runcmd, "");              
+         cmd = edit_job_codes(jcr, cmd, runcmd, "", job_code_callback_clones);
          Mmsg(ua->cmd, "run %s cloned=yes", cmd);
          Dmsg1(900, "=============== Clone cmd=%s\n", ua->cmd);
          parse_ua_args(ua);                 /* parse command */
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Bacula-devel mailing list
Bacula-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/bacula-devel


This mailing list archive is a service of Copilotco.