From: Kern Sibbald Date: Mon, 30 Apr 2012 19:12:03 +0000 (+0200) Subject: Fix updating of cached slots + error message numbering X-Git-Tag: Release-7.0.0~244 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7a7f26873790bd47f915a8ea0893ca54caa1d7d1;p=bacula%2Fbacula Fix updating of cached slots + error message numbering --- diff --git a/bacula/src/stored/autochanger.c b/bacula/src/stored/autochanger.c index 9d6b243930..653b6502ca 100644 --- a/bacula/src/stored/autochanger.c +++ b/bacula/src/stored/autochanger.c @@ -512,10 +512,17 @@ bool unload_dev(DCR *dcr, DEVICE *dev) save_dev = dcr->dev; /* save dcr device */ dcr->dev = dev; /* temporarily point dcr at other device */ - if (dev->get_slot() <= 0 && get_autochanger_loaded_slot(dcr) <= 0) { + /* Update slot if not set or not always_open */ + if (dev->get_slot() <= 0 || !dev->has_cap(CAP_ALWAYSOPEN)) { + get_autochanger_loaded_slot(dcr); + } + + /* Fail if we have no slot to unload */ + if (dev->get_slot() <= 0) { dcr->dev = save_dev; return false; } + save_slot = dcr->VolCatInfo.Slot; dcr->VolCatInfo.Slot = dev->get_slot(); @@ -543,7 +550,7 @@ bool unload_dev(DCR *dcr, DEVICE *dev) if (stat != 0) { berrno be; be.set_errno(stat); - Jmsg(jcr, M_INFO, 0, _("3995 Bad autochanger \"unload slot %d, drive %d\": ERR=%s.\n"), + Jmsg(jcr, M_INFO, 0, _("3997 Bad autochanger \"unload slot %d, drive %d\": ERR=%s.\n"), dev->get_slot(), dev->drive_index, be.bstrerror()); Dmsg3(100, "Bad autochanger \"unload slot %d, drive %d\": ERR=%s.\n", diff --git a/bacula/src/stored/dircmd.c b/bacula/src/stored/dircmd.c index 702c2490c1..0d86a3fca2 100644 --- a/bacula/src/stored/dircmd.c +++ b/bacula/src/stored/dircmd.c @@ -1104,7 +1104,7 @@ static bool changer_cmd(JCR *jcr) dev = dcr->dev; dev->dlock(); /* Use P to avoid indefinite block */ if (!dev->device->changer_res) { - dir->fsend(_("3995 Device \"%s\" is not an autochanger.\n"), + dir->fsend(_("3998 Device \"%s\" is not an autochanger.\n"), dev->print_name()); /* Under certain "safe" conditions, we can steal the lock */ } else if (safe_cmd || !dev->is_open() || dev->can_steal_lock()) {