From 65e81a4da0d0175163ef1b8f67a6dd3d7b4fd06b Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sun, 19 Oct 2003 13:33:53 +0000 Subject: [PATCH] Change media pool+first cut Verify disk to catalog + get gnome2 console working git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@751 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/autoconf/configure.in | 2 + bacula/configure | 4 +- bacula/kernstodo | 2 + bacula/src/.cvsignore | 1 + bacula/src/cats/sql_find.c | 5 ++- bacula/src/cats/sql_get.c | 19 ++++---- bacula/src/cats/sql_update.c | 5 ++- bacula/src/dird/backup.c | 3 +- bacula/src/dird/fd_cmds.c | 6 ++- bacula/src/dird/inc_conf.c | 23 ++++++---- bacula/src/dird/ua_run.c | 86 +++++++++++++++++++++++++++++------- bacula/src/dird/ua_status.c | 16 +++++-- bacula/src/dird/verify.c | 54 ++++++++++++++-------- bacula/src/filed/verify.c | 7 +++ bacula/src/version.h | 6 +-- 15 files changed, 171 insertions(+), 68 deletions(-) diff --git a/bacula/autoconf/configure.in b/bacula/autoconf/configure.in index 92acf4feab..03d953dc59 100644 --- a/bacula/autoconf/configure.in +++ b/bacula/autoconf/configure.in @@ -1433,6 +1433,8 @@ AC_OUTPUT([autoconf/Make.common \ src/console/console.conf \ src/gnome-console/Makefile \ src/gnome-console/gnome-console.conf \ + src/gnome2-console/Makefile \ + src/gnome2-console/gnome-console.conf \ src/tconsole/Makefile \ src/dird/Makefile \ src/dird/bacula-dir.conf \ diff --git a/bacula/configure b/bacula/configure index 56b9244a7f..3cae1343bd 100755 --- a/bacula/configure +++ b/bacula/configure @@ -17481,7 +17481,7 @@ if test "x${subsysdir}" = "x${sbindir}" ; then exit 1 fi - ac_config_files="$ac_config_files autoconf/Make.common Makefile rescue/Makefile rescue/linux/Makefile rescue/freebsd/Makefile rescue/solaris/Makefile scripts/startmysql scripts/stopmysql scripts/btraceback scripts/startit scripts/stopit scripts/console scripts/gconsole scripts/bacula scripts/fd scripts/Makefile scripts/logrotate scripts/bacula.desktop.gnome1 scripts/bacula.desktop.gnome2 scripts/mtx-changer doc/Makefile src/Makefile src/host.h src/console/Makefile src/console/console.conf src/gnome-console/Makefile src/gnome-console/gnome-console.conf src/tconsole/Makefile src/dird/Makefile src/dird/bacula-dir.conf src/lib/Makefile src/stored/Makefile src/stored/bacula-sd.conf src/filed/Makefile src/filed/bacula-fd.conf src/filed/win32/Makefile src/cats/Makefile src/cats/make_catalog_backup src/cats/delete_catalog_backup src/cats/alter_mysql_tables src/cats/make_mysql_tables src/cats/drop_mysql_tables src/cats/create_mysql_database src/cats/grant_mysql_privileges src/cats/alter_sqlite_tables src/cats/make_sqlite_tables src/cats/drop_sqlite_tables src/cats/create_sqlite_database src/cats/sqlite src/cats/mysql src/cats/create_bdb_database src/cats/make_bdb_tables src/cats/drop_bdb_tables src/cats/make_bacula_tables src/cats/drop_bacula_tables src/findlib/Makefile src/tools/Makefile $PFILES" + ac_config_files="$ac_config_files autoconf/Make.common Makefile rescue/Makefile rescue/linux/Makefile rescue/freebsd/Makefile rescue/solaris/Makefile scripts/startmysql scripts/stopmysql scripts/btraceback scripts/startit scripts/stopit scripts/console scripts/gconsole scripts/bacula scripts/fd scripts/Makefile scripts/logrotate scripts/bacula.desktop.gnome1 scripts/bacula.desktop.gnome2 scripts/mtx-changer doc/Makefile src/Makefile src/host.h src/console/Makefile src/console/console.conf src/gnome-console/Makefile src/gnome-console/gnome-console.conf src/gnome2-console/Makefile src/gnome2-console/gnome-console.conf src/tconsole/Makefile src/dird/Makefile src/dird/bacula-dir.conf src/lib/Makefile src/stored/Makefile src/stored/bacula-sd.conf src/filed/Makefile src/filed/bacula-fd.conf src/filed/win32/Makefile src/cats/Makefile src/cats/make_catalog_backup src/cats/delete_catalog_backup src/cats/alter_mysql_tables src/cats/make_mysql_tables src/cats/drop_mysql_tables src/cats/create_mysql_database src/cats/grant_mysql_privileges src/cats/alter_sqlite_tables src/cats/make_sqlite_tables src/cats/drop_sqlite_tables src/cats/create_sqlite_database src/cats/sqlite src/cats/mysql src/cats/create_bdb_database src/cats/make_bdb_tables src/cats/drop_bdb_tables src/cats/make_bacula_tables src/cats/drop_bacula_tables src/findlib/Makefile src/tools/Makefile $PFILES" ac_config_commands="$ac_config_commands default" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -18037,6 +18037,8 @@ do "src/console/console.conf" ) CONFIG_FILES="$CONFIG_FILES src/console/console.conf" ;; "src/gnome-console/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/gnome-console/Makefile" ;; "src/gnome-console/gnome-console.conf" ) CONFIG_FILES="$CONFIG_FILES src/gnome-console/gnome-console.conf" ;; + "src/gnome2-console/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/gnome2-console/Makefile" ;; + "src/gnome2-console/gnome-console.conf" ) CONFIG_FILES="$CONFIG_FILES src/gnome2-console/gnome-console.conf" ;; "src/tconsole/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/tconsole/Makefile" ;; "src/dird/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/dird/Makefile" ;; "src/dird/bacula-dir.conf" ) CONFIG_FILES="$CONFIG_FILES src/dird/bacula-dir.conf" ;; diff --git a/bacula/kernstodo b/bacula/kernstodo index 0095e2ba2d..b1250f39e3 100644 --- a/bacula/kernstodo +++ b/bacula/kernstodo @@ -36,6 +36,8 @@ For 1.33 Testing/Documentation: SuSE. For 1.33 +- Limit the number of block checksum/header BB01, ... errors + printed. - Add VerifyJob to "run" summary (yes/mod/no) prompt. - Add device name to "Current Volume not acceptable because ..." - Make sure that Bacula rechecks the tape after the 20 min wait. diff --git a/bacula/src/.cvsignore b/bacula/src/.cvsignore index 018076a9be..a9c61f762d 100644 --- a/bacula/src/.cvsignore +++ b/bacula/src/.cvsignore @@ -5,3 +5,4 @@ Makefile config.h testprogs host.h +perlgui diff --git a/bacula/src/cats/sql_find.c b/bacula/src/cats/sql_find.c index e29ea40110..6279e8a11a 100644 --- a/bacula/src/cats/sql_find.c +++ b/bacula/src/cats/sql_find.c @@ -155,7 +155,8 @@ db_find_last_jobid(JCR *jcr, B_DB *mdb, char *Name, JOB_DBR *jr) "SELECT JobId FROM Job WHERE Type='V' AND Level='%c' AND Name='%s' AND " "ClientId=%u ORDER BY StartTime DESC LIMIT 1", L_VERIFY_INIT, jr->Name, jr->ClientId); - } else if (jr->Level == L_VERIFY_VOLUME_TO_CATALOG) { + } else if (jr->Level == L_VERIFY_VOLUME_TO_CATALOG || + jr->Level == L_VERIFY_DISK_TO_CATALOG) { if (Name) { Mmsg(&mdb->cmd, "SELECT JobId FROM Job WHERE Type='B' AND JobStatus='T' AND " @@ -170,7 +171,7 @@ db_find_last_jobid(JCR *jcr, B_DB *mdb, char *Name, JOB_DBR *jr) db_unlock(mdb); return 0; } - + Dmsg1(100, "Query: %s\n", mdb->cmd); if (!QUERY_DB(jcr, mdb, mdb->cmd)) { db_unlock(mdb); return 0; diff --git a/bacula/src/cats/sql_get.c b/bacula/src/cats/sql_get.c index 43d9a3a118..47e034e15a 100644 --- a/bacula/src/cats/sql_get.c +++ b/bacula/src/cats/sql_get.c @@ -70,7 +70,7 @@ extern void split_path_and_filename(JCR *jcr, B_DB *mdb, char *fname); int db_get_file_attributes_record(JCR *jcr, B_DB *mdb, char *fname, JOB_DBR *jr, FILE_DBR *fdbr) { int stat; - Dmsg1(20, "Enter get_file_from_catalog fname=%s \n", fname); + Dmsg1(100, "db_get_file_att_record fname=%s \n", fname); db_lock(mdb); split_path_and_filename(jcr, mdb, fname); @@ -262,15 +262,15 @@ int db_get_job_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr) db_lock(mdb); if (jr->JobId == 0) { - Mmsg(&mdb->cmd, "SELECT VolSessionId,VolSessionTime,\ -PoolId,StartTime,EndTime,JobFiles,JobBytes,JobTDate,Job,JobStatus,\ -Type,Level \ -FROM Job WHERE Job='%s'", jr->Job); + Mmsg(&mdb->cmd, "SELECT VolSessionId,VolSessionTime," +"PoolId,StartTime,EndTime,JobFiles,JobBytes,JobTDate,Job,JobStatus," +"Type,Level,ClientId " +"FROM Job WHERE Job='%s'", jr->Job); } else { - Mmsg(&mdb->cmd, "SELECT VolSessionId,VolSessionTime,\ -PoolId,StartTime,EndTime,JobFiles,JobBytes,JobTDate,Job,JobStatus,\ -Type,Level \ -FROM Job WHERE JobId=%u", jr->JobId); + Mmsg(&mdb->cmd, "SELECT VolSessionId,VolSessionTime," +"PoolId,StartTime,EndTime,JobFiles,JobBytes,JobTDate,Job,JobStatus," +"Type,Level,ClientId " +"FROM Job WHERE JobId=%u", jr->JobId); } if (!QUERY_DB(jcr, mdb, mdb->cmd)) { @@ -296,6 +296,7 @@ FROM Job WHERE JobId=%u", jr->JobId); jr->JobStatus = (int)*row[9]; jr->Type = (int)*row[10]; jr->Level = (int)*row[11]; + jr->ClientId = str_to_uint64(row[12]); sql_free_result(mdb); db_unlock(mdb); diff --git a/bacula/src/cats/sql_update.c b/bacula/src/cats/sql_update.c index 510c21bab2..4acb2b8f59 100644 --- a/bacula/src/cats/sql_update.c +++ b/bacula/src/cats/sql_update.c @@ -103,9 +103,10 @@ db_update_job_start_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr) JobTDate = (btime_t)stime; db_lock(mdb); - Mmsg(&mdb->cmd, "UPDATE Job SET Level='%c', StartTime='%s', \ -ClientId=%u, JobTDate=%s WHERE JobId=%u", + Mmsg(&mdb->cmd, "UPDATE Job SET Level='%c', StartTime='%s'," +"ClientId=%u, JobTDate=%s WHERE JobId=%u", (char)(jr->Level), dt, jr->ClientId, edit_uint64(JobTDate, ed1), jr->JobId); + stat = UPDATE_DB(jcr, mdb, mdb->cmd); db_unlock(mdb); mdb->changes = 0; diff --git a/bacula/src/dird/backup.c b/bacula/src/dird/backup.c index 8d547b4065..2f32d18ce7 100644 --- a/bacula/src/dird/backup.c +++ b/bacula/src/dird/backup.c @@ -257,6 +257,7 @@ int wait_for_job_termination(JCR *jcr) /* Note, the SD stores in jcr->JobFiles/ReadBytes/JobBytes/Errors */ wait_for_storage_daemon_termination(jcr); + /* Return values from FD */ if (fd_ok) { jcr->JobFiles = JobFiles; @@ -295,7 +296,7 @@ static void backup_cleanup(JCR *jcr, int TermCode, char *since, FILESET_DBR *fsr double kbps, compression; utime_t RunTime; - Dmsg0(100, "Enter backup_cleanup()\n"); + Dmsg2(100, "Enter backup_cleanup %d %c\n", TermCode, TermCode); memset(&mr, 0, sizeof(mr)); set_jcr_job_status(jcr, TermCode); diff --git a/bacula/src/dird/fd_cmds.c b/bacula/src/dird/fd_cmds.c index 4d7f1e25b9..0756292270 100644 --- a/bacula/src/dird/fd_cmds.c +++ b/bacula/src/dird/fd_cmds.c @@ -250,6 +250,7 @@ static int send_list(JCR *jcr, int list) } else { bstrncpy(buf, "0 ", sizeof(buf)); } + Dmsg1(000, "Opts=%s\n", buf); optlen = strlen(buf); while (fgets(buf+optlen, sizeof(buf)-optlen, bpipe->rfd)) { fd->msglen = Mmsg(&fd->msg, "%s", buf); @@ -279,6 +280,7 @@ static int send_list(JCR *jcr, int list) } else { bstrncpy(buf, "0 ", sizeof(buf)); } + Dmsg1(000, "Opts=%s\n", buf); optlen = strlen(buf); while (fgets(buf+optlen, sizeof(buf)-optlen, ffd)) { fd->msglen = Mmsg(&fd->msg, "%s", buf); @@ -293,15 +295,15 @@ static int send_list(JCR *jcr, int list) p++; /* skip over \ */ /* Note, fall through wanted */ default: + Dmsg2(100, "numopts=%d opts=%s\n", ie->num_opts, NPRT(ie->opts_list[0]->opts)); if (ie->num_opts) { pm_strcpy(&fd->msg, ie->opts_list[0]->opts); pm_strcat(&fd->msg, " "); } else { pm_strcpy(&fd->msg, "0 "); } - pm_strcat(&fd->msg, p); + fd->msglen = pm_strcat(&fd->msg, p); Dmsg1(100, "Inc/Exc name=%s\n", fd->msg); - fd->msglen = strlen(fd->msg); if (!bnet_send(fd)) { Jmsg(jcr, M_FATAL, 0, _(">filed: write error on socket\n")); goto bail_out; diff --git a/bacula/src/dird/inc_conf.c b/bacula/src/dird/inc_conf.c index bacd5bbead..1e9c69c694 100644 --- a/bacula/src/dird/inc_conf.c +++ b/bacula/src/dird/inc_conf.c @@ -151,8 +151,9 @@ static struct s_fs_opt FS_options[] = { /* - * Scan for old Include options (keyword=option) is converted into one or - * two characters. Verifyopts=xxxx is Vxxxx: + * Scan for right hand side of Include options (keyword=option) is + * converted into one or two characters. Verifyopts=xxxx is Vxxxx: + * Whatever is found is concatenated to the opts string. */ static void scan_include_options(LEX *lc, int keyword, char *opts, int optlen) { @@ -167,6 +168,7 @@ static void scan_include_options(LEX *lc, int keyword, char *opts, int optlen) bstrncat(opts, "V", optlen); /* indicate Verify */ bstrncat(opts, lc->str, optlen); bstrncat(opts, ":", optlen); /* terminate it */ + Dmsg3(100, "Catopts=%s option=%s optlen=%d\n", opts, option,optlen); /* * Standard keyword options for Include/Exclude @@ -185,7 +187,7 @@ static void scan_include_options(LEX *lc, int keyword, char *opts, int optlen) scan_err1(lc, "Expected a FileSet option keyword, got:%s:", lc->str); } else { /* add option */ bstrncat(opts, option, optlen); - Dmsg3(200, "Catopts=%s option=%s optlen=%d\n", opts, option,optlen); + Dmsg3(100, "Catopts=%s option=%s optlen=%d\n", opts, option,optlen); } } @@ -238,6 +240,7 @@ void store_inc(LEX *lc, struct res_items *item, int index, int pass) if ((token=lex_get_token(lc, T_ALL)) != T_EQUALS) { scan_err1(lc, _("expected an = following keyword, got: %s"), lc->str); } else { + /* Scan right hand side of option */ scan_include_options(lc, keyword, inc_opts, sizeof(inc_opts)); } if (token == T_BOB) { @@ -258,7 +261,7 @@ void store_inc(LEX *lc, struct res_items *item, int index, int pass) } setup_current_opts(); bstrncpy(res_incexe.current_opts->opts, inc_opts, MAX_FOPTS); - Dmsg1(200, "incexe opts=%s\n", res_incexe.current_opts->opts); + Dmsg2(100, "old pass=%d incexe opts=%s\n", pass, res_incexe.current_opts->opts); /* Create incexe structure */ Dmsg0(200, "Create INCEXE structure\n"); @@ -472,7 +475,9 @@ static void store_fname(LEX *lc, struct res_items *item, int index, int pass) scan_to_eol(lc); } - +/* + * New style options come here + */ static void store_opts(LEX *lc, struct res_items *item, int index, int pass) { int i; @@ -481,6 +486,7 @@ static void store_opts(LEX *lc, struct res_items *item, int index, int pass) inc_opts[0] = 0; keyword = INC_KW_NONE; + /* Look up the keyword */ for (i=0; FS_option_kw[i].name; i++) { if (strcasecmp(item->name, FS_option_kw[i].name) == 0) { keyword = FS_option_kw[i].token; @@ -490,14 +496,13 @@ static void store_opts(LEX *lc, struct res_items *item, int index, int pass) if (keyword == INC_KW_NONE) { scan_err1(lc, "Expected a FileSet keyword, got: %s", lc->str); } - Dmsg2(200, "keyword=%d %s\n", keyword, FS_option_kw[keyword].name); + /* Now scan for the value */ scan_include_options(lc, keyword, inc_opts, sizeof(inc_opts)); - if (pass == 1) { setup_current_opts(); - bstrncat(res_incexe.current_opts->opts, inc_opts, MAX_FOPTS); + bstrncpy(res_incexe.current_opts->opts, inc_opts, MAX_FOPTS); + Dmsg2(100, "new pass=%d incexe opts=%s\n", pass, res_incexe.current_opts->opts); } - scan_to_eol(lc); } diff --git a/bacula/src/dird/ua_run.c b/bacula/src/dird/ua_run.c index f54eaf22a3..8fc402644f 100644 --- a/bacula/src/dird/ua_run.c +++ b/bacula/src/dird/ua_run.c @@ -49,10 +49,12 @@ int run_cmd(UAContext *ua, char *cmd) JCR *jcr; char *job_name, *level_name, *jid, *store_name, *pool_name; char *where, *fileset_name, *client_name, *bootstrap, *replace; - char *when; + char *when, *verify_job_name; int Priority = 0; - int i, j, found, opt; + int i, j, opt; + bool found; JOB *job = NULL; + JOB *verify_job = NULL; STORE *store = NULL; CLIENT *client = NULL; FILESET *fileset = NULL; @@ -72,6 +74,7 @@ int run_cmd(UAContext *ua, char *cmd) N_("priority"), N_("yes"), /* 12 -- if you change this change YES_POS too */ N_("run"), /* 13 -- if you change this change RUN_POS too */ + N_("verifyjob"), NULL}; #define YES_POS 12 @@ -92,9 +95,10 @@ int run_cmd(UAContext *ua, char *cmd) fileset_name = NULL; bootstrap = NULL; replace = NULL; + verify_job_name = NULL; for (i=1; iargc; i++) { - found = False; + found = false; Dmsg2(200, "Doing arg %d = %s\n", i, ua->argk[i]); for (j=0; !found && kw[j]; j++) { if (strcasecmp(ua->argk[i], _(kw[j])) == 0) { @@ -111,7 +115,7 @@ int run_cmd(UAContext *ua, char *cmd) return 1; } job_name = ua->argv[i]; - found = True; + found = true; break; case 1: /* JobId */ if (jid) { @@ -119,7 +123,7 @@ int run_cmd(UAContext *ua, char *cmd) return 1; } jid = ua->argv[i]; - found = True; + found = true; break; case 2: /* client */ if (client_name) { @@ -127,7 +131,7 @@ int run_cmd(UAContext *ua, char *cmd) return 1; } client_name = ua->argv[i]; - found = True; + found = true; break; case 3: /* fileset */ if (fileset_name) { @@ -135,7 +139,7 @@ int run_cmd(UAContext *ua, char *cmd) return 1; } fileset_name = ua->argv[i]; - found = True; + found = true; break; case 4: /* level */ if (level_name) { @@ -143,7 +147,7 @@ int run_cmd(UAContext *ua, char *cmd) return 1; } level_name = ua->argv[i]; - found = True; + found = true; break; case 5: /* storage */ if (store_name) { @@ -151,7 +155,7 @@ int run_cmd(UAContext *ua, char *cmd) return 1; } store_name = ua->argv[i]; - found = True; + found = true; break; case 6: /* pool */ if (pool_name) { @@ -159,7 +163,7 @@ int run_cmd(UAContext *ua, char *cmd) return 1; } pool_name = ua->argv[i]; - found = True; + found = true; break; case 7: /* where */ if (where) { @@ -167,7 +171,7 @@ int run_cmd(UAContext *ua, char *cmd) return 1; } where = ua->argv[i]; - found = True; + found = true; break; case 8: /* bootstrap */ if (bootstrap) { @@ -175,7 +179,7 @@ int run_cmd(UAContext *ua, char *cmd) return 1; } bootstrap = ua->argv[i]; - found = True; + found = true; break; case 9: /* replace */ if (replace) { @@ -183,7 +187,7 @@ int run_cmd(UAContext *ua, char *cmd) return 1; } replace = ua->argv[i]; - found = True; + found = true; break; case 10: /* When */ if (when) { @@ -191,7 +195,7 @@ int run_cmd(UAContext *ua, char *cmd) return 1; } when = ua->argv[i]; - found = True; + found = true; break; case 11: /* Priority */ if (Priority) { @@ -206,8 +210,17 @@ int run_cmd(UAContext *ua, char *cmd) break; case 12: /* yes */ case 13: /* run */ - found = True; + found = true; break; + case 14: /* Verify Job */ + if (verify_job_name) { + bsendmsg(ua, _("Verify Job specified twice.\n")); + return 1; + } + verify_job_name = ua->argv[i]; + found = true; + break; + default: break; } @@ -300,6 +313,15 @@ int run_cmd(UAContext *ua, char *cmd) return 1; } + if (verify_job_name) { + verify_job = (JOB *)GetResWithName(R_JOB, verify_job_name); + if (!verify_job) { + bsendmsg(ua, _("Verify Job \"%s\" not found.\n"), verify_job_name); + verify_job = select_job_resource(ua); + } + } else { + verify_job = job->verify_job; + } /* Create JCR to run job */ jcr = new_jcr(sizeof(JCR), dird_free_jcr); @@ -399,7 +421,8 @@ Priority: %d\n"), } } level_name = NULL; - bsendmsg(ua, _("Run %s job\n\ + if (jcr->JobType == JT_BACKUP) { + bsendmsg(ua, _("Run %s job\n\ JobName: %s\n\ FileSet: %s\n\ Level: %s\n\ @@ -408,15 +431,43 @@ Storage: %s\n\ Pool: %s\n\ When: %s\n\ Priority: %d\n"), - jcr->JobType==JT_BACKUP?_("Backup"):_("Verify"), + _("Backup"), + job->hdr.name, + jcr->fileset->hdr.name, + level_to_str(jcr->JobLevel), + jcr->client->hdr.name, + jcr->store->hdr.name, + NPRT(jcr->pool->hdr.name), + bstrutime(dt, sizeof(dt), jcr->sched_time), + jcr->JobPriority); + } else { /* JT_VERIFY */ + char *Name; + if (jcr->job->verify_job) { + Name = jcr->job->verify_job->hdr.name; + } else { + Name = ""; + } + bsendmsg(ua, _("Run %s job\n\ +JobName: %s\n\ +FileSet: %s\n\ +Level: %s\n\ +Client: %s\n\ +Storage: %s\n\ +Pool: %s\n\ +Verify Job: %s\n\ +When: %s\n\ +Priority: %d\n"), + _("Verify"), job->hdr.name, jcr->fileset->hdr.name, level_to_str(jcr->JobLevel), jcr->client->hdr.name, jcr->store->hdr.name, NPRT(jcr->pool->hdr.name), + Name, bstrutime(dt, sizeof(dt), jcr->sched_time), jcr->JobPriority); + } break; case JT_RESTORE: if (jcr->RestoreJobId == 0 && !jcr->RestoreBootstrap) { @@ -643,6 +694,7 @@ Priority: %d\n"), } goto try_again; case 7: + /* Pool or Bootstrap depending on JobType */ if (jcr->JobType == JT_BACKUP || jcr->JobType == JT_VERIFY) { /* Pool */ pool = select_pool_resource(ua); diff --git a/bacula/src/dird/ua_status.c b/bacula/src/dird/ua_status.c index 2d8c59c6e4..d2eddedcb9 100644 --- a/bacula/src/dird/ua_status.c +++ b/bacula/src/dird/ua_status.c @@ -238,6 +238,15 @@ static void do_director_status(UAContext *ua, char *cmd) case JS_ErrorTerminated: msg = _("has erred"); break; + case JS_Error: + msg = _("has errors"); + break; + case JS_FatalError: + msg = _("has a fatal error"); + break; + case JS_Differences: + msg = _("has verify differences"); + break; case JS_Canceled: msg = _("has been canceled"); break; @@ -260,16 +269,15 @@ static void do_director_status(UAContext *ua, char *cmd) case JS_WaitJobRes: msg = _("is waiting on max Job jobs"); break; - case JS_WaitPriority: - msg = _("is waiting for higher priority jobs to finish"); - break; case JS_WaitMaxJobs: msg = _("is waiting on max total jobs"); break; case JS_WaitStartTime: msg = _("is waiting for its start time"); break; - + case JS_WaitPriority: + msg = _("is waiting for higher priority jobs to finish"); + break; default: msg = (char *) get_pool_memory(PM_FNAME); diff --git a/bacula/src/dird/verify.c b/bacula/src/dird/verify.c index 213d8ddc5f..fe868f6b36 100644 --- a/bacula/src/dird/verify.c +++ b/bacula/src/dird/verify.c @@ -67,7 +67,7 @@ int do_verify(JCR *jcr) char *level, *Name; BSOCK *fd; JOB_DBR jr, verify_jr; - JobId_t JobId = 0; + JobId_t verify_jobid = 0; int stat; if (!get_or_create_client_record(jcr)) { @@ -83,10 +83,12 @@ int do_verify(JCR *jcr) * last backup Job. */ if (jcr->JobLevel == L_VERIFY_CATALOG || - jcr->JobLevel == L_VERIFY_VOLUME_TO_CATALOG) { + jcr->JobLevel == L_VERIFY_VOLUME_TO_CATALOG || + jcr->JobLevel == L_VERIFY_DISK_TO_CATALOG) { memcpy(&jr, &jcr->jr, sizeof(jr)); - if (jcr->JobLevel == L_VERIFY_VOLUME_TO_CATALOG && - jcr->job->verify_job) { + if (jcr->job->verify_job && + (jcr->JobLevel == L_VERIFY_VOLUME_TO_CATALOG || + jcr->JobLevel == L_VERIFY_DISK_TO_CATALOG)) { Name = jcr->job->verify_job->hdr.name; } else { Name = NULL; @@ -104,8 +106,8 @@ int do_verify(JCR *jcr) } goto bail_out; } - JobId = jr.JobId; - Dmsg1(100, "Last full Jobid=%d\n", JobId); + verify_jobid = jr.JobId; + Dmsg1(100, "Last full jobid=%d\n", verify_jobid); } jcr->jr.JobId = jcr->JobId; @@ -126,13 +128,13 @@ int do_verify(JCR *jcr) /* * Now get the job record for the previous backup that interests - * us. We use the JobId that we found above. + * us. We use the verify_jobid that we found above. */ if (jcr->JobLevel == L_VERIFY_CATALOG || jcr->JobLevel == L_VERIFY_VOLUME_TO_CATALOG || jcr->JobLevel == L_VERIFY_DISK_TO_CATALOG) { memset(&verify_jr, 0, sizeof(verify_jr)); - verify_jr.JobId = JobId; + verify_jr.JobId = verify_jobid; if (!db_get_job_record(jcr, jcr->db, &verify_jr)) { Jmsg(jcr, M_FATAL, 0, _("Could not get job record for previous Job. ERR=%s"), db_strerror(jcr->db)); @@ -140,7 +142,7 @@ int do_verify(JCR *jcr) } if (verify_jr.JobStatus != 'T') { Jmsg(jcr, M_FATAL, 0, _("Last Job %d did not terminate normally. JobStatus=%c\n"), - JobId, verify_jr.JobStatus); + verify_jobid, verify_jr.JobStatus); goto bail_out; } Jmsg(jcr, M_INFO, 0, _("Verifying against JobId=%d Job=%s\n"), @@ -201,10 +203,10 @@ int do_verify(JCR *jcr) jcr->sd_auth_key = bstrdup("dummy"); /* dummy Storage daemon key */ } - if (jcr->JobLevel == L_VERIFY_DISK_TO_CATALOG && - jcr->job->verify_job) { - jcr->fileset = jcr->job->verify_job->fileset; + if (jcr->JobLevel == L_VERIFY_DISK_TO_CATALOG && jcr->job->verify_job) { + jcr->fileset = jcr->job->verify_job->fileset; } + Dmsg2(100, "ClientId=%u JobLevel=%c\n", verify_jr.ClientId, jcr->JobLevel); jcr->verify_jr = &verify_jr; /* @@ -313,17 +315,19 @@ int do_verify(JCR *jcr) Dmsg0(10, "Verify level=catalog\n"); jcr->sd_msg_thread_done = true; /* no SD msg thread, so it is done */ jcr->SDJobStatus = JS_Terminated; - get_attributes_and_compare_to_catalog(jcr, JobId); + get_attributes_and_compare_to_catalog(jcr, verify_jobid); break; case L_VERIFY_VOLUME_TO_CATALOG: Dmsg0(10, "Verify level=volume\n"); - get_attributes_and_compare_to_catalog(jcr, JobId); + get_attributes_and_compare_to_catalog(jcr, verify_jobid); break; case L_VERIFY_DISK_TO_CATALOG: Dmsg0(10, "Verify level=disk_to_catalog\n"); - get_attributes_and_compare_to_catalog(jcr, JobId); + jcr->sd_msg_thread_done = true; /* no SD msg thread, so it is done */ + jcr->SDJobStatus = JS_Terminated; + get_attributes_and_compare_to_catalog(jcr, verify_jobid); break; case L_VERIFY_INIT: @@ -340,7 +344,6 @@ int do_verify(JCR *jcr) } stat = wait_for_job_termination(jcr); - verify_cleanup(jcr, stat); return 1; @@ -361,6 +364,7 @@ static void verify_cleanup(JCR *jcr, int TermCode) char *term_msg; int msg_type; JobId_t JobId; + char *Name; // Dmsg1(000, "Enter verify_cleanup() TermCod=%d\n", TermCode); @@ -386,11 +390,17 @@ static void verify_cleanup(JCR *jcr, int TermCode) break; default: term_msg = term_code; - sprintf(term_code, _("Inappropriate term code: %c\n"), TermCode); + bsnprintf(term_code, sizeof(term_code), + _("Inappropriate term code: %d %c\n"), TermCode, TermCode); break; } bstrftime(sdt, sizeof(sdt), jcr->jr.StartTime); bstrftime(edt, sizeof(edt), jcr->jr.EndTime); + if (jcr->job->verify_job) { + Name = jcr->job->verify_job->hdr.name; + } else { + Name = ""; + } jobstatus_to_ascii(jcr->FDJobStatus, fd_term_msg, sizeof(fd_term_msg)); if (jcr->JobLevel == L_VERIFY_VOLUME_TO_CATALOG) { @@ -401,6 +411,8 @@ Job: %s\n\ FileSet: %s\n\ Verify Level: %s\n\ Client: %s\n\ +Verify JobId: %d\n\ +Verify Job: %s\n\ Start time: %s\n\ End time: %s\n\ Files Examined: %s\n\ @@ -414,6 +426,8 @@ Termination: %s\n\n"), jcr->fileset->hdr.name, level_to_str(jcr->JobLevel), jcr->client->hdr.name, + jcr->verify_jr->JobId, + Name, sdt, edt, edit_uint64_with_commas(jcr->JobFiles, ec1), @@ -428,6 +442,8 @@ Job: %s\n\ FileSet: %s\n\ Verify Level: %s\n\ Client: %s\n\ +Verify JobId: %d\n\ +Verify Job: %s\n\ Start time: %s\n\ End time: %s\n\ Files Examined: %s\n\ @@ -440,6 +456,8 @@ Termination: %s\n\n"), jcr->fileset->hdr.name, level_to_str(jcr->JobLevel), jcr->client->hdr.name, + jcr->verify_jr->JobId, + Name, sdt, edt, edit_uint64_with_commas(jcr->JobFiles, ec1), @@ -493,7 +511,7 @@ int get_attributes_and_compare_to_catalog(JCR *jcr, JobId_t JobId) fname = check_pool_memory_size(fname, fd->msglen); jcr->fname = check_pool_memory_size(jcr->fname, fd->msglen); - Dmsg1(400, "Atts+SIG=%s\n", fd->msg); + Dmsg1(200, "Atts+SIG=%s\n", fd->msg); if ((len = sscanf(fd->msg, "%ld %d %100s", &file_index, &stream, fname)) != 3) { Jmsg3(jcr, M_FATAL, 0, _("birdJobFiles, STREAM_UNIX_ATTRIBUTES, ff_pkt->VerifyOpts, ff_pkt->fname, 0, attribs, 0, ff_pkt->link, 0); + } else if (ff_pkt->type == FT_DIR) { + /* Here link is the canonical filename (i.e. with trailing slash) */ + stat = bnet_fsend(dir,"%d %d %s %s%c%s%c%c", jcr->JobFiles, + STREAM_UNIX_ATTRIBUTES, ff_pkt->VerifyOpts, ff_pkt->link, + 0, attribs, 0, 0); } else { stat = bnet_fsend(dir,"%d %d %s %s%c%s%c%c", jcr->JobFiles, STREAM_UNIX_ATTRIBUTES, ff_pkt->VerifyOpts, ff_pkt->fname, @@ -199,6 +204,7 @@ static int verify_file(FF_PKT *ff_pkt, void *pkt) while ((n=bread(&bfd, jcr->big_buf, jcr->buf_size)) > 0) { MD5Update(&md5c, ((unsigned char *) jcr->big_buf), n); jcr->JobBytes += n; + jcr->ReadBytes += n; } if (n < 0) { Jmsg(jcr, M_ERROR, -1, _("Error reading file %s: ERR=%s\n"), @@ -218,6 +224,7 @@ static int verify_file(FF_PKT *ff_pkt, void *pkt) while ((n=bread(&bfd, jcr->big_buf, jcr->buf_size)) > 0) { SHA1Update(&sha1c, ((unsigned char *) jcr->big_buf), n); jcr->JobBytes += n; + jcr->ReadBytes += n; } if (n < 0) { Jmsg(jcr, M_ERROR, -1, _("Error reading file %s: ERR=%s\n"), diff --git a/bacula/src/version.h b/bacula/src/version.h index 9a35e2d15a..331206d2b8 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -1,9 +1,9 @@ /* */ #undef VERSION -#define VERSION "1.32b" +#define VERSION "1.32c" #define VSTRING "1" -#define BDATE "14 Oct 2003" -#define LSMDATE "14Oct03" +#define BDATE "18 Oct 2003" +#define LSMDATE "18Oct03" /* Debug flags */ #undef DEBUG -- 2.39.5