]> git.sur5r.net Git - bacula/bacula/commitdiff
- Require 5 arguments to mtx-changer except list and slots
authorKern Sibbald <kern@sibbald.com>
Wed, 3 Aug 2005 11:35:29 +0000 (11:35 +0000)
committerKern Sibbald <kern@sibbald.com>
Wed, 3 Aug 2005 11:35:29 +0000 (11:35 +0000)
- Turn -EPIPE status returns from bpipe to ETIME
- Include Slot in SD status output
- Do not term_dev() during initialization in SD if the device
  could not be opened.  In the case of a tape drive, there may
  be no tape in the drive.

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@2281 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/kernstodo
bacula/kes-1.37
bacula/scripts/mtx-changer.in
bacula/src/lib/bpipe.c
bacula/src/lib/lex.c
bacula/src/stored/autochanger.c
bacula/src/stored/protos.h
bacula/src/stored/reserve.c
bacula/src/stored/status.c
bacula/src/stored/stored.c
bacula/src/version.h

index dce48aaf18817870da198a7bec64dc2a1105663f..b8da8d6a10a0ef6ffd8c5b17ab62c025075e4833 100644 (file)
@@ -11,6 +11,11 @@ Final items for 1.37 before release:
 1. Fix bugs
 - Tape xxx in drive 0, requested in drive 1
 - Multi-drive changer seems to only use drive 0
+  Multiple drives don't seem to be opened.
+- Why isn't the DEVICE structure defined when doing
+  a reservation?
+- The mount command does not work with drives other than 0.
+
 -  --without-openssl breaks at least on Solaris.
 9. Run the regression scripts on Solaris and FreeBSD
 -  Figure out how to package gui, and rescue programs.
index aae0dcd0077a8504f5336563b1a531286812a9a7..e8a4053796695644fa8ff1d3c995ee16b8d3be61 100644 (file)
@@ -4,6 +4,13 @@
 General:
 
 Changes to 1.37.32:
+03Aug03
+- Require 5 arguments to mtx-changer except list and slots
+- Turn -EPIPE status returns from bpipe to ETIME
+- Include Slot in SD status output 
+- Do not term_dev() during initialization in SD if the device
+  could not be opened.  In the case of a tape drive, there may
+  be no tape in the drive.
 02Aug05
 - Correct PostgreSQL database scripts as suggested by a user.
 - Add additional info to FATAL message generated when a device
index e390913b50c38826735d1f110080cbd8eee41a0a..ae27f522916efa3e64d11f890865a3b286d94c8e 100644 (file)
@@ -72,30 +72,20 @@ ctl=$1
 cmd="$2"
 slot=$3
 device=$4
-# If drive not given, default to 0
-if test $# = 5 ; then
-  drive=$5
-else
-  drive=0
-fi
+drive=$5
 
 #
 # Check for special cases where only 2 arguments are needed, 
 #  all others are a minimum of 3
 case $cmd in
-   loaded)
-     ;;
-   unload)
-     ;;
    list)
      ;;
    slots)
      ;;
    *)
-     if test $# -lt 3; then
+     if test $# -lt 5; then
        echo "usage: mtx-changer ctl-device command slot archive-device drive"
        echo "  Insufficient number of arguments arguments given."
-       echo "  Mimimum usage is first three arguments ..."
        exit 1
      fi
      ;;
@@ -108,11 +98,7 @@ case $cmd in
 #
 # enable the following line if you need to eject the cartridge
 #     mt -f $device offline
-      if test x$slot = x; then
-        ${MTX} -f $ctl unload
-      else
-        ${MTX} -f $ctl unload $slot $drive
-      fi
+      ${MTX} -f $ctl unload $slot $drive
       ;;
 
    load)
