]> git.sur5r.net Git - bacula/bacula/commitdiff
Fixes to making autochanger work with console label command
authorKern Sibbald <kern@sibbald.com>
Sat, 21 Sep 2002 20:55:48 +0000 (20:55 +0000)
committerKern Sibbald <kern@sibbald.com>
Sat, 21 Sep 2002 20:55:48 +0000 (20:55 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@158 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/autoconf/configure.in
bacula/configure
bacula/kernstodo
bacula/src/stored/acquire.c
bacula/src/stored/device.c
bacula/src/stored/dircmd.c
bacula/src/stored/mount.c
bacula/src/stored/protos.h
bacula/src/version.h

index 730903eb117520da5ae505707d7885ab4e52e359..9980b0f955436f2b3bf541e7d00927edfd29906f 100644 (file)
@@ -1254,6 +1254,7 @@ chmod 755 src/cats/create_mysql_database
 chmod 755 src/cats/alter_mysql_tables
 chmod 755 src/cats/grant_mysql_privileges
 chmod 755 src/cats/make_sqlite_tables src/cats/drop_sqlite_tables 
+chmod 755 src/cats/make_bacula_tables src/cats/drop_bacula_tables 
 chmod 755 src/cats/create_sqlite_database
 chmod 755 src/cats/alter_sqlite_tables
 chmod 755 src/cats/sqlite
index 356bd8844db3bc726026e12257cf28312e833377..d0d775fdb4301c52e3ad1fdc2056dc7ef9f472d2 100755 (executable)
@@ -9926,6 +9926,7 @@ chmod 755 src/cats/create_mysql_database
 chmod 755 src/cats/alter_mysql_tables
 chmod 755 src/cats/grant_mysql_privileges
 chmod 755 src/cats/make_sqlite_tables src/cats/drop_sqlite_tables 
+chmod 755 src/cats/make_bacula_tables src/cats/drop_bacula_tables 
 chmod 755 src/cats/create_sqlite_database
 chmod 755 src/cats/alter_sqlite_tables
 chmod 755 src/cats/sqlite
index 7762d0458cb757f18e8bac6eef315ad51c3a719f..db09c6c998db36969d8598eaf9528b6511c4a5b9 100644 (file)
@@ -27,7 +27,24 @@ From Chuck:
   I tried this and it didn't find sqlite.h
 =======
 
-- Take another stab at 64 bit file addresses
+- Had to label second tape using the autochanger two times. The
+  first time the second tape was apparently loaded but not labeled.
+- Put MaximumVolumeSize in Director.
+- Document how to cancel a job that is waiting on a Volume. 
+  Must "cancel" then "mount".
+- Document to have patience when SD first starts.
+- Document running a test version.
+- Attempt to label autochanger tape which is unloaded.
+  rufus-dir: Start Backup JobId 1, Job=kernsave.2002-09-21.21:07:34
+  rufus-sd: Job kernsave.2002-09-21.21:07:34 waiting. Cannot find any appendable volumes.
+  Please use the "label"  command to create a new Volume for:
+      Storage:      FileStorage
+      Media type:   File
+      Pool:         Default
+  rufus-dir: Error in getmsg.c:129 Job not found: Jmsg Job= type=6 level=0 rufus-sd: Issuing autochanger "load slot 2" command.
+     
+  Another try with tape mounted and Job hung in Director.
+
 - When Marking a file in Restore that is a hard link, also
   mark the link so that the data will be reloaded.
 - Restore program that errors in SD due to no tape reports
@@ -591,3 +608,4 @@ Done: (see kernsdone for more)
 - sd.conf password does not match dir.conf storage password
 - Apparently Description records are not freed. Storage daemon
   Device reported orphaned buffer 45 bytes probably for a Description.
+- Take another stab at 64 bit file addresses
index 3d9dc37c51acf78976ec722947f84abab6f4e479..2ba9addb4586790ce658a2e600c191257b77e9dd 100644 (file)
@@ -96,7 +96,7 @@ default_path:
            dir_get_volume_info(jcr, 0);
             Dmsg2(200, "calling autoload Vol=%s Slot=%d\n",
               jcr->VolumeName, jcr->VolCatInfo.Slot);                         
-           if (autoload_device(jcr, dev, 0)) {
+           if (autoload_device(jcr, dev, 0, NULL)) {
               continue;
            }
            /* Mount a specific volume and no other */
index 6d41843e64c93009334a1778ff8982042f4a8065..ecb5f189ea58b8c7d5471a2878d14bdc8537279b 100644 (file)
@@ -113,7 +113,7 @@ int fixup_device_block_write_error(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
         unblock_device(dev);
         return 0;                    /* device locked */
       }
-      Dmsg0(190, "Back from update_vol_info\n");
+      Dmsg0(100, "Back from update_vol_info\n");
 
       strcpy(PrevVolName, dev->VolCatInfo.VolCatName);
       strcpy(dev->VolHdr.PrevVolName, PrevVolName);
index c125a2c1effcdd8a7c935f4beb2c62e2a40120ab..aaa26431c2384ca5d1a973d93d59f6e35ccbab5d 100644 (file)
@@ -324,7 +324,7 @@ static void label_volume_if_ok(JCR *jcr, DEVICE *dev, char *vname, char *poolnam
    
    strcpy(jcr->VolumeName, vname);
    jcr->VolCatInfo.Slot = slot;
-   autoload_device(jcr, dev, 0);      /* autoload if possible */
+   autoload_device(jcr, dev, 0, dir);     /* autoload if possible */
    block = new_block(dev);
 
    /* See what we have for a Volume */
index aac5c57d5b48311a725b076050ec47715ac77371..33b01fc8cf2c74d0ba0ffa97620fcd4ea050f2ec 100644 (file)
@@ -49,7 +49,7 @@ int mount_next_write_volume(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, int release
 {
    int recycle, ask, retry = 0, autochanger;
 
-   Dmsg0(190, "Enter mount_next_volume()\n");
+   Dmsg0(100, "Enter mount_next_volume()\n");
 
 mount_next_vol:
    if (retry++ > 5) {
@@ -62,7 +62,7 @@ mount_next_vol:
    }
    recycle = ask = autochanger = 0;
    if (release) {
-      Dmsg0(500, "mount_next_volume release=1\n");
+      Dmsg0(100, "mount_next_volume release=1\n");
       /* 
        * First erase all memory of the current volume  
        */
@@ -70,6 +70,7 @@ mount_next_vol:
       dev->file = 0;
       dev->LastBlockNumWritten = 0;
       memset(&dev->VolCatInfo, 0, sizeof(dev->VolCatInfo));
+      memset(&jcr->VolCatInfo, 0, sizeof(jcr->VolCatInfo));
       memset(&dev->VolHdr, 0, sizeof(dev->VolHdr));
       dev->state &= ~ST_LABEL;       /* label not yet read */
       jcr->VolumeName[0] = 0;
@@ -99,6 +100,7 @@ mount_next_vol:
     */
    if (!dir_find_next_appendable_volume(jcr)) {
       ask = 1;                    /* we must ask */
+      Dmsg0(100, "did not find next volume. Must ask.\n");
    }
    Dmsg2(100, "After find_next_append. Vol=%s Slot=%d\n",
       jcr->VolCatInfo.VolCatName, jcr->VolCatInfo.Slot);
@@ -124,7 +126,7 @@ mount_next_vol:
 
    jcr->VolFirstFile = jcr->JobFiles; /* first update of Vol FileIndex */
    for ( ;; ) {
-      autochanger = autoload_device(jcr, dev, 1);
+      autochanger = autoload_device(jcr, dev, 1, NULL);
       if (autochanger) {
         ask = 0;                     /* if autochange no need to ask sysop */
       }
@@ -132,7 +134,7 @@ mount_next_vol:
       if (ask && !dir_ask_sysop_to_mount_next_volume(jcr, dev)) {
         return 0;              /* error return */
       }
-      Dmsg1(200, "want vol=%s\n", jcr->VolumeName);
+      Dmsg1(100, "want vol=%s\n", jcr->VolumeName);
 
       /* Open device */
       for ( ; !(dev->state & ST_OPENED); ) {
@@ -346,10 +348,14 @@ int mount_next_read_volume(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
  *  On success this routine loads the indicated tape, but the
  *  label is not read, so it must be verified.
  *
+ *  Note if dir is not NULL, it is the console requesting the 
+ *   autoload for labeling, so we respond directly to the
+ *   dir bsock.
+ *
  *  Returns: 1 on success
  *          0 on failure
  */
-int autoload_device(JCR *jcr, DEVICE *dev, int writing)
+int autoload_device(JCR *jcr, DEVICE *dev, int writing, BSOCK *dir)
 {
    int slot = jcr->VolCatInfo.Slot;
    int rtn_stat = 0;
@@ -359,6 +365,9 @@ int autoload_device(JCR *jcr, DEVICE *dev, int writing)
     *  will return FALSE to ask the sysop.
     */
    if (writing && dev->capabilities && CAP_AUTOCHANGER && slot <= 0) {
+      if (dir) {
+        return 0;                    /* For user, bail out right now */
+      }
       if (dir_find_next_appendable_volume(jcr)) {
         slot = jcr->VolCatInfo.Slot; 
       }
@@ -393,7 +402,11 @@ int autoload_device(JCR *jcr, DEVICE *dev, int writing)
         force_close_dev(dev);
         if (loaded != 0) {        /* must unload drive */
             Dmsg0(100, "Doing changer unload.\n");
-            Jmsg(jcr, M_INFO, 0, _("Issuing autochanger \"unload\" command.\n"));
+           if (dir) {
+               bnet_fsend(dir, _("3902 Issuing autochanger \"unload\" command.\n"));
+           } else {
+               Jmsg(jcr, M_INFO, 0, _("Issuing autochanger \"unload\" command.\n"));
+           }
            changer = edit_device_codes(jcr, changer, 
                         jcr->device->changer_command, "unload");
            status = run_program(changer, timeout, NULL);
@@ -403,8 +416,13 @@ int autoload_device(JCR *jcr, DEVICE *dev, int writing)
          * Load the desired cassette    
          */
          Dmsg1(100, "Doing changer load slot %d\n", slot);
-         Jmsg(jcr, M_INFO, 0, _("Issuing autochanger \"load slot %d\" command.\n"),
-           slot);
+        if (dir) {
+            bnet_fsend(dir, _("3903 Issuing autochanger \"load slot %d\" command.\n"),
+              slot);
+        } else {
+            Jmsg(jcr, M_INFO, 0, _("Issuing autochanger \"load slot %d\" command.\n"),
+              slot);
+        }
         changer = edit_device_codes(jcr, changer, 
                       jcr->device->changer_command, "load");
         status = run_program(changer, timeout, NULL);
index 9272d43bd32102aa9e92f9dec8e37d7ec228a840..46720315de1a41e1197fd33c3eafd4b31f35f0b6 100644 (file)
 uint32_t new_VolSessionId();
 
 /* From acquire.c */
-int      acquire_device_for_append(JCR *jcr, DEVICE *dev, DEV_BLOCK *block);
-int      acquire_device_for_read(JCR *jcr, DEVICE *dev, DEV_BLOCK *block);
-int      release_device(JCR *jcr, DEVICE *dev);
+int     acquire_device_for_append(JCR *jcr, DEVICE *dev, DEV_BLOCK *block);
+int     acquire_device_for_read(JCR *jcr, DEVICE *dev, DEV_BLOCK *block);
+int     release_device(JCR *jcr, DEVICE *dev);
 
 /* From askdir.c */
-int     dir_get_volume_info(JCR *jcr, int writing);
-int     dir_find_next_appendable_volume(JCR *jcr);
-int     dir_update_volume_info(JCR *jcr, VOLUME_CAT_INFO *vol, int relabel);
-int     dir_ask_sysop_to_mount_next_volume(JCR *jcr, DEVICE *dev);
-int     dir_ask_sysop_to_mount_volume(JCR *jcr, DEVICE *dev);
-int     dir_update_file_attributes(JCR *jcr, DEV_RECORD *rec);
-int     dir_send_job_status(JCR *jcr);
-int     dir_create_jobmedia_record(JCR *jcr);
+int    dir_get_volume_info(JCR *jcr, int writing);
+int    dir_find_next_appendable_volume(JCR *jcr);
+int    dir_update_volume_info(JCR *jcr, VOLUME_CAT_INFO *vol, int relabel);
+int    dir_ask_sysop_to_mount_next_volume(JCR *jcr, DEVICE *dev);
+int    dir_ask_sysop_to_mount_volume(JCR *jcr, DEVICE *dev);
+int    dir_update_file_attributes(JCR *jcr, DEV_RECORD *rec);
+int    dir_send_job_status(JCR *jcr);
+int    dir_create_jobmedia_record(JCR *jcr);
 
 /* authenticate.c */
-int     authenticate_director(JCR *jcr);
-int     authenticate_filed(JCR *jcr);
+int    authenticate_director(JCR *jcr);
+int    authenticate_filed(JCR *jcr);
 
 /* From block.c */
-void    dump_block(DEV_BLOCK *b, char *msg);
+void   dump_block(DEV_BLOCK *b, char *msg);
 DEV_BLOCK *new_block(DEVICE *dev);
-void    init_block_write(DEV_BLOCK *block);
-void    empty_block(DEV_BLOCK *block);
-void    free_block(DEV_BLOCK *block);
-int     write_block_to_device(JCR *jcr, DEVICE *dev, DEV_BLOCK *block);
-int     write_block_to_dev(DEVICE *dev, DEV_BLOCK *block);
-int     read_block_from_device(DEVICE *dev, DEV_BLOCK *block);
-int     read_block_from_dev(DEVICE *dev, DEV_BLOCK *block);
+void   init_block_write(DEV_BLOCK *block);
+void   empty_block(DEV_BLOCK *block);
+void   free_block(DEV_BLOCK *block);
+int    write_block_to_device(JCR *jcr, DEVICE *dev, DEV_BLOCK *block);
+int    write_block_to_dev(DEVICE *dev, DEV_BLOCK *block);
+int    read_block_from_device(DEVICE *dev, DEV_BLOCK *block);
+int    read_block_from_dev(DEVICE *dev, DEV_BLOCK *block);
 
 /* From butil.c */
 void print_ls_output(char *fname, char *link, int type, struct stat *statp);
@@ -65,44 +65,44 @@ void display_error_status(DEVICE *dev);
 
 
 /* From dev.c */
-DEVICE  *init_dev(DEVICE *dev, char *device);
-int      open_dev(DEVICE *dev, char *VolName, int mode);
-void     close_dev(DEVICE *dev);
-void     force_close_dev(DEVICE *dev);
-int      truncate_dev(DEVICE *dev);
-void     term_dev(DEVICE *dev);
-char *   strerror_dev(DEVICE *dev);
-void     clrerror_dev(DEVICE *dev, int func);
-int      update_pos_dev(DEVICE *dev);
-int      rewind_dev(DEVICE *dev);
-int      load_dev(DEVICE *dev);
-int      offline_dev(DEVICE *dev);
-int      flush_dev(DEVICE *dev);
-int      weof_dev(DEVICE *dev, int num);
-int      write_block(DEVICE *dev);
-int      write_dev(DEVICE *dev, char *buf, size_t len);
-int      read_dev(DEVICE *dev, char *buf, size_t len);
-int      status_dev(DEVICE *dev, uint32_t *status);
-int      eod_dev(DEVICE *dev);
-int      fsf_dev(DEVICE *dev, int num);
-int      fsr_dev(DEVICE *dev, int num);
-int      bsf_dev(DEVICE *dev, int num);
-int      bsr_dev(DEVICE *dev, int num);
-void     attach_jcr_to_device(DEVICE *dev, JCR *jcr);
-void     detach_jcr_from_device(DEVICE *dev, JCR *jcr);
-JCR     *next_attached_jcr(DEVICE *dev, JCR *jcr);
+DEVICE *init_dev(DEVICE *dev, char *device);
+int     open_dev(DEVICE *dev, char *VolName, int mode);
+void    close_dev(DEVICE *dev);
+void    force_close_dev(DEVICE *dev);
+int     truncate_dev(DEVICE *dev);
+void    term_dev(DEVICE *dev);
+char *  strerror_dev(DEVICE *dev);
+void    clrerror_dev(DEVICE *dev, int func);
+int     update_pos_dev(DEVICE *dev);
+int     rewind_dev(DEVICE *dev);
+int     load_dev(DEVICE *dev);
+int     offline_dev(DEVICE *dev);
+int     flush_dev(DEVICE *dev);
+int     weof_dev(DEVICE *dev, int num);
+int     write_block(DEVICE *dev);
+int     write_dev(DEVICE *dev, char *buf, size_t len);
+int     read_dev(DEVICE *dev, char *buf, size_t len);
+int     status_dev(DEVICE *dev, uint32_t *status);
+int     eod_dev(DEVICE *dev);
+int     fsf_dev(DEVICE *dev, int num);
+int     fsr_dev(DEVICE *dev, int num);
+int     bsf_dev(DEVICE *dev, int num);
+int     bsr_dev(DEVICE *dev, int num);
+void    attach_jcr_to_device(DEVICE *dev, JCR *jcr);
+void    detach_jcr_from_device(DEVICE *dev, JCR *jcr);
+JCR    *next_attached_jcr(DEVICE *dev, JCR *jcr);
 
 
 /* Get info about device */
-char *   dev_name(DEVICE *dev);
-char *   dev_vol_name(DEVICE *dev);
+char *  dev_name(DEVICE *dev);
+char *  dev_vol_name(DEVICE *dev);
 uint32_t dev_block(DEVICE *dev);
 uint32_t dev_file(DEVICE *dev);
-int      dev_is_tape(DEVICE *dev);
+int     dev_is_tape(DEVICE *dev);
 
 /* From device.c */
-int      open_device(DEVICE *dev);
-int      fixup_device_block_write_error(JCR *jcr, DEVICE *dev, DEV_BLOCK *block);
+int     open_device(DEVICE *dev);
+int     fixup_device_block_write_error(JCR *jcr, DEVICE *dev, DEV_BLOCK *block);
 void _lock_device(char *file, int line, DEVICE *dev);
 void _unlock_device(char *file, int line, DEVICE *dev);
 void _block_device(char *file, int line, DEVICE *dev, int state);
@@ -118,39 +118,39 @@ void  new_steal_device_lock(DEVICE *dev, brwsteal_t *hold, int state);
 void  new_return_device_lock(DEVICE *dev, brwsteal_t *hold);
 
 /* From dircmd.c */
-void     connection_request(void *arg); 
+void    connection_request(void *arg); 
 
 
 /* From fd_cmds.c */
-void     run_job(JCR *jcr);
+void    run_job(JCR *jcr);
 
 /* From fdmsg.c */
-int      bget_msg(BSOCK *sock);
+int     bget_msg(BSOCK *sock);
 
 /* From job.c */
-void     stored_free_jcr(JCR *jcr);
-void     connection_from_filed(void *arg);     
-void     handle_filed_connection(BSOCK *fd, char *job_name);
+void    stored_free_jcr(JCR *jcr);
+void    connection_from_filed(void *arg);     
+void    handle_filed_connection(BSOCK *fd, char *job_name);
 
 /* From label.c */
-int      read_dev_volume_label(JCR *jcr, DEVICE *dev, DEV_BLOCK *block);
-void     create_session_label(JCR *jcr, DEV_RECORD *rec, int label);
-int      write_volume_label_to_dev(JCR *jcr, DEVRES *device, char *VolName, char *PoolName);
-int      write_session_label(JCR *jcr, DEV_BLOCK *block, int label);
-int      write_volume_label_to_block(JCR *jcr, DEVICE *dev, DEV_BLOCK *block);
-void     dump_volume_label(DEVICE *dev);
-void     dump_label_record(DEVICE *dev, DEV_RECORD *rec, int verbose);
-int      unser_volume_label(DEVICE *dev, DEV_RECORD *rec);
-int      unser_session_label(SESSION_LABEL *label, DEV_RECORD *rec);
+int     read_dev_volume_label(JCR *jcr, DEVICE *dev, DEV_BLOCK *block);
+void    create_session_label(JCR *jcr, DEV_RECORD *rec, int label);
+int     write_volume_label_to_dev(JCR *jcr, DEVRES *device, char *VolName, char *PoolName);
+int     write_session_label(JCR *jcr, DEV_BLOCK *block, int label);
+int     write_volume_label_to_block(JCR *jcr, DEVICE *dev, DEV_BLOCK *block);
+void    dump_volume_label(DEVICE *dev);
+void    dump_label_record(DEVICE *dev, DEV_RECORD *rec, int verbose);
+int     unser_volume_label(DEVICE *dev, DEV_RECORD *rec);
+int     unser_session_label(SESSION_LABEL *label, DEV_RECORD *rec);
 
 /* From match_bsr.c */
 int match_bsr(BSR *bsr, DEV_RECORD *rec, VOLUME_LABEL *volrec, 
-              SESSION_LABEL *sesrec);
+             SESSION_LABEL *sesrec);
 
 /* From mount.c */
-int      mount_next_write_volume(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, int release);
-int      mount_next_read_volume(JCR *jcr, DEVICE *dev, DEV_BLOCK *block);
-int      autoload_device(JCR *jcr, DEVICE *dev, int writing);
+int     mount_next_write_volume(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, int release);
+int     mount_next_read_volume(JCR *jcr, DEVICE *dev, DEV_BLOCK *block);
+int     autoload_device(JCR *jcr, DEVICE *dev, int writing, BSOCK *dir);
 
 
 /* From parse_bsr.c */
@@ -165,11 +165,11 @@ extern void create_vol_list(JCR *jcr);
 /* From record.c */
 char   *FI_to_ascii(int fi);
 char   *stream_to_ascii(int stream);
-int     write_record_to_block(DEV_BLOCK *block, DEV_RECORD *rec);
-int     can_write_record_to_block(DEV_BLOCK *block, DEV_RECORD *rec);
-int     read_record_from_block(DEV_BLOCK *block, DEV_RECORD *rec); 
+int    write_record_to_block(DEV_BLOCK *block, DEV_RECORD *rec);
+int    can_write_record_to_block(DEV_BLOCK *block, DEV_RECORD *rec);
+int    read_record_from_block(DEV_BLOCK *block, DEV_RECORD *rec); 
 DEV_RECORD *new_record();
-void    free_record(DEV_RECORD *rec);
+void   free_record(DEV_RECORD *rec);
 
 /* From read_record.c */
 int read_records(JCR *jcr,  DEVICE *dev, 
index 61e381ecffd085b21e2152c8e43a44f789e5c1bc..6c7343678c915f6020c805f22b66dbb0967dee33 100644 (file)
@@ -1,8 +1,8 @@
 /* */
 #define VERSION "1.26"
 #define VSTRING "1"
-#define DATE    "14 September 2002"
-#define LSMDATE "14Sep02"
+#define DATE    "21 September 2002"
+#define LSMDATE "21Sep02"
 
 /* Debug flags */
 #define DEBUG 1