Amanda-Users

Re: upgrade issue, 2.5.1 to 2.5.1p2

2006-11-27 11:13:41
Subject: Re: upgrade issue, 2.5.1 to 2.5.1p2
From: Jean-Louis Martineau <martineau AT zmanda DOT com>
To: Steve Newcomb <srn AT coolheads DOT com>
Date: Mon, 27 Nov 2006 11:05:15 -0500
Steve,

Could you try the attached patch for 2.5.1p2?

It remove the check for tapedev if tpchanger is defined.
All changer check tapedev if it require it.

Jean-Louis

Steve Newcomb wrote:
I'm using chg-multi.  It works under 2.5.1.  When I upgraded to
2.5.1p2, it stopped working, even with no changes to any configuration
file.  With 2.5.1p2, the backups are made to the holding disk, but
nothing gets written to tape.  There's a warning:

    WARNING: No tapedev specified

It's true that the tapedev parameter is not set in amanda.conf, but
that's because, according to the documentation, it's not supposed
to be set when using chg-multi.

As a temporary measure, I have re-installed 2.5.1 on my server
and it's working again, but I'd prefer to be running the same
version everywhere.

I'm attaching my amanda.conf and my chg-multi.conf, in case that
helps.

-- Steve

Steven R. Newcomb, Consultant
Coolheads Consulting

Co-editor, Topic Maps International Standard (ISO/IEC 13250)
Co-editor, draft Topic Maps -- Reference Model (ISO/IEC 13250-5)

srn AT coolheads DOT com
http://www.coolheads.com

direct: +1 540 951 9773
main:   +1 540 951 9774
fax:    +1 540 951 9775

208 Highview Drive
Blacksburg, Virginia 24060 USA


(Confidential to all US government personnel to whom this private
letter is not addressed and who are reading it in the absence of a
specific search warrant: You, along with the corrupt and pusillanimous
109th Congress, are co-conspiring to subvert the Constitution that you
are sworn to defend.  You can either refuse to commit this crime, or
you can expect to suffer criminal sanctions in the future, when the
current administration of the United States of America has been
replaced by one that respects the rule of law.  I do not envy you for
having to make this difficult choice, but I urge you to make it
wisely.)

diff -u -r --show-c-function --new-file --exclude-from=amanda.diff 
amanda-2.5.1p2.new/changer-src/chg-chio.pl.in 
amanda-2.5.1p2.new.no_tapedev/changer-src/chg-chio.pl.in
--- amanda-2.5.1p2.new/changer-src/chg-chio.pl.in       2006-07-25 
14:59:44.000000000 -0400
+++ amanda-2.5.1p2.new.no_tapedev/changer-src/chg-chio.pl.in    2006-11-27 
10:14:10.000000000 -0500
@@ -68,11 +68,13 @@ if ( "@USE_VERSION_SUFFIXES@" eq "yes" )
 
 chomp ($tapeDevice = `$sbindir/amgetconf$SUF tapedev 2>&1`);
 die "tapedev not found in amanda.conf"
-       if !$tapeDevice or $tapeDevice =~ m/no such parameter/;
+       if !$tapeDevice or $tapeDevice eq "" or
+           $tapeDevice =~ m/no such parameter/;
 chomp ($changerDevice = `$sbindir/amgetconf$SUF changerdev 2>&1`);
 chomp $changerDevice;
 die "changerdev not found in amanda.conf"
-       if !$changerDevice or $changerDevice =~ m/no such parameter/;
+       if !$changerDevice or $changerDevice eq "" or
+           $changerDevice =~ m/no such parameter/;
 
 #
 # Initialise a few global variables
diff -u -r --show-c-function --new-file --exclude-from=amanda.diff 
amanda-2.5.1p2.new/changer-src/chg-disk.sh.in 
amanda-2.5.1p2.new.no_tapedev/changer-src/chg-disk.sh.in
--- amanda-2.5.1p2.new/changer-src/chg-disk.sh.in       2006-07-04 
07:28:29.000000000 -0400
+++ amanda-2.5.1p2.new.no_tapedev/changer-src/chg-disk.sh.in    2006-11-27 
10:15:23.000000000 -0500
@@ -75,6 +75,10 @@ fi
 MYNAME=$0
 
 TAPE=`amgetconf$SUF tapedev`