index f2e4dd77fe7ed90d9159d7094261c955977dbdfc..03b7e3501785bc5e6c06f6b41af3b33e0b663a74 100644 (file)
@@ -278,7 +278,7 @@ int run_program(char *prog, int wait, POOLMEM *results)
              * following lines run_program would not detect if the program was killed
              * by the watchdog. */
             if (bpipe->timer_id->killed) {
-               stat1 = -EPIPE;
+               stat1 = ETIME;
                pm_strcat(results, "Program killed by Bacula watchdog (timeout)\n");
             }
          }
@@ -355,7 +355,7 @@ int run_program_full_output(char *prog, int wait, POOLMEM *results)
             Dmsg1(100, "Run program fgets killed=%d\n", bpipe->timer_id->killed);
             if (bpipe->timer_id->killed) {
                pm_strcat(tmp, "Program killed by Bacula watchdog (timeout)\n");
-               stat1 = -EPIPE;
+               stat1 = ETIME;
                break;
             }
          }
index fdeb700ec4d4a32a3e0228e34cd02fbb3cbd3733..01ab91ad60e8b8a7678c18130ce735c29e8fa979 100644 (file)
@@ -190,7 +190,7 @@ int lex_get_char(LEX *lf)
       }
       lf->line_no++;
       lf->col_no = 0;
-      Dmsg2(400, "fget line=%d %s", lf->line_no, lf->line);
+      Dmsg2(1000, "fget line=%d %s", lf->line_no, lf->line);
    }
    lf->ch = (uint8_t)lf->line[lf->col_no];
    if (lf->ch == 0) {
index fcb0828d55c5a241490ce5c4a1a72b3520eabcbf..f7b9619bcc4b1ed4b13f9c22628e88c9dbe66d3e 100644 (file)
@@ -25,7 +25,6 @@
 #include "stored.h"                   /* pull in Storage Deamon headers */
 
 /* Forward referenced functions */
-static int get_autochanger_loaded_slot(DCR *dcr);
 static void lock_changer(DCR *dcr);
 static void unlock_changer(DCR *dcr);
 
@@ -147,13 +146,17 @@ bail_out:
 
 }
 
