Bacula-users

Re: [Bacula-users] bconsole(8) mount / Autochanger Mount Logic in stored/autochanger.c

2008-09-12 11:39:36
Subject: Re: [Bacula-users] bconsole(8) mount / Autochanger Mount Logic in stored/autochanger.c
From: "John Drescher" <drescherjm AT gmail DOT com>
To: bseklecki AT collaborativefusion DOT com, bacula-users <Bacula-users AT lists.sourceforge DOT net>
Date: Fri, 12 Sep 2008 11:39:28 -0400
On Fri, Sep 12, 2008 at 11:35 AM, Brian A. Seklecki
<bseklecki AT collaborativefusion DOT com> wrote:
> The problem is at line 274 of stored/autochanger.c:
>
> Per the "autochanger API", inscribed in stone at
> dev-manual/Autochanger_Resource1.html, calls to "loaded" commands that
> return "zero" (0) imply that the drive is empty.
>
> Where as, in fact, slot zero could very well be the "source" slot of the
> tape loaded into the "drive".
>
> Instead, lets make that "-1", or "127", etc etc.... Instead of assuming
> that:
>
> - Slot 0 doesn't exist because it doesn't exist on GNU/Linux
> - Slot 0 can exist, but non-GNU/Linux changer scripts must:
>
>  - Decrement every incoming value
>  - Increment every outgoing value
>
> needlenose:/usr/ports/sysutils/bacula-server% diff
> -u 
> /usr/obj/usr/ports/sysutils/bacula-server/work/bacula-2.4.2/src/stored/autochanger.c
>  /tmp/autochanger.c
> --- 
> /usr/obj/usr/ports/sysutils/bacula-server/work/bacula-2.4.2/src/stored/autochanger.c
>         2008-07-02 16:49:44.000000000 -0400
> +++ /tmp/autochanger.c  2008-09-12 11:27:42.000000000 -0400
> @@ -274,11 +274,12 @@
>    Dmsg3(100, "run_prog: %s stat=%d result=%s", changer, status,
> results.c_str());
>    if (status == 0) {
>       loaded = str_to_int32(results.c_str());
> -      if (loaded > 0) {
> +      if (loaded > -1) {
>          Jmsg(jcr, M_INFO, 0, _("3302 Autochanger \"loaded? drive %d\",
> result is Slot %d.\n"),
>               drive, loaded);
>          dev->set_slot(loaded);
> -      } else {
> +      } else  {
> +       // -1 = Tape not loaded
> +       // Slot 0 is not a special
> +       // Slot 0 is not a beautiful and unique snowflake
> +       // Slot 0 is the same decaying organic matter as everything
> +       // else.
>          Jmsg(jcr, M_INFO, 0, _("3302 Autochanger \"loaded? drive %d\",
> result: nothing loaded.\n"),
>               drive);
>          dev->clear_slot();   /* unknown */
>
> You get the idea.
>

I would send this to the bacula-devel list as well or file a bug report.

John

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users