From d967c9971af8bcf802983f87fc85fdcf35377bb4 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Tue, 8 Aug 2023 17:41:42 +0200 Subject: [PATCH] Fix #10307 Add PriorJobName and PriorJobId to the volume label format For Migration and Copy job mostly Label Format = ${JobId}_${PriorJobName}_${PriorJobId} --- bacula/src/dird/expand.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bacula/src/dird/expand.c b/bacula/src/dird/expand.c index 20861f4e1..4b7dba24c 100644 --- a/bacula/src/dird/expand.c +++ b/bacula/src/dird/expand.c @@ -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} }; -- 2.47.3