From 72960e3caa0419b7d3c6086f7be51330288d68f8 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Tue, 15 Jul 2008 14:15:16 +0000 Subject: [PATCH] Make SD aware of Virtual Backup jobs. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@7386 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/dird/vbackup.c | 8 +++++--- bacula/src/jcr.h | 1 + bacula/src/stored/dircmd.c | 4 ++++ bacula/src/stored/job.c | 12 ++++++------ bacula/src/stored/mac.c | 5 ++++- bacula/technotes-2.5 | 1 + 6 files changed, 21 insertions(+), 10 deletions(-) diff --git a/bacula/src/dird/vbackup.c b/bacula/src/dird/vbackup.c index 4548a27bc5..d0e4056d98 100644 --- a/bacula/src/dird/vbackup.c +++ b/bacula/src/dird/vbackup.c @@ -174,13 +174,15 @@ bool do_vbackup(JCR *jcr) if (!start_storage_daemon_job(jcr, jcr->rstorage, jcr->wstorage)) { return false; } - Dmsg0(150, "Storage daemon connection OK\n"); + Dmsg0(000, "Storage daemon connection OK\n"); if (!send_bootstrap_file(jcr, sd) || !response(jcr, sd, OKbootstrap, "Bootstrap", DISPLAY_ERROR)) { return false; } + Dmsg0(000, "Bootstrap file sent\n"); + /* * We re-update the job start record so that the start * time is set after the run before job. This avoids @@ -485,8 +487,8 @@ static bool create_bootstrap_file(JCR *jcr, POOLMEM *jobids) #endif complete_bsr(ua, rx.bsr); - Dmsg0(000, "Print bsr\n"); - print_bsr(ua, rx.bsr); +// Dmsg0(000, "Print bsr\n"); +// print_bsr(ua, rx.bsr); jcr->ExpectedFiles = write_bsr_file(ua, rx); Dmsg1(000, "Found %d files to consolidate.\n", jcr->ExpectedFiles); diff --git a/bacula/src/jcr.h b/bacula/src/jcr.h index 9db54c3b65..6abd924089 100644 --- a/bacula/src/jcr.h +++ b/bacula/src/jcr.h @@ -385,6 +385,7 @@ public: alist *reserve_msgs; /* reserve fail messages */ bool write_part_after_job; /* Set to write part after job */ bool PreferMountedVols; /* Prefer mounted vols rather than new */ + bool need_fd; /* set if we need FD connection */ uint32_t FileId; /* Last file id inserted */ diff --git a/bacula/src/stored/dircmd.c b/bacula/src/stored/dircmd.c index 6b358750e1..a53efa31c3 100644 --- a/bacula/src/stored/dircmd.c +++ b/bacula/src/stored/dircmd.c @@ -937,6 +937,10 @@ static bool release_cmd(JCR *jcr) static bool bootstrap_cmd(JCR *jcr) { + /* If getting the bootstrap file succeeds, we do not need + * the FD because we will be reading. + */ + jcr->need_fd = false; return get_bootstrap_file(jcr, jcr->dir_bsock); } diff --git a/bacula/src/stored/job.c b/bacula/src/stored/job.c index 3d97650918..187f4639ec 100644 --- a/bacula/src/stored/job.c +++ b/bacula/src/stored/job.c @@ -146,6 +146,7 @@ bool job_cmd(JCR *jcr) jcr->PreferMountedVols = PreferMountedVols; jcr->authenticated = false; + jcr->need_fd = true; /* * Pass back an authorization key for the File daemon @@ -169,12 +170,11 @@ bool run_cmd(JCR *jcr) Dsm_check(1); Dmsg1(200, "Run_cmd: %s\n", jcr->dir_bsock->msg); - /* The following jobs don't need the FD */ - switch (jcr->JobType) { - case JT_COPY: - case JT_MIGRATE: - case JT_ARCHIVE: - jcr->authenticated = true; + + /* If we do not need the FD, we are doing a migrate, copy, or virtual + * backup. + */ + if (!jcr->need_fd) { do_mac(jcr); return false; } diff --git a/bacula/src/stored/mac.c b/bacula/src/stored/mac.c index e3ea9214d1..1d6cde5e06 100644 --- a/bacula/src/stored/mac.c +++ b/bacula/src/stored/mac.c @@ -27,7 +27,7 @@ */ /* * SD -- mac.c -- responsible for doing - * migration, archive, and copy jobs. + * migration, archive, copy, and virtual backup jobs. * * Kern Sibbald, January MMVI * @@ -67,6 +67,9 @@ bool do_mac(JCR *jcr) case JT_COPY: Type = "Copy"; break; + case JT_BACKUP: + Type = "Virtual Backup"; + break; default: Type = "Unknown"; break; diff --git a/bacula/technotes-2.5 b/bacula/technotes-2.5 index 4a27f648bf..d03e727554 100644 --- a/bacula/technotes-2.5 +++ b/bacula/technotes-2.5 @@ -31,6 +31,7 @@ vtape driver General: 15Jul08 +kes Make SD aware of Virtual Backup jobs. kes Add VirtualFull for bat. kes Changes to get read storage correct for Virtual Backup. 14Jul08 -- 2.39.5