Amanda-Users

Re: amverifyrun in 2.5.0p1

2006-05-02 13:03:36
Subject: Re: amverifyrun in 2.5.0p1
From: Jean-Louis Martineau <martineau AT zmanda DOT com>
To: Sean Walmsley <sean AT fpp.nuclearsafetysolutions DOT com>
Date: Tue, 02 May 2006 13:00:09 -0400
Sean,

Could you try this patch.

Jean-Louis

Sean Walmsley wrote:
Has anyone successfully used the amverifyrun utility in version 2.5.0p1?
When I run it, I get the error message:

changer: got exit: 2 str: <none> Illegal slot: "-1"
amtape: could not load slot <none>: Illegal slot: "-1"
amtape: could not load slot <none>: Illegal slot: "-1"
amtape: pid 11950 finish time Sat Apr 29 22:20:47 2006

Looking at the amverifyrun script, it is grepping through the amdump
output looking for a line of the form:

taper: slot

This worked in 2.4.5p1 because the amdump file contained the following
lines:

------ from 2.4.5p1 amdump file -------
...
changer: opening pipe to: /home/amanda/MEGABAK1/libexec/chg-zd-mtx
-slot current
...
changer: got exit: 0 str: 10 /dev/rmt/0n
taper: slot 10: date X        label MBK1_34 (new tape)
taper: read label `MBK1_34' date `X'
taper: wrote label `MBK1_34' date `20060429'
driver: result time 2.658 from taper: TAPER-OK
...
---------------------------------------

It doesn't seem to work in 2.5p1 because the amdump file contains only
the following data following the chg-zd-mtx command:

------ from 2.5.0p1 amdump file -------
...
changer: opening pipe to: /home/amanda/MEGABAK1/libexec/chg-zd-mtx
-slot current
...
changer: got exit: 0 str: 11 /dev/rmt/0n
taper: wrote label `MBK1_35' date `20060429'
driver: result time 13.409 from taper: TAPER-OK
...
---------------------------------------

To me, it looks like the following lines of output are simply missing
from the 2.5.0p1 output:

taper: slot 10: date X        label MBK1_34 (new tape)
taper: read label `MBK1_34' date `X'

Given this, it would appear that amverifyrun doesn't have a hope of
working properly.

Any assistance you can provide would be much appreciated (whether its
a solution, a "me too", or "it works fine for me").

Thanks,


Sean Walmsley


=================================================================
Sean Walmsley                 sean AT fpp.nuclearsafetysolutions DOT com
Nuclear Safety Solutions Ltd.  416-592-4608 (V)  416-592-5528 (F)
700 University Ave M/S H04 J19, Toronto, Ontario, M5G 1X6, CANADA


--- amanda-2.5.1b1.new.bsdtcp/server-src/amverifyrun.sh.in      2005-06-03 
12:36:29.000000000 -0400
+++ amanda-2.5.1b1.new.bsdudp/server-src/amverifyrun.sh.in      2006-05-02 
12:03:32.000000000 -0400
@@ -52,10 +52,13 @@ FIRST_SLOT=`grep "taper: slot" $AMLOG | 
 new tape
 first labelstr match' | sed 1q | sed 's/://g' | awk '{print $3}'`
 if [ X"$FIRST_SLOT" = X"" ]; then
-  FIRST_SLOT='-1'
+  FIRST_SLOT=`grep "taper: slot: .* wrote label" $AMLOG | sed 1q | sed 
's/://g' | awk '{print $3}'`
+  if [ X"$FIRST_SLOT" = X"" ]; then
+    FIRST_SLOT='-1'
+  fi
 fi
 
-NBTAPES=`grep -c "taper: wrote label " $AMLOG`
+NBTAPES=`grep -c "taper: .*wrote label " $AMLOG`
 
 if [ X"$NBTAPES" != X"0" ]; then
   $AMVERIFY $CONFIG $FIRST_SLOT $NBTAPES
--- amanda-2.5.1b1.new.bsdtcp/server-src/taper.c        2006-04-11 
10:13:36.000000000 -0400
+++ amanda-2.5.1b1.new.bsdudp/server-src/taper.c        2006-05-02 
12:01:36.000000000 -0400
@@ -2343,6 +2343,8 @@ int label_tape()
     static int first_call = 1;
     char *timestamp;
     char *error_msg = NULL;
+    char *s, *r;
+    int slot = -1;
 
     if (taper_scan(NULL, &label, &timestamp, &tapedev, 
CHAR_taperscan_output_callback, &error_msg) < 0) {
        fprintf(stderr, "%s\n", error_msg);
@@ -2351,7 +2353,13 @@ int label_tape()
        amfree(timestamp);
        return 0;
     }
-    
+    if(error_msg) {
+       s = error_msg; r = NULL;
+       while(s=strstr(s,"slot ")) { s += 5; r=s; };
+       if(r) {
+           slot = atoi(r);
+       }
+    }
     if((tape_fd = tape_open(tapedev, O_WRONLY)) == -1) {
        if(errno == EACCES) {
            errstr = newstralloc(errstr,
@@ -2373,7 +2381,14 @@ int label_tape()
        return 0;
     }
 
-    fprintf(stderr, "taper: wrote label `%s' date `%s'\n", label, 
taper_timestamp);
+    if(slot > -1) {
+       fprintf(stderr, "taper: slot: %d wrote label `%s' date `%s'\n", slot,
+               label, taper_timestamp);
+    }
+    else {
+       fprintf(stderr, "taper: wrote label `%s' date `%s'\n", label,
+               taper_timestamp);
+    }
     fflush(stderr);
 
 #ifdef HAVE_LIBVTBLC
<Prev in Thread] Current Thread [Next in Thread>