From df69c9b142b10f3127b748b6821ef86ddf109523 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Thu, 4 Nov 2004 10:47:54 +0000 Subject: [PATCH] - Add M_ALERT class and put tape alerts into it. - Fix Verify count vs found by not double counting files that are split across files/Volumes. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1673 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/kernstodo | 3 +++ bacula/src/dird/bsr.c | 11 +++++++++++ bacula/src/lib/message.h | 8 ++++++-- bacula/src/lib/parse_conf.c | 2 ++ bacula/src/stored/acquire.c | 4 ++-- bacula/src/version.h | 6 +++--- 6 files changed, 27 insertions(+), 7 deletions(-) diff --git a/bacula/kernstodo b/bacula/kernstodo index fd8678d6c9..49a3d72ad8 100644 --- a/bacula/kernstodo +++ b/bacula/kernstodo @@ -14,6 +14,9 @@ Version 1.35 Kern (see below) 1.37 Items: +- Look at correcting the time jump in the sceduler for daylight + savings time changes. +- Add a "real" timer to network connections. - Tell the "restore" user when browsing is no longer possible. - Write non-optimized bsrs from the JobMedia and Media records, even after Files are pruned. diff --git a/bacula/src/dird/bsr.c b/bacula/src/dird/bsr.c index 5f8db936ad..6e6e374c3f 100644 --- a/bacula/src/dird/bsr.c +++ b/bacula/src/dird/bsr.c @@ -238,6 +238,8 @@ static uint32_t write_bsr(UAContext *ua, RBSR *bsr, FILE *fd) { uint32_t count = 0; uint32_t total_count = 0; + uint32_t LastIndex = 0; + bool first = true; if (bsr) { /* * For a given volume, loop over all the JobMedia records. @@ -273,6 +275,15 @@ static uint32_t write_bsr(UAContext *ua, RBSR *bsr, FILE *fd) fprintf(fd, "Count=%u\n", count); } total_count += count; + /* If the same file is present on two tapes or in two files + * on a tape, it is a continuation, and should not be treated + * twice in the totals. + */ + if (!first && LastIndex == bsr->VolParams[i].FirstIndex) { + total_count--; + } + first = false; + LastIndex = bsr->VolParams[i].LastIndex; } write_bsr(ua, bsr->next, fd); } diff --git a/bacula/src/lib/message.h b/bacula/src/lib/message.h index cf323dded3..5c70ec0266 100644 --- a/bacula/src/lib/message.h +++ b/bacula/src/lib/message.h @@ -37,6 +37,7 @@ #undef M_TERM #undef M_RESTORED #undef M_SECURITY +#undef M_ALERT /* * Most of these message levels are more or less obvious. @@ -65,6 +66,8 @@ * M_SECURITY For security viloations. This is equivalent to FATAL. * (note, this is currently being implemented in 1.33). * + * M_ALERT For Tape Alert messages. + * */ enum { @@ -82,10 +85,11 @@ enum { M_ERROR_TERM, /* Error termination request (no dump) */ M_TERM, /* Terminating daemon normally */ M_RESTORED, /* ls -l of restored files */ - M_SECURITY /* security violation */ + M_SECURITY, /* security violation */ + M_ALERT /* tape alert messages */ }; -#define M_MAX M_SECURITY /* keep this updated ! */ +#define M_MAX M_ALERT /* keep this updated ! */ /* Define message destination structure */ /* *** FIXME **** where should be extended to handle multiple values */ diff --git a/bacula/src/lib/parse_conf.c b/bacula/src/lib/parse_conf.c index 80686bbcfa..82e22502ee 100755 --- a/bacula/src/lib/parse_conf.c +++ b/bacula/src/lib/parse_conf.c @@ -126,6 +126,8 @@ static struct s_mtypes msg_types[] = { {"mount", M_MOUNT}, {"terminate", M_TERM}, {"restored", M_RESTORED}, + {"security", M_SECURITY}, + {"alert", M_ALERT}, {"all", M_MAX+1}, {NULL, 0} }; diff --git a/bacula/src/stored/acquire.c b/bacula/src/stored/acquire.c index a93290f043..ab909549d4 100644 --- a/bacula/src/stored/acquire.c +++ b/bacula/src/stored/acquire.c @@ -435,7 +435,7 @@ bool release_device(JCR *jcr) bpipe = open_bpipe(alert, 0, "r"); if (bpipe) { while (fgets(line, sizeof(line), bpipe->rfd)) { - Jmsg(jcr, M_INFO, 0, _("Alert: %s"), line); + Jmsg(jcr, M_ALERT, 0, _("Alert: %s"), line); } status = close_bpipe(bpipe); } else { @@ -443,7 +443,7 @@ bool release_device(JCR *jcr) } if (status != 0) { berrno be; - Jmsg(jcr, M_INFO, 0, _("3997 Bad alert command: %s: ERR=%s.\n"), + Jmsg(jcr, M_ALERT, 0, _("3997 Bad alert command: %s: ERR=%s.\n"), alert, be.strerror(status)); } diff --git a/bacula/src/version.h b/bacula/src/version.h index 9ce60c8227..add5a7cf71 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -1,8 +1,8 @@ /* */ #undef VERSION #define VERSION "1.37.1" -#define BDATE "30 October 2004" -#define LSMDATE "30Oct04" +#define BDATE "04 November 2004" +#define LSMDATE "04Nov04" /* Debug flags */ #undef DEBUG @@ -10,7 +10,7 @@ #define TRACEBACK 1 #define SMCHECK #define TRACE_FILE 1 -/* #define DEVELOPER 1 */ +#define DEVELOPER 1 /* Debug flags not normally turned on */ -- 2.39.5