From: Alain Spineux Date: Thu, 4 Nov 2021 17:12:27 +0000 (+0100) Subject: remove the meaning less "Drive X is not loaded" for virtual autochanger X-Git-Tag: Beta-15.0.0~775 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7842ff053b8502e58c757cd6b0b06a7acfa66430;p=thirdparty%2Fbacula.git remove the meaning less "Drive X is not loaded" for virtual autochanger - in "status storage" output Device Dedup is "Drive-9" (/home/bac/workspace2/bee/regress/tmp) mounted with: Volume: TestVolume005 Pool: Full Media type: DedupMedia Total Bytes=1,495,682,876 Blocks=247 Bytes/block=6,055,396 Positioned at File=0 Block=0 Drive 9 is not loaded. <=========== REMOVE THIS ======== Available Space=21.78 GB --- diff --git a/bacula/src/stored/dev.c b/bacula/src/stored/dev.c index c7b3aecc2..137e32d7b 100644 --- a/bacula/src/stored/dev.c +++ b/bacula/src/stored/dev.c @@ -532,6 +532,13 @@ ssize_t DEVICE::write(const void *buf, size_t len) return write_len; } +/* to make the difference with an "real" auto changer */ +bool DEVICE::is_virtual_autochanger() const { + return device->changer_command && + (device->changer_command[0] == 0 || + strcmp(device->changer_command, "/dev/null") == 0); +} + /* Return the resource name for the device */ const char *DEVICE::name() const { diff --git a/bacula/src/stored/dev.h b/bacula/src/stored/dev.h index 95017fabb..c7dbbd2a2 100644 --- a/bacula/src/stored/dev.h +++ b/bacula/src/stored/dev.h @@ -388,6 +388,7 @@ public: void set_worm(bool is_worm) { m_is_worm = is_worm; } bool do_checksum() const { return (capabilities & CAP_BLOCKCHECKSUM) != 0; } int is_autochanger() const { return capabilities & CAP_AUTOCHANGER; } + bool is_virtual_autochanger() const; int requires_mount() const { return capabilities & CAP_REQMOUNT; } int is_removable() const { return capabilities & CAP_REM; } bool is_tape() const { return (dev_type == B_TAPE_DEV || diff --git a/bacula/src/stored/status.c b/bacula/src/stored/status.c index b56a08ff1..960b7edc8 100644 --- a/bacula/src/stored/status.c +++ b/bacula/src/stored/status.c @@ -716,7 +716,7 @@ static void send_blocked_status(DEVICE *dev, STATUS_PKT *sp) break; } /* Send autochanger slot status */ - if (dev->is_autochanger()) { + if (dev->is_autochanger() && !dev->is_virtual_autochanger()) { if (dev->get_slot() > 0) { len = Mmsg(msg, _(" Slot %d %s loaded in drive %d.\n"), dev->get_slot(), dev->is_open()?"is": "was last", dev->drive_index); diff --git a/bacula/src/stored/stored_conf.h b/bacula/src/stored/stored_conf.h index 31ad57de0..fff1e285a 100644 --- a/bacula/src/stored/stored_conf.h +++ b/bacula/src/stored/stored_conf.h @@ -258,7 +258,7 @@ public: DEDUPRES *dedup; /* pointer to dedup resource */ /* The following are set at runtime */ - DEVICE *dev; /* Pointer to phyical dev -- set at runtime */ + DEVICE *dev; /* Pointer to physical dev -- set at runtime */ AUTOCHANGER *changer_res; /* pointer to changer res if any */ int init_state; /* 0 -> 'B'uzy -> ( 'R'eady | 0 (retry) ) */