From: Kern Sibbald Date: Thu, 3 Apr 2003 13:15:22 +0000 (+0000) Subject: Fix new bug in newvol X-Git-Tag: Release-1.30~55 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=115ff3103ba53c221405c63110787ec64067e788;p=bacula%2Fbacula Fix new bug in newvol git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@412 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/cats/mysql.c b/bacula/src/cats/mysql.c index 47f965a0b2..731107513b 100644 --- a/bacula/src/cats/mysql.c +++ b/bacula/src/cats/mysql.c @@ -136,7 +136,7 @@ db_open_database(void *jcr, B_DB *mdb) mdb->db_name, /* database name */ mdb->db_port, /* default port */ mdb->db_socket, /* default = socket */ - 0); /* flags = none */ + CLIENT_FOUND_ROWS); /* flags */ /* If no connect, try once more incase it is a timing problem */ if (mdb->db == NULL) { diff --git a/bacula/src/cats/sql.c b/bacula/src/cats/sql.c index e40b3c2114..0af5969f20 100644 --- a/bacula/src/cats/sql.c +++ b/bacula/src/cats/sql.c @@ -123,6 +123,9 @@ InsertDB(char *file, int line, void *jcr, B_DB *mdb, char *cmd) char ed1[30]; m_msg(file, line, &mdb->errmsg, _("Insertion problem: affected_rows=%s\n"), edit_uint64(mdb->num_rows, ed1)); + if (verbose) { + j_msg(file, line, jcr, M_INFO, 0, "%s\n", cmd); + } return 0; } mdb->changes++; @@ -148,8 +151,11 @@ UpdateDB(char *file, int line, void *jcr, B_DB *mdb, char *cmd) mdb->num_rows = sql_affected_rows(mdb); if (mdb->num_rows != 1) { char ed1[30]; - m_msg(file, line, &mdb->errmsg, _("Update problem: affect_rows=%s\n"), + m_msg(file, line, &mdb->errmsg, _("Update problem: affected_rows=%s\n"), edit_uint64(mdb->num_rows, ed1)); + if (verbose) { + j_msg(file, line, jcr, M_INFO, 0, "%s\n", cmd); + } return 0; } mdb->changes++; diff --git a/bacula/src/dird/newvol.c b/bacula/src/dird/newvol.c index 1b1f277d61..6edcb250f5 100644 --- a/bacula/src/dird/newvol.c +++ b/bacula/src/dird/newvol.c @@ -76,7 +76,9 @@ _("Wanted to create Volume \"%s\", but it already exists. Trying again.\n"), tmr.VolumeName); continue; } - bstrncpy(mr->VolumeName, tmr.VolumeName, sizeof(mr->VolumeName)); + bstrncpy(mr->VolumeName, name, sizeof(mr->VolumeName)); + bstrncat(mr->VolumeName, num, sizeof(mr->VolumeName)); + break; /* Got good name */ } if (mr->VolumeName[0] == 0) { Jmsg(jcr, M_ERROR, 0, _("Too many failures. Giving up creating Volume.\n")); @@ -86,6 +88,7 @@ _("Wanted to create Volume \"%s\", but it already exists. Trying again.\n"), if (db_create_media_record(jcr, jcr->db, mr) && db_update_pool_record(jcr, jcr->db, &pr)) { db_unlock(jcr->db); + Jmsg(jcr, M_INFO, 0, _("Created new Volume \"%s\" in catalog.\n"), mr->VolumeName); Dmsg1(90, "Created new Volume=%s\n", mr->VolumeName); return 1; } else { diff --git a/bacula/src/dird/ua_cmds.c b/bacula/src/dird/ua_cmds.c index 23e77532bb..fd15a4ff05 100644 --- a/bacula/src/dird/ua_cmds.c +++ b/bacula/src/dird/ua_cmds.c @@ -47,6 +47,7 @@ extern char *list_pool; /* Imported functions */ extern int statuscmd(UAContext *ua, char *cmd); extern int listcmd(UAContext *ua, char *cmd); +extern int llistcmd(UAContext *ua, char *cmd); extern int showcmd(UAContext *ua, char *cmd); extern int messagescmd(UAContext *ua, char *cmd); extern int autodisplaycmd(UAContext *ua, char *cmd); @@ -66,6 +67,7 @@ static int deletecmd(UAContext *ua, char *cmd); static int usecmd(UAContext *ua, char *cmd), unmountcmd(UAContext *ua, char *cmd); static int labelcmd(UAContext *ua, char *cmd), mountcmd(UAContext *ua, char *cmd), updatecmd(UAContext *ua, char *cmd); static int versioncmd(UAContext *ua, char *cmd), automountcmd(UAContext *ua, char *cmd); +static int timecmd(UAContext *ua, char *cmd); static int update_volume(UAContext *ua); static int update_pool(UAContext *ua); static int delete_volume(UAContext *ua); @@ -85,6 +87,7 @@ static struct cmdstruct commands[] = { { N_("help"), helpcmd, _("print this command")}, { N_("label"), labelcmd, _("label a tape")}, { N_("list"), listcmd, _("list [pools | jobs | jobtotals | media | files job=]; from catalog")}, + { N_("llist"), llistcmd, _("full or long list like list command")}, { N_("messages"), messagescmd, _("messages")}, { N_("mount"), mountcmd, _("mount ")}, { N_("restore"), restorecmd, _("restore files")}, @@ -101,6 +104,7 @@ static struct cmdstruct commands[] = { { N_("version"), versioncmd, _("print Director version")}, { N_("quit"), quitcmd, _("quit")}, { N_("query"), querycmd, _("query catalog")}, + { N_("time"), timecmd, _("print current time")}, { N_("exit"), quitcmd, _("exit = quit")}, }; #define comsize (sizeof(commands)/sizeof(struct cmdstruct)) @@ -1157,6 +1161,20 @@ static int setdebugcmd(UAContext *ua, char *cmd) return 1; } +/* + * print time + */ +static int timecmd(UAContext *ua, char *cmd) +{ + char sdt[50]; + time_t ttime = time(NULL); + struct tm tm; + localtime_r(&ttime, &tm); + strftime(sdt, sizeof(sdt), "%d-%b-%Y %H:%M:%S", &tm); + bsendmsg(ua, "%s\n", sdt); + return 1; +} + /* diff --git a/bacula/src/dird/ua_output.c b/bacula/src/dird/ua_output.c index c60873c275..5d15c3f58b 100644 --- a/bacula/src/dird/ua_output.c +++ b/bacula/src/dird/ua_output.c @@ -46,6 +46,7 @@ extern brwlock_t con_lock; /* Imported functions */ /* Forward referenced functions */ +static int do_listcmd(UAContext *ua, char *cmd, int llist); /* @@ -189,7 +190,20 @@ int showcmd(UAContext *ua, char *cmd) * list clients - list clients * */ -int listcmd(UAContext *ua, char *cmd) + +/* Do long or full listing */ +int llistcmd(UAContext *ua, char *cmd) +{ + return do_listcmd(ua, cmd, 1); +} + +/* Do short or summary listing */ +int listcmd(UAContext *ua, char *cmd) +{ + return do_listcmd(ua, cmd, 0); +} + +static int do_listcmd(UAContext *ua, char *cmd, int llist) { POOLMEM *VolumeName; int jobid, n; diff --git a/bacula/src/stored/bscan.c b/bacula/src/stored/bscan.c index 44b28490e4..a1d04d4f6d 100644 --- a/bacula/src/stored/bscan.c +++ b/bacula/src/stored/bscan.c @@ -972,7 +972,7 @@ static int update_job_record(B_DB *db, JOB_DBR *jr, SESSION_LABEL *elabel, term_msg = _("*** Backup Error ***"); break; case JS_Cancelled: - term_msg = _("Backup Cancelled"); + term_msg = _("Backup Canceled"); break; default: term_msg = term_code; diff --git a/bacula/src/stored/mount.c b/bacula/src/stored/mount.c index 2e6a8c45b5..abedacf060 100644 --- a/bacula/src/stored/mount.c +++ b/bacula/src/stored/mount.c @@ -190,7 +190,7 @@ read_volume: if (!dir_get_volume_info(jcr, 1)) { Mmsg(&jcr->errmsg, _("Wanted Volume \"%s\".\n" " Actual Volume \"%s\" not acceptable because:\n" - " %s\n"), + " %s"), dev->VolCatInfo.VolCatName, dev->VolHdr.VolName, jcr->dir_bsock->msg); /* Restore desired volume name, note device info out of sync */ @@ -212,7 +212,7 @@ read_volume: Dmsg0(100, "!write_vol_label\n"); goto mount_next_vol; } - Jmsg(jcr, M_INFO, 0, _("Created Volume label %s on device %s.\n"), + Jmsg(jcr, M_INFO, 0, _("Labeled new Volume \"%s\" on device %s.\n"), jcr->VolumeName, dev_name(dev)); goto read_volume; /* read label we just wrote */ } @@ -302,10 +302,10 @@ mount_error: Dmsg0(200, "dir_update_vol_info. Set Append\n"); dir_update_volume_info(jcr, &dev->VolCatInfo, 1); /* indicate doing relabel */ if (recycle) { - Jmsg(jcr, M_INFO, 0, _("Recycled volume %s on device %s, all previous data lost.\n"), + Jmsg(jcr, M_INFO, 0, _("Recycled volume \"%s\" on device %s, all previous data lost.\n"), jcr->VolumeName, dev_name(dev)); } else { - Jmsg(jcr, M_INFO, 0, _("Wrote label to prelabeled Volume %s on device %s\n"), + Jmsg(jcr, M_INFO, 0, _("Wrote label to prelabeled Volume \"%s\" on device %s\n"), jcr->VolumeName, dev_name(dev)); } @@ -316,12 +316,12 @@ mount_error: * just now putting it into append mode. */ Dmsg0(200, "Device previously written, moving to end of data\n"); - Jmsg(jcr, M_INFO, 0, _("Volume %s previously written, moving to end of data.\n"), + Jmsg(jcr, M_INFO, 0, _("Volume \"%s\" previously written, moving to end of data.\n"), jcr->VolumeName); if (!eod_dev(dev)) { Jmsg(jcr, M_ERROR, 0, _("Unable to position to end of data %s. ERR=%s\n"), dev_name(dev), strerror_dev(dev)); - Jmsg(jcr, M_INFO, 0, _("Marking Volume %s in Error in Catalog.\n"), + Jmsg(jcr, M_INFO, 0, _("Marking Volume \"%s\" in Error in Catalog.\n"), jcr->VolumeName); strcpy(dev->VolCatInfo.VolCatStatus, "Error"); Dmsg0(200, "dir_update_vol_info. Set Error.\n"); diff --git a/bacula/src/version.h b/bacula/src/version.h index e1103e6aad..5c79b5b4da 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -1,8 +1,8 @@ /* */ #define VERSION "1.30" #define VSTRING "1" -#define BDATE "28 March 2003" -#define LSMDATE "28Mar03" +#define BDATE "02 April 2003" +#define LSMDATE "02Apr03" /* Debug flags */ #define DEBUG 1