From: Kern Sibbald Date: Tue, 12 Dec 2006 18:13:59 +0000 (+0000) Subject: Fix automatic labeling of File volumes, which was broken by new X-Git-Tag: Release-7.0.0~7241 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=2a2af40a874bb3bc82d2df47eed356826f564fb7;p=bacula%2Fbacula Fix automatic labeling of File volumes, which was broken by new removable device code. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3792 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/dird/ua_cmds.c b/bacula/src/dird/ua_cmds.c index c9f37be433..f7e50f0393 100644 --- a/bacula/src/dird/ua_cmds.c +++ b/bacula/src/dird/ua_cmds.c @@ -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)); diff --git a/bacula/src/stored/mount.c b/bacula/src/stored/mount.c index 93a3804dea..65cc04e521 100644 --- a/bacula/src/stored/mount.c +++ b/bacula/src/stored/mount.c @@ -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()) { diff --git a/bacula/src/stored/scan.c b/bacula/src/stored/scan.c index 98e9dd54ef..809da6b297 100644 --- a/bacula/src/stored/scan.c +++ b/bacula/src/stored/scan.c @@ -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; } diff --git a/bacula/src/version.h b/bacula/src/version.h index 26f690b4d6..29171ec4af 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -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 */ diff --git a/bacula/technotes-1.39 b/bacula/technotes-1.39 index e807fe2b59..2adab9c47b 100644 --- a/bacula/technotes-1.39 +++ b/bacula/technotes-1.39 @@ -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