]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix new bug in newvol
authorKern Sibbald <kern@sibbald.com>
Thu, 3 Apr 2003 13:15:22 +0000 (13:15 +0000)
committerKern Sibbald <kern@sibbald.com>
Thu, 3 Apr 2003 13:15:22 +0000 (13:15 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@412 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/cats/mysql.c
bacula/src/cats/sql.c
bacula/src/dird/newvol.c
bacula/src/dird/ua_cmds.c
bacula/src/dird/ua_output.c
bacula/src/stored/bscan.c
bacula/src/stored/mount.c
bacula/src/version.h

index 47f965a0b2abdbc68d7efd9762e4c9f7275789bc..731107513bf037cd2d7c014ae55151769b9a46d4 100644 (file)
@@ -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) {
index e40b3c2114d1cabcdc3e96fa12073b2c5e72bf44..0af5969f2014e8ae94f2c66ec0ca10145acb2dc7 100644 (file)
@@ -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++;
index 1b1f277d615d0eba7188c2efd94c13487a4d7a29..6edcb250f5ff6e14487a75aa640f8682c5f4f52c 100644 (file)
@@ -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 {
index 23e77532bb8775625f2cff5d0fa0bd013fff259e..fd15a4ff05d0d7bd0513eba7b3e71cd14489e46a 100644 (file)
@@ -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 <pool> | files job=<nn>]; from catalog")},
+ { N_("llist"),      llistcmd,     _("full or long list like list command")},
  { N_("messages"),   messagescmd,  _("messages")},
  { N_("mount"),      mountcmd,     _("mount <storage-name>")},
  { 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;
+}
+
 
 
 /*
index c60873c2756822cc999358dfc11cf34437bcf728..5d15c3f58b8047923fde6dd5ffc7419a69408dc1 100644 (file)
@@ -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;
index 44b28490e4e71ca9b1e1d9135b172cd15756ea58..a1d04d4f6d5d0f65997e73cec47a4f60105cf742 100644 (file)
@@ -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;
index 2e6a8c45b59f6c40dc79699cbabb3285ee4f7c4a..abedacf060f120b51b00bc6bf0430ae962f270fc 100644 (file)
@@ -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");
index e1103e6aad2880368f15354a73fb1e4786085dea..5c79b5b4da61c42e1cebf93ffc47f1565c182ccd 100644 (file)
@@ -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