Background: A copy/migrate job has at least two Volumes:

 * the Volume[s] for the original Job (at least one)
 * the Volume[s] for the new Job (i.e. Copy/Migrate) (at least one)

My problem: When a copy/migrate job includes a RunAfterScript, the %v parameter passed into the script is *always* the source Volume; the destination Volume cannot be passed in. This means the script cannot know the destination volume, which is something I want.[1]

Proposal: add a %V (capital V) option to edit_job_codes in lib/util.c

Issue: The volume name we need is contained in mig_jcr, which is created within migration_cleanup(). I know this based upon the job output (see below)[2][3]

My initial attempt failed. See the attached patches. The problem I encountered may not be related to the patch. The tape was having a seek problem (which has since gone away after switching to a new tape and restarting the tape library). If the feedback here indicates I should try again, I will. I first want to ensure I'm not taking the wrong approach.

The changes are:

jcr.h - move mig_jcr from within the '#ifdef DIRECTOR_DAEMON' to the 'Global part of JCR common to all daemons'.

util.c - add a %V parameter and supply the value found in jcr->mig_jcr->VolumeName

--
Dan Langille - http://langille.org/
--- src/jcr.h.orig      2010-08-05 10:29:51.000000000 -0400
+++ src/jcr.h   2010-11-25 20:46:00.000000000 -0500
@@ -279,6 +279,7 @@
    char *plugin_options;              /* user set options for plugin */
    bool cmd_plugin;                   /* Set when processing a command Plugin 
= */
    POOLMEM *comment;                  /* Comment for this Job */
+   JCR *mig_jcr;                      /* JCR for migration/copy job */
 
    /* Daemon specific part of JCR */
    /* This should be empty in the library */
@@ -322,7 +323,6 @@
    JOB_DBR jr;                        /* Job DB record for current job */
    JOB_DBR previous_jr;               /* previous job database record */
    JOB *previous_job;                 /* Job resource of migration previous 
job */
-   JCR *mig_jcr;                      /* JCR for migration/copy job */
    char FSCreateTime[MAX_TIME_LENGTH]; /* FileSet CreateTime as returned from 
DB */
    char since[MAX_TIME_LENGTH];       /* since time */
    union {
--- src/lib/util.c.orig 2010-08-05 10:29:51.000000000 -0400
+++ src/lib/util.c      2010-11-25 20:40:20.000000000 -0500
@@ -829,6 +829,17 @@
                str = _("*none*");
             }
             break;
+         case 'V':
+            if (jcr && jcr->mig_jcr) {
+               if (jcr->mig_jcr->VolumeName && jcr->mig_jcr->VolumeName[0]) {
+                  str = jcr->mig_jcr->VolumeName;
+               } else {
+                  str = "";
+               }
+            } else {
+               str = _("*none*");
+            }
+            break;
          default:
             str = NULL;
             if (callback != NULL) {
------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
Bacula-devel mailing list
Bacula-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-devel

Reply via email to