From fe79aac00901ab9d39d4ae9c0a89404fe84e53a5 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Thu, 17 Apr 2003 22:13:47 +0000 Subject: [PATCH] Implement AutomaticMount git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@448 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/kernstodo | 2 +- bacula/src/stored/dev.c | 2 +- bacula/src/stored/mount.c | 16 ++++++++++++---- bacula/src/stored/stored.c | 1 + bacula/src/version.h | 4 ++-- 5 files changed, 17 insertions(+), 8 deletions(-) diff --git a/bacula/kernstodo b/bacula/kernstodo index 5cc3a825ad..d94067002c 100644 --- a/bacula/kernstodo +++ b/bacula/kernstodo @@ -19,6 +19,7 @@ Testing to do: (painful) For 1.30 release: - Fix Bare Metal restore problem. - Implement create "FileSet"? +- Possibly implement a Slot priority (loaded/not loaded). - Test multiple simultaneous Volumes - Document new transparent Console commands and wait command. @@ -961,4 +962,3 @@ rufus-dir: Volume used once. Marking Volume "File0003" as Used. the binary gets deleted when the daemon is stopped in the rc.d/inid.d directory. - Do not ignore SIGCHLD - diff --git a/bacula/src/stored/dev.c b/bacula/src/stored/dev.c index e222876882..0b5a831beb 100644 --- a/bacula/src/stored/dev.c +++ b/bacula/src/stored/dev.c @@ -286,7 +286,7 @@ open_dev(DEVICE *dev, char *VolName, int mode) Dmsg1(29, "open_dev: tape %d opened\n", dev->fd); } else { /* - * Handle opening of file + * Handle opening of File Archive (not a tape) */ archive_name = get_pool_memory(PM_FNAME); pm_strcpy(&archive_name, dev->dev_name); diff --git a/bacula/src/stored/mount.c b/bacula/src/stored/mount.c index 1d5905f043..420eb488e8 100644 --- a/bacula/src/stored/mount.c +++ b/bacula/src/stored/mount.c @@ -103,7 +103,6 @@ mount_next_vol: } Dmsg2(100, "After find_next_append. Vol=%s Slot=%d\n", jcr->VolCatInfo.VolCatName, jcr->VolCatInfo.Slot); - release = 1; /* release if we "recurse" */ /* * Get next volume and ready it for append @@ -127,10 +126,19 @@ mount_next_vol: for ( ;; ) { int vol_label_status; autochanger = autoload_device(jcr, dev, 1, NULL); - if (autochanger) { - ask = 0; /* if autochange no need to ask sysop */ + + /* + * If we autochanged to correct Volume or (we have not just + * released the Volume AND we can automount) we go ahead + * and read the label. If there is no tape in the drive, + * we will err, recurse and ask the operator the next time. + */ + if (autochanger || (!release && dev_cap(dev, CAP_AUTOMOUNT))) { + ask = 0; /* don't ask SYSOP this time */ } + release = 1; /* release next time if we "recurse" */ + if (ask && !dir_ask_sysop_to_mount_next_volume(jcr, dev)) { Dmsg0(100, "Error return ask_sysop ...\n"); return 0; /* error return */ @@ -138,7 +146,7 @@ mount_next_vol: Dmsg1(100, "want vol=%s\n", jcr->VolumeName); /* Open device */ - for ( ; !(dev->state & ST_OPENED); ) { + if (!(dev->state & ST_OPENED)) { int mode; if (dev_cap(dev, CAP_STREAM)) { mode = OPEN_WRITE_ONLY; diff --git a/bacula/src/stored/stored.c b/bacula/src/stored/stored.c index 615d941962..8d2868bb7f 100644 --- a/bacula/src/stored/stored.c +++ b/bacula/src/stored/stored.c @@ -310,6 +310,7 @@ static void *device_allocation(void *arg) Dmsg1(10, "SD init done %s\n", device->device_name); if (!device->dev) { Emsg1(M_ERROR, 0, _("Could not initialize %s\n"), device->device_name); + continue; } if (device->cap_bits & CAP_ALWAYSOPEN) { Dmsg1(20, "calling open_device %s\n", device->device_name); diff --git a/bacula/src/version.h b/bacula/src/version.h index 4d19a9ccce..01e6a176ef 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -1,8 +1,8 @@ /* */ #define VERSION "1.30" #define VSTRING "1" -#define BDATE "16 April 2003" -#define LSMDATE "16Apr03" +#define BDATE "18 April 2003" +#define LSMDATE "18Apr03" /* Debug flags */ #define DEBUG 1 -- 2.39.2