From: Kern Sibbald Date: Mon, 31 Mar 2003 18:49:56 +0000 (+0000) Subject: Add verbose, Uname info, better Device error msg X-Git-Tag: Release-1.30~61 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=50d74002068ec5d9470c246412c004125bfb2e05;p=bacula%2Fbacula Add verbose, Uname info, better Device error msg git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@406 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/platforms/redhat/.cvsignore b/bacula/platforms/redhat/.cvsignore index d79558d1ed..adc959fa0f 100644 --- a/bacula/platforms/redhat/.cvsignore +++ b/bacula/platforms/redhat/.cvsignore @@ -6,3 +6,8 @@ bacula.spec bacula.sqlite.rh8.spec bacula.client.rh8.spec bacula.mysql.rh8.spec +bacula.sqlite.rh7.spec +bacula.client.rh7.spec +bacula.mysql.rh7.spec + + diff --git a/bacula/scripts/bacula.png b/bacula/scripts/bacula.png index a71fd2232b..bb6d67c798 100644 Binary files a/bacula/scripts/bacula.png and b/bacula/scripts/bacula.png differ diff --git a/bacula/src/cats/protos.h b/bacula/src/cats/protos.h index 4a5080a78b..d0cc24cb15 100644 --- a/bacula/src/cats/protos.h +++ b/bacula/src/cats/protos.h @@ -93,6 +93,7 @@ void db_list_client_records(void *jcr, B_DB *mdb, DB_LIST_HANDLER *sendit, void /* update.c */ int db_update_job_start_record(void *jcr, B_DB *db, JOB_DBR *jr); int db_update_job_end_record(void *jcr, B_DB *db, JOB_DBR *jr); +int db_update_client_record(void *jcr, B_DB *mdb, CLIENT_DBR *cr); int db_update_pool_record(void *jcr, B_DB *db, POOL_DBR *pr); int db_update_media_record(void *jcr, B_DB *db, MEDIA_DBR *mr); int db_add_SIG_to_file_record(void *jcr, B_DB *mdb, FileId_t FileId, char *SIG, int type); diff --git a/bacula/src/cats/sql.c b/bacula/src/cats/sql.c index 408a3f6900..e40b3c2114 100644 --- a/bacula/src/cats/sql.c +++ b/bacula/src/cats/sql.c @@ -88,6 +88,9 @@ QueryDB(char *file, int line, void *jcr, B_DB *mdb, char *cmd) if (sql_query(mdb, cmd)) { m_msg(file, line, &mdb->errmsg, _("query %s failed:\n%s\n"), cmd, sql_strerror(mdb)); j_msg(file, line, jcr, M_FATAL, 0, "%s", mdb->errmsg); + if (verbose) { + j_msg(file, line, jcr, M_INFO, 0, "%s\n", cmd); + } return 0; } mdb->result = sql_store_result(mdb); @@ -106,6 +109,9 @@ InsertDB(char *file, int line, void *jcr, B_DB *mdb, char *cmd) if (sql_query(mdb, cmd)) { m_msg(file, line, &mdb->errmsg, _("insert %s failed:\n%s\n"), cmd, sql_strerror(mdb)); j_msg(file, line, jcr, M_FATAL, 0, "%s", mdb->errmsg); + if (verbose) { + j_msg(file, line, jcr, M_INFO, 0, "%s\n", cmd); + } return 0; } if (mdb->have_insert_id) { @@ -115,7 +121,7 @@ InsertDB(char *file, int line, void *jcr, B_DB *mdb, char *cmd) } if (mdb->num_rows != 1) { char ed1[30]; - m_msg(file, line, &mdb->errmsg, _("Insertion problem: affect_rows=%s\n"), + m_msg(file, line, &mdb->errmsg, _("Insertion problem: affected_rows=%s\n"), edit_uint64(mdb->num_rows, ed1)); return 0; } @@ -134,7 +140,9 @@ UpdateDB(char *file, int line, void *jcr, B_DB *mdb, char *cmd) if (sql_query(mdb, cmd)) { m_msg(file, line, &mdb->errmsg, _("update %s failed:\n%s\n"), cmd, sql_strerror(mdb)); j_msg(file, line, jcr, M_ERROR, 0, "%s", mdb->errmsg); - j_msg(file, line, jcr, M_ERROR, 0, "%s\n", cmd); + if (verbose) { + j_msg(file, line, jcr, M_INFO, 0, "%s\n", cmd); + } return 0; } mdb->num_rows = sql_affected_rows(mdb); @@ -160,6 +168,9 @@ DeleteDB(char *file, int line, void *jcr, B_DB *mdb, char *cmd) if (sql_query(mdb, cmd)) { m_msg(file, line, &mdb->errmsg, _("delete %s failed:\n%s\n"), cmd, sql_strerror(mdb)); j_msg(file, line, jcr, M_ERROR, 0, "%s", mdb->errmsg); + if (verbose) { + j_msg(file, line, jcr, M_INFO, 0, "%s\n", cmd); + } return -1; } mdb->changes++; diff --git a/bacula/src/cats/sql_update.c b/bacula/src/cats/sql_update.c index ff31234a5a..eea89901cc 100644 --- a/bacula/src/cats/sql_update.c +++ b/bacula/src/cats/sql_update.c @@ -150,6 +150,32 @@ VolSessionTime=%u, PoolId=%u, FileSetId=%u, JobTDate=%s WHERE JobId=%u", } +int +db_update_client_record(void *jcr, B_DB *mdb, CLIENT_DBR *cr) +{ + int stat; + char ed1[50], ed2[50]; + + db_lock(mdb); + if (!db_create_client_record(jcr, mdb, cr)) { + db_unlock(mdb); + return 0; + } + + Mmsg(&mdb->cmd, +"UPDATE Client SET AutoPrune=%d,FileRetention=%s,JobRetention=%s," +"Uname='%s' WHERE Name='%s'", + cr->AutoPrune, + edit_uint64(cr->FileRetention, ed1), + edit_uint64(cr->JobRetention, ed2), + cr->Uname, cr->Name); + + stat = UPDATE_DB(jcr, mdb, mdb->cmd); + db_unlock(mdb); + return stat; +} + + int db_update_pool_record(void *jcr, B_DB *mdb, POOL_DBR *pr) { diff --git a/bacula/src/console/console.c b/bacula/src/console/console.c index c3341f71b8..1c6cf1d956 100644 --- a/bacula/src/console/console.c +++ b/bacula/src/console/console.c @@ -136,12 +136,12 @@ static void read_and_process_input(FILE *input, BSOCK *UA_sock) while ((stat = bnet_recv(UA_sock)) >= 0) { if (at_prompt) { if (!stop) { - fprintf(output, "\n"); + putc('\n', output); } at_prompt = FALSE; } if (!stop) { - fprintf(output, "%s", UA_sock->msg); + fputs(UA_sock->msg, output); } } if (!stop) { @@ -179,15 +179,17 @@ int main(int argc, char *argv[]) while ((ch = getopt(argc, argv, "bc:d:r:st?")) != -1) { switch (ch) { case 'c': /* configuration file */ - if (configfile != NULL) + if (configfile != NULL) { free(configfile); + } configfile = bstrdup(optarg); break; case 'd': debug_level = atoi(optarg); - if (debug_level <= 0) + if (debug_level <= 0) { debug_level = 1; + } break; case 's': /* turn off signals */ @@ -233,7 +235,7 @@ int main(int argc, char *argv[]) } UnlockRes(); if (ndir == 0) { - Emsg1(M_ABORT, 0, "No Director resource defined in %s\n\ + Emsg1(M_ERROR_TERM, 0, "No Director resource defined in %s\n\ Without that I don't how to speak to the Director :-(\n", configfile); } @@ -286,7 +288,7 @@ try_again: } jcr.dir_bsock = UA_sock; if (!authenticate_director(&jcr, dir)) { - fprintf(stderr, "ERR: %s", UA_sock->msg); + fprintf(stderr, "ERR=%s", UA_sock->msg); terminate_console(0); return 1; } @@ -310,8 +312,9 @@ static void terminate_console(int sig) { static int already_here = FALSE; - if (already_here) /* avoid recursive temination problems */ + if (already_here) { /* avoid recursive temination problems */ exit(1); + } already_here = TRUE; exit(0); } @@ -387,7 +390,7 @@ get_cmd(FILE *input, char *prompt, BSOCK *sock, int sec) { int len; if (!stop) { - fprintf(output, prompt); + puts(prompt, output); fflush(output); } again: diff --git a/bacula/src/dird/backup.c b/bacula/src/dird/backup.c index 937efbe6a7..b854ecd511 100644 --- a/bacula/src/dird/backup.c +++ b/bacula/src/dird/backup.c @@ -210,7 +210,7 @@ int do_backup(JCR *jcr) jcr->store->SDDport = jcr->store->SDport; } bnet_fsend(fd, storaddr, jcr->store->address, jcr->store->SDDport); - if (!response(fd, OKstore, "Storage")) { + if (!response(fd, OKstore, "Storage", 1)) { goto bail_out; } @@ -234,13 +234,13 @@ int do_backup(JCR *jcr) goto bail_out; } Dmsg1(120, ">filed: %s", fd->msg); - if (!response(fd, OKlevel, "Level")) { + if (!response(fd, OKlevel, "Level", 1)) { goto bail_out; } /* Send backup command */ bnet_fsend(fd, backupcmd); - if (!response(fd, OKbackup, "backup")) { + if (!response(fd, OKbackup, "backup", 1)) { goto bail_out; } diff --git a/bacula/src/dird/dird.c b/bacula/src/dird/dird.c index 0bb4db06f3..a8ced2eae9 100644 --- a/bacula/src/dird/dird.c +++ b/bacula/src/dird/dird.c @@ -71,6 +71,7 @@ static void usage() " -s no signals\n" " -t test - read configuration and exit\n" " -u userid\n" +" -v verbose user messages\n" " -? print this message.\n" "\n")); @@ -98,7 +99,7 @@ int main (int argc, char *argv[]) daemon_start_time = time(NULL); memset(&last_job, 0, sizeof(last_job)); - while ((ch = getopt(argc, argv, "c:d:fg:r:stu:?")) != -1) { + while ((ch = getopt(argc, argv, "c:d:fg:r:stu:v?")) != -1) { switch (ch) { case 'c': /* specify config file */ if (configfile != NULL) { @@ -144,6 +145,10 @@ int main (int argc, char *argv[]) uid = optarg; break; + case 'v': /* verbose */ + verbose++; + break; + case '?': default: usage(); diff --git a/bacula/src/dird/fd_cmds.c b/bacula/src/dird/fd_cmds.c index f565c1360e..fed2e5ae56 100644 --- a/bacula/src/dird/fd_cmds.c +++ b/bacula/src/dird/fd_cmds.c @@ -100,10 +100,20 @@ int connect_to_file_daemon(JCR *jcr, int retry_interval, int max_retry_time, set_jcr_job_status(jcr, JS_ErrorTerminated); return 0; } else { - /***** ***FIXME***** update Client Uname */ + CLIENT_DBR cr; + memset(&cr, 0, sizeof(cr)); + bstrncpy(cr.Name, jcr->client->hdr.name, sizeof(cr.Name)); + cr.AutoPrune = jcr->client->AutoPrune; + cr.FileRetention = jcr->client->FileRetention; + cr.JobRetention = jcr->client->JobRetention; + bstrncpy(cr.Uname, fd->msg+strlen(OKjob)+1, sizeof(cr.Uname)); + if (!db_update_client_record(jcr, jcr->db, &cr)) { + Jmsg(jcr, M_WARNING, 0, _("Error updating Client record. ERR=%s\n"), + db_strerror(jcr->db)); + } } } else { - Jmsg(jcr, M_FATAL, 0, _("num_names; j++) { p = ie->name_list[j]; - switch (*p++) { + switch (*p) { case '|': fd->msg = edit_job_codes(jcr, fd->msg, p, ""); bpipe = open_bpipe(fd->msg, 0, "r"); @@ -199,6 +209,9 @@ static int send_list(JCR *jcr, int list) } fclose(ffd); break; + case '\\': + p++; /* skip over \ */ + /* Note, fall through wanted */ default: if (ie->num_opts) { pm_strcpy(&fd->msg, ie->opts_list[0]->opts); @@ -206,7 +219,7 @@ static int send_list(JCR *jcr, int list) } else { pm_strcpy(&fd->msg, "0 "); } - pm_strcat(&fd->msg, ie->name_list[j]); + pm_strcat(&fd->msg, p); Dmsg1(100, "Inc/Exc name=%s\n", fd->msg); fd->msglen = strlen(fd->msg); if (!bnet_send(fd)) { @@ -219,10 +232,10 @@ static int send_list(JCR *jcr, int list) } bnet_sig(fd, BNET_EOD); /* end of data */ if (list == INC_LIST) { - if (!response(fd, OKinc, "Include")) { + if (!response(fd, OKinc, "Include", 1)) { goto bail_out; } - } else if (!response(fd, OKexc, "Exclude")) { + } else if (!response(fd, OKexc, "Exclude", 1)) { goto bail_out; } return 1; diff --git a/bacula/src/dird/getmsg.c b/bacula/src/dird/getmsg.c index 68b6a4a3df..0676e1d092 100644 --- a/bacula/src/dird/getmsg.c +++ b/bacula/src/dird/getmsg.c @@ -207,7 +207,7 @@ static char *find_msg_start(char *msg) * Returns: 0 on failure * 1 on success */ -int response(BSOCK *fd, char *resp, char *cmd) +int response(BSOCK *fd, char *resp, char *cmd, int prtmsg) { int n; @@ -219,11 +219,13 @@ int response(BSOCK *fd, char *resp, char *cmd) if (strcmp(fd->msg, resp) == 0) { return 1; } - Emsg3(M_FATAL, 0, _("msg); + if (prtmsg) { + Emsg3(M_FATAL, 0, _("FD gave bad response to %s command: wanted %s got: %s\n"), + cmd, resp, fd->msg); + } return 0; } - Emsg2(M_FATAL, 0, _("client->hdr.name); + bstrncpy(cr.Name, jcr->client->hdr.name, sizeof(cr.Name)); cr.AutoPrune = jcr->client->AutoPrune; cr.FileRetention = jcr->client->FileRetention; cr.JobRetention = jcr->client->JobRetention; @@ -395,7 +395,7 @@ int get_or_create_client_record(JCR *jcr) jcr->client_name = get_memory(strlen(jcr->client->hdr.name) + 1); strcpy(jcr->client_name, jcr->client->hdr.name); if (!db_create_client_record(jcr, jcr->db, &cr)) { - Jmsg(jcr, M_FATAL, 0, _("Could not create Client record. ERR=%s"), + Jmsg(jcr, M_FATAL, 0, _("Could not create Client record. ERR=%s\n"), db_strerror(jcr->db)); return 0; } @@ -514,6 +514,9 @@ void dird_free_jcr(JCR *jcr) if (jcr->RestoreBootstrap) { free(jcr->RestoreBootstrap); } + if (jcr->client_uname) { + free_pool_memory(jcr->client_uname); + } Dmsg0(200, "End dird free_jcr\n"); } diff --git a/bacula/src/dird/msgchan.c b/bacula/src/dird/msgchan.c index 4b3c8f012d..cdaad12cff 100644 --- a/bacula/src/dird/msgchan.c +++ b/bacula/src/dird/msgchan.c @@ -156,8 +156,14 @@ int start_storage_daemon_job(JCR *jcr) device_name_len + media_type_len + pool_type_len + pool_name_len); bnet_fsend(sd, use_device, device_name, media_type, pool_name, pool_type); Dmsg1(110, ">stored: %s", sd->msg); - status = response(sd, OK_device, "Use Device"); - + status = response(sd, OK_device, "Use Device", 0); + if (!status) { + pm_strcpy(&pool_type, sd->msg); /* save message */ + Jmsg(jcr, M_FATAL, 0, _("\n" + " Storage daemon didn't accept Device \"%s\" because:\n %s"), + device_name, pool_type/* sd->msg */); + } + free_memory(device_name); free_memory(media_type); free_memory(pool_name); diff --git a/bacula/src/dird/protos.h b/bacula/src/dird/protos.h index ef70fcbe18..d4178c1cf8 100644 --- a/bacula/src/dird/protos.h +++ b/bacula/src/dird/protos.h @@ -71,7 +71,7 @@ extern int connect_to_storage_daemon(JCR *jcr, int retry_interval, extern int start_storage_daemon_job(JCR *jcr); extern int start_storage_daemon_message_thread(JCR *jcr); extern int32_t bget_msg(BSOCK *bs, int type); -extern int response(BSOCK *fd, char *resp, char *cmd); +extern int response(BSOCK *fd, char *resp, char *cmd, int prtmsg); extern void wait_for_storage_daemon_termination(JCR *jcr); /* newvol.c */ diff --git a/bacula/src/dird/restore.c b/bacula/src/dird/restore.c index a3a9dd686c..5ec84e2c1e 100644 --- a/bacula/src/dird/restore.c +++ b/bacula/src/dird/restore.c @@ -192,7 +192,7 @@ int do_restore(JCR *jcr) } bnet_fsend(fd, storaddr, jcr->store->address, jcr->store->SDDport); Dmsg1(6, "dird>filed: %s\n", fd->msg); - if (!response(fd, OKstore, "Storage")) { + if (!response(fd, OKstore, "Storage", 1)) { restore_cleanup(jcr, JS_ErrorTerminated); return 0; } @@ -219,7 +219,7 @@ int do_restore(JCR *jcr) rjr.VolSessionId, rjr.VolSessionTime, rjr.StartFile, rjr.EndFile, rjr.StartBlock, rjr.EndBlock); - if (!response(fd, OKsession, "Session")) { + if (!response(fd, OKsession, "Session", 1)) { restore_cleanup(jcr, JS_ErrorTerminated); return 0; } @@ -246,7 +246,7 @@ int do_restore(JCR *jcr) bnet_fsend(fd, restorecmd, replace, where); unbash_spaces(where); - if (!response(fd, OKrestore, "Restore")) { + if (!response(fd, OKrestore, "Restore", 1)) { restore_cleanup(jcr, JS_ErrorTerminated); return 0; } @@ -379,7 +379,7 @@ static int send_bootstrap_file(JCR *jcr) } bnet_sig(fd, BNET_EOD); fclose(bs); - if (!response(fd, OKbootstrap, "Bootstrap")) { + if (!response(fd, OKbootstrap, "Bootstrap", 1)) { set_jcr_job_status(jcr, JS_ErrorTerminated); return 0; } diff --git a/bacula/src/dird/verify.c b/bacula/src/dird/verify.c index f365a2796d..d42d91bfc9 100644 --- a/bacula/src/dird/verify.c +++ b/bacula/src/dird/verify.c @@ -214,7 +214,7 @@ int do_verify(JCR *jcr) jcr->store->SDDport = jcr->store->SDport; } bnet_fsend(fd, storaddr, jcr->store->address, jcr->store->SDDport); - if (!response(fd, OKstore, "Storage")) { + if (!response(fd, OKstore, "Storage", 1)) { goto bail_out; } /* @@ -226,7 +226,7 @@ int do_verify(JCR *jcr) jr.VolSessionId, jr.VolSessionTime, jr.StartFile, jr.EndFile, jr.StartBlock, jr.EndBlock); - if (!response(fd, OKsession, "Session")) { + if (!response(fd, OKsession, "Session", 1)) { goto bail_out; } level = "volume"; @@ -243,7 +243,7 @@ int do_verify(JCR *jcr) * Send verify command/level to File daemon */ bnet_fsend(fd, verifycmd, level); - if (!response(fd, OKverify, "Verify")) { + if (!response(fd, OKverify, "Verify", 1)) { goto bail_out; } diff --git a/bacula/src/filed/filed.c b/bacula/src/filed/filed.c index df71130740..7091cf40cb 100644 --- a/bacula/src/filed/filed.c +++ b/bacula/src/filed/filed.c @@ -67,6 +67,7 @@ static void usage() " -s no signals (for debugging)\n" " -t test configuration file and exit\n" " -u userid\n" +" -v verbose user messages\n" " -? print this message.\n" "\n")); exit(1); @@ -97,7 +98,7 @@ int main (int argc, char *argv[]) memset(&last_job, 0, sizeof(last_job)); - while ((ch = getopt(argc, argv, "c:d:fg:istu:?")) != -1) { + while ((ch = getopt(argc, argv, "c:d:fg:istu:v?")) != -1) { switch (ch) { case 'c': /* configuration file */ if (configfile != NULL) { @@ -136,6 +137,10 @@ int main (int argc, char *argv[]) uid = optarg; break; + case 'v': /* verbose */ + verbose++; + break; + case '?': default: usage(); diff --git a/bacula/src/filed/job.c b/bacula/src/filed/job.c index a451120d30..99947a7f00 100644 --- a/bacula/src/filed/job.c +++ b/bacula/src/filed/job.c @@ -293,6 +293,25 @@ static int job_cmd(JCR *jcr) return bnet_fsend(dir, OKjob); } +#define INC_LIST 0 +#define EXC_LIST 1 + +static void add_fname_to_list(JCR *jcr, char *fname, int list) +{ + char *p; + if (list == INC_LIST) { + add_fname_to_include_list((FF_PKT *)jcr->ff, 1, fname); + } else { + /* Skip leading options -- currently ignored */ + for (p=fname; *p && *p != ' '; p++) + { } + /* Skip spaces */ + for ( ; *p && *p == ' '; p++) + { } + add_fname_to_exclude_list((FF_PKT *)jcr->ff, p); + } +} + /* * * Get list of files/directories to include from Director @@ -303,10 +322,10 @@ static int include_cmd(JCR *jcr) BSOCK *dir = jcr->dir_bsock; while (bnet_recv(dir) >= 0) { - dir->msg[dir->msglen] = 0; - strip_trailing_junk(dir->msg); - Dmsg1(010, "include file: %s\n", dir->msg); - add_fname_to_include_list((FF_PKT *)jcr->ff, 1, dir->msg); + dir->msg[dir->msglen] = 0; + strip_trailing_junk(dir->msg); + Dmsg1(010, "include file: %s\n", dir->msg); + add_fname_to_list(jcr, dir->msg, INC_LIST); } return bnet_fsend(dir, OKinc); @@ -319,19 +338,12 @@ static int include_cmd(JCR *jcr) static int exclude_cmd(JCR *jcr) { BSOCK *dir = jcr->dir_bsock; - char *p; while (bnet_recv(dir) >= 0) { - dir->msg[dir->msglen] = 0; - strip_trailing_junk(dir->msg); - /* Skip leading options -- currently ignored */ - for (p=dir->msg; *p && *p != ' '; p++) - { } - /* Skip spaces */ - for ( ; *p && *p == ' '; p++) - { } - add_fname_to_exclude_list((FF_PKT *)jcr->ff, p); - Dmsg1(110, "msg); + dir->msg[dir->msglen] = 0; + strip_trailing_junk(dir->msg); + add_fname_to_list(jcr, dir->msg, EXC_LIST); + Dmsg1(110, "msg); } return bnet_fsend(dir, OKexc); diff --git a/bacula/src/lib/message.c b/bacula/src/lib/message.c index d4caf14e03..762bdc255d 100755 --- a/bacula/src/lib/message.c +++ b/bacula/src/lib/message.c @@ -34,7 +34,8 @@ #define FULL_LOCATION 1 /* set for file:line in Debug messages */ char *working_directory = NULL; /* working directory path stored here */ -int debug_level = 5; /* debug level */ +int verbose = 0; /* increase User messages */ +int debug_level = 0; /* debug level */ time_t daemon_start_time = 0; /* Daemon start time */ char my_name[20]; /* daemon name is stored here */ diff --git a/bacula/src/lib/message.h b/bacula/src/lib/message.h index 4f8200e0b3..2d4ae0bef9 100644 --- a/bacula/src/lib/message.h +++ b/bacula/src/lib/message.h @@ -106,6 +106,7 @@ void e_msg(char *file, int line, int type, int level, char *fmt,...); void Jmsg(void *vjcr, int type, int level, char *fmt,...); extern int debug_level; +extern int verbose; extern char my_name[]; extern char *working_directory; extern time_t daemon_start_time; diff --git a/bacula/src/stored/bcopy.c b/bacula/src/stored/bcopy.c index 69dc4ee1f5..11b5521532 100644 --- a/bacula/src/stored/bcopy.c +++ b/bacula/src/stored/bcopy.c @@ -41,7 +41,6 @@ static JCR *in_jcr; /* input jcr */ static JCR *out_jcr; /* output jcr */ static BSR *bsr = NULL; static char *wd = "/tmp"; -static int verbose = 0; static int list_records = 0; static uint32_t records = 0; static uint32_t jobs = 0; diff --git a/bacula/src/stored/bls.c b/bacula/src/stored/bls.c index dfbd6fed5c..e0c8cfa929 100644 --- a/bacula/src/stored/bls.c +++ b/bacula/src/stored/bls.c @@ -39,7 +39,6 @@ static DEVICE *dev; static int dump_label = FALSE; static int list_blocks = FALSE; static int list_jobs = FALSE; -static int verbose = 0; static DEV_RECORD *rec; static DEV_BLOCK *block; static JCR *jcr; diff --git a/bacula/src/stored/bscan.c b/bacula/src/stored/bscan.c index c185e03cca..44b28490e4 100644 --- a/bacula/src/stored/bscan.c +++ b/bacula/src/stored/bscan.c @@ -81,7 +81,6 @@ static char *db_name = "bacula"; static char *db_user = "bacula"; static char *db_password = ""; static char *wd = NULL; -static int verbose = 0; static int update_db = 0; static int update_vol_info = 0; static int list_records = 0; diff --git a/bacula/src/stored/btape.c b/bacula/src/stored/btape.c index ecb16f2506..bd1b27a04f 100644 --- a/bacula/src/stored/btape.c +++ b/bacula/src/stored/btape.c @@ -82,7 +82,6 @@ static uint64_t VolBytes; static time_t now; static double kbs; static long file_index; -static int verbose = 0; static int end_of_tape = 0; static uint32_t LastBlock = 0; static uint32_t eot_block; diff --git a/bacula/src/stored/job.c b/bacula/src/stored/job.c index 432238ee7b..0481e25866 100644 --- a/bacula/src/stored/job.c +++ b/bacula/src/stored/job.c @@ -44,7 +44,7 @@ static char use_device[] = "use device=%s media_type=%s pool_name=%s pool_type=% /* Responses sent to Director daemon */ static char OKjob[] = "3000 OK Job SDid=%u SDtime=%u Authorization=%s\n"; static char OK_device[] = "3000 OK use device\n"; -static char NO_device[] = "3914 Device %s does not exist\n"; +static char NO_device[] = "3914 Device \"%s\" not in SD Device resources.\n"; static char BAD_use[] = "3913 Bad use command: %s\n"; static char BAD_job[] = "3915 Bad Job command: %s\n"; @@ -297,10 +297,19 @@ static int use_device_cmd(JCR *jcr) } } UnlockRes(); - Jmsg(jcr, M_FATAL, 0, _("Requested device %s not found. Cannot continue.\n"), + if (verbose) { + unbash_spaces(dir->msg); + Jmsg(jcr, M_INFO, 0, _("Failed command: %s\n"), dir->msg); + } + Jmsg(jcr, M_FATAL, 0, _("\n" + " Device \"%s\" requested by Dir not found in SD Device resources.\n"), dev_name); bnet_fsend(dir, NO_device, dev_name); } else { + if (verbose) { + unbash_spaces(dir->msg); + Jmsg(jcr, M_INFO, 0, _("Failed command: %s\n"), dir->msg); + } Jmsg(jcr, M_FATAL, 0, _("storemsg); bnet_fsend(dir, BAD_use, dir->msg); } diff --git a/bacula/src/stored/read_record.c b/bacula/src/stored/read_record.c index 625e6b736e..7658784174 100644 --- a/bacula/src/stored/read_record.c +++ b/bacula/src/stored/read_record.c @@ -43,7 +43,6 @@ int read_records(JCR *jcr, DEVICE *dev, DEV_BLOCK *block; DEV_RECORD *rec; uint32_t record, num_files = 0; - int verbose = FALSE; int ok = TRUE; int done = FALSE; SESSION_LABEL sessrec; diff --git a/bacula/src/stored/stored.c b/bacula/src/stored/stored.c index 3b253ca93c..615d941962 100644 --- a/bacula/src/stored/stored.c +++ b/bacula/src/stored/stored.c @@ -71,6 +71,7 @@ static void usage() " -s no signals (for debugging)\n" " -t test - read config and exit\n" " -u userid\n" +" -v verbose user messages\n" " -? print this message.\n" "\n")); exit(1); @@ -105,7 +106,7 @@ int main (int argc, char *argv[]) Emsg1(M_ABORT, 0, "Tape block size (%d) is not a power of 2\n", TAPE_BSIZE); } - while ((ch = getopt(argc, argv, "c:d:fg:stu:?")) != -1) { + while ((ch = getopt(argc, argv, "c:d:fg:stu:v?")) != -1) { switch (ch) { case 'c': /* configuration file */ if (configfile != NULL) { @@ -141,6 +142,10 @@ int main (int argc, char *argv[]) uid = optarg; break; + case 'v': /* verbose */ + verbose++; + break; + case '?': default: usage(); diff --git a/bacula/src/tools/dbcheck.c b/bacula/src/tools/dbcheck.c index 923bc5a0cc..35c06a9ad2 100644 --- a/bacula/src/tools/dbcheck.c +++ b/bacula/src/tools/dbcheck.c @@ -52,7 +52,6 @@ typedef struct s_name_ctx { /* Global variables */ static int fix = FALSE; static int batch = FALSE; -static int verbose = FALSE; static B_DB *db; static ID_LIST id_list; static NAME_LIST name_list;