-static int get_autochanger_loaded_slot(DCR *dcr)
+/*
+ * Returns: -1 if error from changer command
+ *          slot otherwise
+ */
+int get_autochanger_loaded_slot(DCR *dcr)
 {
    JCR *jcr = dcr->jcr;
    POOLMEM *changer, *results;
    int status, loaded;
    uint32_t timeout = dcr->device->max_changer_wait;
-   int drive = dcr->device->drive_index;
+   int drive = dcr->dev->drive_index;
 
    results = get_pool_memory(PM_MESSAGE);
    changer = get_pool_memory(PM_FNAME);
@@ -163,10 +166,10 @@ static int get_autochanger_loaded_slot(DCR *dcr)
    /* Find out what is loaded, zero means device is unloaded */
    Jmsg(jcr, M_INFO, 0, _("3301 Issuing autochanger \"loaded drive %d\" command.\n"),
         drive);
-   changer = edit_device_codes(dcr, changer, 
-                dcr->device->changer_command, "loaded");
+   changer = edit_device_codes(dcr, changer, dcr->device->changer_command, "loaded");
+   *results = 0;
    status = run_program(changer, timeout, results);
-   Dmsg3(50, "run_prog: %s stat=%d result=%s", changer, status, results);
+   Dmsg3(50, "run_prog: %s stat=%d result=%s\n", changer, status, results);
    if (status == 0) {
       loaded = atoi(results);
       if (loaded > 0) {
index d35e52a958cfe98e0fb422d88a5a0623bc71b56d..a7f40440917db73506219013a2598dd8d6f8f1ea 100644 (file)
@@ -52,6 +52,7 @@ int     authenticate_filed(JCR *jcr);
 int      autoload_device(DCR *dcr, int writing, BSOCK *dir);
 bool     autochanger_cmd(DCR *dcr, BSOCK *dir, const char *cmd);
 char    *edit_device_codes(DCR *dcr, char *omsg, const char *imsg, const char *cmd);
+int      get_autochanger_loaded_slot(DCR *dcr);
 
 /* From block.c */
 void    dump_block(DEV_BLOCK *b, const char *msg);
index 4dc22f1c4c85bae4e859a5cccc1504db43bec21b..fdaae01386595a4caed29dd7b739dab480ec86fc 100644 (file)
@@ -251,11 +251,12 @@ static bool use_storage_cmd(JCR *jcr)
    int Copy, Stripe;
    DIRSTORE *store;
    RCTX rctx;
-   rctx.jcr = jcr;
 #ifdef implemented
    char *error;
 #endif
 
+   memset(&rctx, 0, sizeof(RCTX));
+   rctx.jcr = jcr;
    /*
     * If there are multiple devices, the director sends us
     *   use_device for each device that it wants to use.
index fb20e70cba7f6a2646b5a763696a64f79120b1aa..9579d926c563eb3dd5764cc12b3abed9feee3ae6 100644 (file)
@@ -143,7 +143,11 @@ bool status_cmd(JCR *jcr)
             edit_uint64_with_commas(dev->block_num, b2));
 
       } else {
-         bnet_fsend(user, _("Archive \"%s\" is not open or does not exist.\n"), device->hdr.name);
+         if (dev) {
+            bnet_fsend(user, _("Device %s is not open or does not exist.\n"), dev->print_name());
+         } else {
+            bnet_fsend(user, _("Device \"%s\" is not open or does not exist.\n"), device->hdr.name);
+         }
          send_blocked_status(jcr, dev);
       }
    }
@@ -199,6 +203,15 @@ static void send_blocked_status(JCR *jcr, DEVICE *dev)
    default:
       break;
    }
+   /* Send autochanger slot status */
+   if (dev->is_autochanger()) {
+      if (dev->Slot) {
+         bnet_fsend(user, _("    Slot %d is loaded in drive %d.\n"), 
+            dev->Slot, dev->drive_index);
+      } else {
+         bnet_fsend(user, _("    Drive %d is not loaded.\n"), dev->drive_index);
+      }
+   }
    if (debug_level > 1) {
       bnet_fsend(user, _("Configured device capabilities:\n"));
       bnet_fsend(user, "%sEOF ", dev->capabilities & CAP_EOF ? "" : "!");
index 508b0abe454f018c486f6e1f4f2072cd16eca81a..4171439121395a637e4d548f084d50d7371200f4 100644 (file)
@@ -495,14 +495,21 @@ void *device_initialization(void *arg)
       }
 
       dcr = new_dcr(jcr, dev);
+      if (dev->is_autochanger()) {
+         /* If autochanger set slot in dev sturcture */
+         get_autochanger_loaded_slot(dcr);
+      }
 
       if (device->cap_bits & CAP_ALWAYSOPEN) {
          Dmsg1(20, "calling first_open_device %s\n", dev->print_name());
          if (!first_open_device(dcr)) {
             Jmsg1(NULL, M_ERROR, 0, _("Could not open device %s\n"), dev->print_name());
             Dmsg1(20, "Could not open device %s\n", dev->print_name());
+
+#ifdef xxx
             term_dev(dev);
             device->dev = NULL;
+#endif
             free_dcr(dcr);
             continue;
          }
index d3afab70dee292b0c6a7042bcc3c908951292e64..f6a1bb755e9a6c81e76840c47a8244d74146fc26 100644 (file)
@@ -1,8 +1,8 @@
 /* */
 #undef  VERSION
-#define VERSION "1.37.32"
-#define BDATE   "30 July 2005"
-#define LSMDATE "30Jul05"
+#define VERSION "1.37.33"
+#define BDATE   "03 August 2005"
+#define LSMDATE "03Aug05"
 
 /* Debug flags */
 #undef  DEBUG