Jean-Francois,

amtoc was not fixed for the new log file format in 3.4
Try the attached patch.

Jean-Louis

On 15/12/16 02:46 PM, Jean-Francois Malouin wrote:
Hi,

Still getting acquainted with amanda-3.4.1 new feature but for the
moment I'm having problems correctly generating table-of-content of
tapes using the recipe at the end of 'man amtoc':


~# logdir=`~amanda/sbin/amgetconf top logdir` ; log=`ls -1t $logdir/log.*.[0-9] 
| head -1`

~# echo $logdir
/opt/amanda/usr/adm/amanda/top/log

~# echo $log
/opt/amanda/usr/adm/amanda/top/log/log.20161214095300.0

~# su amanda -c "~amanda/sbin/amtoc -t -a $log"
Argument ""POOL:tapepool-bic-neo-t48"" isn't numeric in numeric ne (!=) at 
/opt/amanda/sbin/amtoc line 173, <IF> line 29.
Argument ""POOL:tapepool-bic-neo-t48"" isn't numeric in numeric ne (!=) at 
/opt/amanda/sbin/amtoc line 173, <IF> line 30.
...
Argument ""POOL:tapepool-bic-neo-t48"" isn't numeric in numeric ne (!=) at 
/opt/amanda/sbin/amtoc line 173, <IF> line 131.

The generated toc file name in $log is strange:

"POOL:tapepool-bic-neo-t48".toc

(with the quotes on) and here is its content:

   #  Server:/partition                       date            lev
   #  size[Kb]
   0  "POOL:tapepool-bic-neo-t48":            20161214095300    -
-
"PO  NEO-T48-B00025:1                        tutor172        201 *0
"PO  NEO-T48-B00025:2                        tutor172        201 *0
"PO  NEO-T48-B00025:3                        tutor172        201 *0
"PO  NEO-T48-B00025:4                        tutor172        201 *0
"PO  NEO-T48-B00025:5                        tutor172        201 *0
"PO  NEO-T48-B00025:6                        tutor172        201 *0
"PO  NEO-T48-B00025:7                        tutor172        201 *0
"PO  NEO-T48-B00025:8                        tutor172        201 *0
"PO  NEO-T48-B00025:9                        tutor172        201 *0
"PO  NEO-T48-B00025:10                       tutor172        201 *0
"PO  NEO-T48-B00025:11                       tutor172        201 *0
      "ST:bic-storage":"POOL:tapepool-bic-neo tutor172        201  0
  11  total:on_tape                           -                 - 218033632
   -  total:origin                            -                 - 799002302

$log is attached.
I guess this is related to the new storage and pool stuff.

cheers,
jf


diff --git a/server-src/amtoc.pl b/server-src/amtoc.pl
index f62dcef..3f16f6b 100644
--- a/server-src/amtoc.pl
+++ b/server-src/amtoc.pl
@@ -160,31 +160,67 @@ while ( <$IF> ) {
     $flash_mode = 1;
     next;
   }
-  if ( ! /^([A-Z]+) taper (\S+) (\S+) (\S+) (\S+) (\S+)/) { next;}
+  if ( ! /^([A-Z]+) taper \S+ \S+ (\S+) (\S+) (\S+) (\S+) (\S+)/) { next;}
   # $_ = $1;
   if (/PART taper/) {
-    /^([A-Z]+) taper (\S+) (\S+) (\S+) (\S+) (\S+) (\S+) (\S+)/;
-    $filenum = $3;
-    $host = $4;
-    $disk = $5;
-    $date = $6;
-    $chunk = $7;
-    $level = $8;
+    if (/^([A-Z]+) taper ("ST:\S+") ("POOL:\S+") (\S+) (\S+) (\S+) (\S+) (\S+) (\S+) (\S+)/) {
+        $storage = $2;
+        $pool = $3;
+        $label = $4;
+        $filenum = $5;
+        $host = $6;
+        $disk = $7;
+        $date = $8;
+        $chunk = $9;
+        $level = $10;
+    } else {
+        /^([A-Z]+) taper (\S+) (\S+) (\S+) (\S+) (\S+) (\S+) (\S+)/;
+        $label = $2;
+        $filenum = $3;
+        $host = $4;
+        $disk = $5;
+        $date = $6;
+        $chunk = $7;
+        $level = $8;
+    }
     if ($filenum != $filenumber) {
       # This should not be possible */
       $filenumber = $filenum;
     }
+  } elsif (/START taper/) {
+    if (/^([A-Z]+) taper (\S+) (\S+) ("ST:\S+") ("POOL:\S+") (\S+) (\S+) (\S+)/) {
+        $date = $3;
+        $storage = $4;
+        $pool = $5;
+        $label = $7;
+        $level = $7;
+    } else {
+        /^([A-Z]+) taper (\S+) (\S+) (\S+) (\S+) (\S+)/;
+        $date = $3;
+        $label = $4;
+        $level = $5;
+    }
   } else {
-    /^([A-Z]+) taper (\S+) (\S+) (\S+) (\S+) (\S+)/;
-    $host = $2;
-    $disk = $3;
-    $date = $4;
-    $chunk = $5;
-    $level = $6;
+    if (/^([A-Z]+) taper ("ST:\S+") ("POOL:\S+") (\S+) (\S+) (\S+) (\S+) (\S+)/) {
+        $storage = $2;
+        $pool = $3;
+        $host = $4;
+        $disk = $5;
+        $date = $6;
+        $chunk = $7;
+        $level = $8;
+    } else {
+        /^([A-Z]+) taper (\S+) (\S+) (\S+) (\S+) (\S+)/;
+        $host = $2;
+        $disk = $3;
+        $date = $4;
+        $chunk = $5;
+        $level = $6;
+    }
   }
   switch: {
     /START taper/ && do {
-      $tocfilename=&tfn($chunk) if ($#subs >= 0);
+      $tocfilename=&tfn($label) if ($#subs >= 0);
       if (!$tocfilename || ($tocfilename eq '-')) {$OF=STDOUT;}
       else {
           die ("Cannot open tocfile $tocfilename") unless open(OF,">$tocfilename");
@@ -204,7 +240,7 @@ while ( <$IF> ) {
 
       $filenumber=0;
       &pr("#","Server","/partition","date", "level","size[Kb]","part");
-      &pr("$filenumber","$chunk","","$disk","-","-","-");
+      &pr("$filenumber","$label","","$date","-","-","-");
       last switch; };
     /^(?:SUCCESS|CHUNK|PART|DONE) taper/ && do {
       if(/SUCCESS/){
@@ -255,13 +291,17 @@ while ( <$IF> ) {
   }
   $filenumber += 1;
 }
-if (defined($flash_mode)) {
-  &pr("-","total","origin","-","not","available","-");
+if (defined $OF) {
+    if (defined($flash_mode)) {
+      &pr("-","total","origin","-","not","available","-");
+    } else {
+      &pr("-","total","origin","-","-","$tot_or_size","-");
+    }
+    close OF;
 } else {
-  &pr("-","total","origin","-","-","$tot_or_size","-");
+    print "no dump on that run\n";
 }
 close $IF;
-close OF;
 
 
 format OF =

Reply via email to