]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
remove the meaning less "Drive X is not loaded" for virtual autochanger
authorAlain Spineux <alain@baculasystems.com>
Thu, 4 Nov 2021 17:12:27 +0000 (18:12 +0100)
committerEric Bollengier <eric@baculasystems.com>
Thu, 14 Sep 2023 11:56:56 +0000 (13:56 +0200)
- 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

bacula/src/stored/dev.c
bacula/src/stored/dev.h
bacula/src/stored/status.c
bacula/src/stored/stored_conf.h

index c7b3aecc29ae44423f0d454a5a18adec78dfff23..137e32d7be2e2f816f385018c1ae80338d24af2e 100644 (file)
@@ -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
 {
index 95017fabb0b8de2ddb720662f2abb4ef3a377462..c7dbbd2a292ea7c2f22cdc4bb7e87103a8ddc712 100644 (file)
@@ -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 ||
index b56a08ff1660023a0421cd701d65b028a245e3e2..960b7edc837a7a4030c1002fecc38bbf181f154b 100644 (file)
@@ -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);
index 31ad57de0efe99750a629ea9fa85ae2491143a02..fff1e285a73d8ca99dd40a1ba640592d42ba6183 100644 (file)
@@ -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) ) */