]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Fix #10307 Add PriorJobName and PriorJobId to the volume label format
authorEric Bollengier <eric@baculasystems.com>
Tue, 8 Aug 2023 15:41:42 +0000 (17:41 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 14 Sep 2023 11:57:01 +0000 (13:57 +0200)
For Migration and Copy job mostly

  Label Format = ${JobId}_${PriorJobName}_${PriorJobId}

bacula/src/dird/expand.c

index 20861f4e10f024bd97714f8c4681cf8d2b928560..4b7dba24c2982f574c20bb99ee5226a240220453 100644 (file)
@@ -126,6 +126,13 @@ static int job_item(JCR *jcr, int code,
    case 12:                           /* JobName */
       str = jcr->Job;
       break;
+   case 13:
+      str = jcr->previous_jr.Name;     /* Previous Job name */
+      break;
+   case 14:
+      bsnprintf(buf, sizeof(buf), "%d", jcr->previous_jr.JobId); /* Previous JobId */
+      str = buf;
+      break;
    }
    *val_ptr = bstrdup(str);
    *val_len = strlen(str);
@@ -160,6 +167,8 @@ static struct s_built_in_vars built_in_vars[] = {
    { NT_("Catalog"),   10, job_item},
    { NT_("MediaType"), 11, job_item},
    { NT_("JobName"),   12, job_item},
+   { NT_("PriorJobName"), 13, job_item},
+   { NT_("PriorJobId"), 14, job_item},
 
    { NULL, 0, NULL}
 };