]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix automatic labeling of File volumes, which was broken by new
authorKern Sibbald <kern@sibbald.com>
Tue, 12 Dec 2006 18:13:59 +0000 (18:13 +0000)
committerKern Sibbald <kern@sibbald.com>
Tue, 12 Dec 2006 18:13:59 +0000 (18:13 +0000)
     removable device code.

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

bacula/src/dird/ua_cmds.c
bacula/src/stored/mount.c
bacula/src/stored/scan.c
bacula/src/version.h
bacula/technotes-1.39

index c9f37be4338964bae52346d94afc2beabaa88797..f7e50f03935c4979b72c2461f1627708f47c1257 100644 (file)
@@ -1627,7 +1627,7 @@ bool open_db(UAContext *ua)
                              ua->catalog->db_port, ua->catalog->db_socket,
                              ua->catalog->mult_db_connections);
    if (!ua->db || !db_open_database(ua->jcr, ua->db)) {
-      bsendmsg(ua, _("Could not open database \"%s\".\n"),
+      bsendmsg(ua, _("Could not open catalog database \"%s\".\n"),
                  ua->catalog->db_name);
       if (ua->db) {
          bsendmsg(ua, "%s", db_strerror(ua->db));
index 93a3804dea0b4086b8b1be10ded99d3f5e23c6e0..65cc04e5219f871ba55ae2fa0b09aa7d1babe118 100644 (file)
@@ -177,6 +177,10 @@ mount_next_vol:
    } else {
       mode = OPEN_READ_WRITE;
    }
+   /* Try autolabel if enabled */
+   if (dev->open(dcr, mode) < 0) {
+      try_autolabel(dcr);
+   }
    while (dev->open(dcr, mode) < 0) {
       Dmsg1(150, "open_device failed: ERR=%s\n", dev->bstrerror());
       if ((dev->is_file() && dev->is_removable()) || dev->is_dvd()) {
index 98e9dd54ef238a7968ec3c84c6b57757768d6981..809da6b297c7b37fb73917d559627552a37f1569 100644 (file)
@@ -49,6 +49,7 @@ bool DEVICE::scan_dir_for_volume(DCR *dcr)
    int name_max;
    char *mount_point;
    VOLUME_CAT_INFO dcrVolCatInfo, devVolCatInfo;
+   char VolumeName[MAX_NAME_LENGTH];
    struct stat statp;
    bool found = false;
    POOL_MEM fname(PM_FNAME);
@@ -56,6 +57,7 @@ bool DEVICE::scan_dir_for_volume(DCR *dcr)
    int len;
 
    
+   bstrncpy(VolumeName, dcr->VolumeName, sizeof(VolumeName));
    name_max = pathconf(".", _PC_NAME_MAX);
    if (name_max < 1024) {
       name_max = 1024;
@@ -113,6 +115,7 @@ bool DEVICE::scan_dir_for_volume(DCR *dcr)
        */
       dcrVolCatInfo = dcr->VolCatInfo;     /* structure assignment */
       devVolCatInfo = VolCatInfo;          /* structure assignment */
+      bstrncpy(VolumeName, dcr->VolumeName, sizeof(VolumeName));
       /* Check if this is a valid Volume in the pool */
       bstrncpy(dcr->VolumeName, result->d_name, sizeof(dcr->VolumeName));
       if (!dir_get_volume_info(dcr, GET_VOL_INFO_FOR_WRITE)) {
@@ -129,6 +132,10 @@ bool DEVICE::scan_dir_for_volume(DCR *dcr)
    closedir(dp);
    
 get_out:
+   if (!found) {
+      /* Restore VolumeName we really wanted */
+      bstrncpy(dcr->VolumeName, VolumeName, sizeof(dcr->VolumeName));
+   }
    sm_check(__FILE__, __LINE__, false);
    return found;
 }
index 26f690b4d66dae4b8b3aa1dc88af14d572f43dae..29171ec4afe5768ea96fed04908111dfee66c8ac 100644 (file)
@@ -4,8 +4,8 @@
 
 #undef  VERSION
 #define VERSION "1.39.31"
-#define BDATE   "10 December 2006"
-#define LSMDATE "10Dec06"
+#define BDATE   "12 December 2006"
+#define LSMDATE "12Dec06"
 
 #define PROG_COPYRIGHT "Copyright (C) %d-2006 Free Software Foundation Europe e.V.\n"
 #define BYEAR "2006"       /* year for copyright messages in progs */
index e807fe2b597fb3ba1c0486e247ff5240f08e4b70..2adab9c47b17d4d3785ad05d747d03aa35bf7538 100644 (file)
@@ -1,6 +1,8 @@
               Technical notes on version 1.39  
 
 General:
+12Dec06
+
 10Dec06
 kes  Remove typedef uLong for HP in baconfig.h.  It broke things.
 lf   Fix job byte reporting -- the digest code runs in verify.c and