From: Kern Sibbald Date: Sat, 11 Jun 2005 18:34:36 +0000 (+0000) Subject: Correct some reservation problems in SD when no devices X-Git-Tag: Release-7.0.0~8707 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=699dc164f21d7fea3fed2ccecff417b2c0691eb4;p=bacula%2Fbacula Correct some reservation problems in SD when no devices are available. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@2120 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/kes-1.37 b/bacula/kes-1.37 index beef32cb93..47c327953c 100644 --- a/bacula/kes-1.37 +++ b/bacula/kes-1.37 @@ -5,6 +5,8 @@ General: Changes to 1.37.22: 10Jun05 +- Correct some reservation problems in SD when no devices + are available. - Start removing #ifdef HAVE_TLS by sneaky tricks. - Begin implementation of TLS in wx-console - Remove ignoring SIGCHLD from console. diff --git a/bacula/src/stored/mount.c b/bacula/src/stored/mount.c index 499335829c..94d6781e9e 100644 --- a/bacula/src/stored/mount.c +++ b/bacula/src/stored/mount.c @@ -27,7 +27,6 @@ static void mark_volume_not_inchanger(DCR *dcr); - /* * If release is set, we rewind the current volume, * which we no longer want, and ask the user (console) diff --git a/bacula/src/stored/reserve.c b/bacula/src/stored/reserve.c index c4ca08d802..36f093d414 100644 --- a/bacula/src/stored/reserve.c +++ b/bacula/src/stored/reserve.c @@ -48,7 +48,7 @@ public: /* Reserve context */ class RCTX { public: - alist errors; + alist *errors; JCR *jcr; char *device_name; DIRSTORE *store; @@ -228,7 +228,9 @@ static bool use_storage_cmd(JCR *jcr) DCR *dcr = NULL; RCTX rctx; rctx.jcr = jcr; +#ifdef implemented char *error; +#endif /* * If there are multiple devices, the director sends us @@ -310,7 +312,7 @@ static bool use_storage_cmd(JCR *jcr) } else if (stat == 0) { /* device busy */ need_wait = true; } - rctx.errors.push(bstrdup(jcr->errmsg)); +// rctx->errors.push(bstrdup(jcr->errmsg)); } } /* @@ -320,11 +322,13 @@ static bool use_storage_cmd(JCR *jcr) if (!need_wait || !wait_for_device(jcr, first)) { break; } +#ifdef implemented first = false; - for (error=(char*)rctx.errors.first(); error; - error=(char*)rctx.errors.next()) { + for (error=(char*)rctx->errors.first(); error; + error=(char*)rctx->errors.next()) { free(error); } +#endif } if (verbose) { unbash_spaces(dir->msg); @@ -344,10 +348,12 @@ static bool use_storage_cmd(JCR *jcr) Jmsg(jcr, M_INFO, 0, _("Failed command: %s\n"), jcr->errmsg); } Jmsg(jcr, M_FATAL, 0, _("Could not find an available device.\n")); - for (error=(char*)rctx.errors.first(); error; - error=(char*)rctx.errors.next()) { +#ifdef implemented + for (error=(char*)rctx->errors.first(); error; + error=(char*)rctx->errors.next()) { Jmsg(jcr, M_INFO, 0, "%s", error); } +#endif bnet_fsend(dir, BAD_use, jcr->errmsg); Dmsg1(100, ">dird: %s\n", dir->msg); ok = false; @@ -362,10 +368,12 @@ done: if (!ok && dcr) { free_dcr(dcr); } - for (error=(char*)rctx.errors.first(); error; - error=(char*)rctx.errors.next()) { +#ifdef implemented + for (error=(char*)rctx->errors.first(); error; + error=(char*)rctx->errors.next()) { free(error); } +#endif return ok; } @@ -443,7 +451,7 @@ static int reserve_device(RCTX &rctx) rctx.device->dev = init_dev(rctx.jcr, NULL, rctx.device); } if (!rctx.device->dev) { - if (dev_cap(rctx.device->dev, CAP_AUTOCHANGER)) { + if (rctx.device->changer_res) { Jmsg(rctx.jcr, M_WARNING, 0, _("\n" " Device \"%s\" in changer \"%s\" requested by DIR could not be opened or does not exist.\n"), rctx.device->hdr.name, rctx.device_name); @@ -452,7 +460,7 @@ static int reserve_device(RCTX &rctx) " Device \"%s\" requested by DIR could not be opened or does not exist.\n"), rctx.device_name); } - return 0; + return -1; /* no use waiting */ } Dmsg1(100, "Found device %s\n", rctx.device->hdr.name); dcr = new_dcr(rctx.jcr, rctx.device->dev);