+if test X"$TAPE" == X""; then
+    echo "<none> tapedev not specified in amanda.conf." 1>&2
+    exit 2
+fi
 SLOTDIR=`echo $TAPE | sed 's/^file://'`
 
 isinteger() {
diff -u -r --show-c-function --new-file --exclude-from=amanda.diff 
amanda-2.5.1p2.new/changer-src/chg-iomega.pl.in 
amanda-2.5.1p2.new.no_tapedev/changer-src/chg-iomega.pl.in
--- amanda-2.5.1p2.new/changer-src/chg-iomega.pl.in     2006-07-25 
14:59:44.000000000 -0400
+++ amanda-2.5.1p2.new.no_tapedev/changer-src/chg-iomega.pl.in  2006-11-27 
10:14:36.000000000 -0500
@@ -81,11 +81,13 @@ if ( "@USE_VERSION_SUFFIXES@" eq "yes" )
 
 chomp ($tapeDevice = `$sbindir/amgetconf$SUF tapedev 2>&1`);
 die "tapedev not found in amanda.conf"
-       if !$tapeDevice or $tapeDevice =~ m/no such parameter/;
+       if !$tapeDevice or $tapeDevice eq "" or
+           $tapeDevice =~ m/no such parameter/;
 chomp ($changerDevice = `$sbindir/amgetconf$SUF changerdev 2>&1`);
 chomp $changerDevice;
 die "changerdev not found in amanda.conf"
-       if !$changerDevice or $changerDevice =~ m/no such parameter/;
+       if !$changerDevice or $changerDevice eq "" or
+           $changerDevice =~ m/no such parameter/;
 
 #
 # Initialise a few global variables
diff -u -r --show-c-function --new-file --exclude-from=amanda.diff 
amanda-2.5.1p2.new/changer-src/chg-manual.sh.in 
amanda-2.5.1p2.new.no_tapedev/changer-src/chg-manual.sh.in
--- amanda-2.5.1p2.new/changer-src/chg-manual.sh.in     2006-07-04 
07:28:29.000000000 -0400
+++ amanda-2.5.1p2.new.no_tapedev/changer-src/chg-manual.sh.in  2006-11-27 
10:08:56.000000000 -0500
@@ -64,6 +64,12 @@ MAILER=@MAILER@
 ONLINEREGEX="ONLINE|READY|sense[_ ]key[(]0x0[)]|sense key error = 0|^er=0$|, 
mt_erreg: 0x0|^Current Driver State: at rest$"
 REPORTTO=`amgetconf$SUF mailto`
 tape=`amgetconf$SUF tapedev`
+
+if [ -z "$tape" ]; then
+  echo "<none> tapedev not specified in amanda.conf."
+  exit 2
+fi
+
 ORG=`amgetconf$SUF ORG`
 
 firstslot=1
diff -u -r --show-c-function --new-file --exclude-from=amanda.diff 
amanda-2.5.1p2.new/changer-src/chg-mtx.sh.in 
amanda-2.5.1p2.new.no_tapedev/changer-src/chg-mtx.sh.in
--- amanda-2.5.1p2.new/changer-src/chg-mtx.sh.in        2006-07-04 
07:28:29.000000000 -0400
+++ amanda-2.5.1p2.new.no_tapedev/changer-src/chg-mtx.sh.in     2006-11-27 
10:10:35.000000000 -0500
@@ -31,9 +31,19 @@ fi
 myname=$0
 
 tape=`amgetconf$SUF tapedev`
+if [ -z "$tape" ]; then
+  echo "<none> tapedev not specified in amanda.conf";
+  exit 2;
+fi
+
 TAPE=`amgetconf$SUF changerdev`; export TAPE # for mtx command
+if [ -z "$TAPE" ]; then
+  echo "<none> changerdev not specified in amanda.conf";
+  exit 2;
+fi
+
 if [ "$tape" = "/dev/null" -o "$TAPE" = "/dev/null" ]; then
-  echo "Both tapedev and changerdev must be specified in config file";
+  echo "<none> Both tapedev and changerdev must be specified in config file";
   exit 2;
 fi
 
diff -u -r --show-c-function --new-file --exclude-from=amanda.diff 
amanda-2.5.1p2.new/changer-src/chg-rth.pl.in 
amanda-2.5.1p2.new.no_tapedev/changer-src/chg-rth.pl.in
--- amanda-2.5.1p2.new/changer-src/chg-rth.pl.in        2002-01-06 
12:41:56.000000000 -0500
+++ amanda-2.5.1p2.new.no_tapedev/changer-src/chg-rth.pl.in     2006-11-27 
10:14:59.000000000 -0500
@@ -51,6 +51,9 @@ if (-x "$sbindir/ammt$SUF") {
 }
 
 $tapeDevice=`$sbindir/amgetconf$SUF tapedev`;
+die "tapedev not found in amanda.conf"
+       if !$tapeDevice or $tapeDevice eq "" or
+           $tapeDevice =~ m/no such parameter/;
 
 sub getCurrentTape {
 
diff -u -r --show-c-function --new-file --exclude-from=amanda.diff 
amanda-2.5.1p2.new/server-src/amcheck.c 
amanda-2.5.1p2.new.no_tapedev/server-src/amcheck.c
--- amanda-2.5.1p2.new/server-src/amcheck.c     2006-11-24 13:05:05.000000000 
-0500
+++ amanda-2.5.1p2.new.no_tapedev/server-src/amcheck.c  2006-11-27 
09:51:18.000000000 -0500
@@ -804,9 +804,11 @@ start_server_check(
        amfree(holdfile);
        tapename = getconf_str(CNF_TAPEDEV);
        if (tapename == NULL) {
-           fprintf(outf, "WARNING: No tapedev specified\n");
-           testtape = 0;
-           do_tapechk = 0;
+           if (getconf_str(CNF_TPCHANGER) == NULL) {
+               fprintf(outf, "WARNING: No tapedev or tpchanger specified\n");
+               testtape = 0;
+               do_tapechk = 0;
+           }
        } else if (strncmp(tapename, "null:", 5) == 0) {
            fprintf(outf,
                    "WARNING: tapedev is %s, dumps will be thrown away\n",
diff -u -r --show-c-function --new-file --exclude-from=amanda.diff 
amanda-2.5.1p2.new/server-src/amflush.c 
amanda-2.5.1p2.new.no_tapedev/server-src/amflush.c
--- amanda-2.5.1p2.new/server-src/amflush.c     2006-10-03 07:35:49.000000000 
-0400
+++ amanda-2.5.1p2.new.no_tapedev/server-src/amflush.c  2006-11-27 
09:29:32.000000000 -0500
@@ -93,6 +93,7 @@ main(
     char *errstr;
     struct tm *tm;
     char *tapedev;
+    char *tpchanger;
 
     safe_fd(-1, 0);
     safe_cd();
@@ -230,8 +231,9 @@ main(
                                NULL);
 
     tapedev = getconf_str(CNF_TAPEDEV);
-    if (tapedev == NULL) {
-       error("No tapedev specified");
+    tpchanger = getconf_str(CNF_TPCHANGER);
+    if (tapedev == NULL && tpchanger == NULL) {
+       error("No tapedev or tpchanger specified");
     }
 
     if(datearg) {
diff -u -r --show-c-function --new-file --exclude-from=amanda.diff 
amanda-2.5.1p2.new/server-src/amindexd.c 
amanda-2.5.1p2.new.no_tapedev/server-src/amindexd.c
--- amanda-2.5.1p2.new/server-src/amindexd.c    2006-11-24 13:10:38.000000000 
-0500
+++ amanda-2.5.1p2.new.no_tapedev/server-src/amindexd.c 2006-11-27 
09:33:35.000000000 -0500
@@ -970,9 +970,9 @@ tapedev_is(void)
        return 0;
     }
 
-    dbprintf(("%s: No tapedev or changer in config site.\n",
+    dbprintf(("%s: No tapedev or tpchanger in config site.\n",
               debug_prefix_time(NULL)));
-    reply(501, "Tapedev or changer not set in config file.");
+    reply(501, "Tapedev or tpchanger not set in config file.");
     return -1;
 }
 
diff -u -r --show-c-function --new-file --exclude-from=amanda.diff 
amanda-2.5.1p2.new/server-src/taper.c 
amanda-2.5.1p2.new.no_tapedev/server-src/taper.c
--- amanda-2.5.1p2.new/server-src/taper.c       2006-10-24 14:13:32.000000000 
-0400
+++ amanda-2.5.1p2.new.no_tapedev/server-src/taper.c    2006-11-27 
09:44:05.000000000 -0500
@@ -709,10 +709,12 @@ file_reader_side(
     taper_timestamp = newstralloc(taper_timestamp, cmdargs.argv[2]);
 
     if (tapedev == NULL) {
-       putresult(TAPE_ERROR, "[No tapedev defined]\n");
-       log_add(L_ERROR, "No tapedev defined");
-       dbprintf(("taper: No tapedev defined\n"));
-       exit(1);
+       if (getconf_str(CNF_TPCHANGER) == NULL) {
+           putresult(TAPE_ERROR, "[No tapedev or tpchanger defined]\n");
+           log_add(L_ERROR, "No tapedev or tpchanger defined");
+           dbprintf(("taper: No tapedev or tpchanger defined\n"));
+           exit(1);
+       }
     } else {
        tapedev = stralloc(tapedev);
     }
<Prev in Thread] Current Thread [Next in Thread>