* Jean-Louis Martineau <jmartin...@carbonite.com> [20161216 09:29]:
> Jean-Francois,
> 
> amtoc was not fixed for the new log file format in 3.4
> Try the attached patch.

Thanks Jean-Louis.

I have applied the patch and amtoc now generates toc of tapes but I
wonder at what they show: there is a mismatch between the amtoc output
actual physical content of the tape:

~# cat $logdir/NEO-T48-B00022.toc
  #  Server:/partition                       date            lev size[Kb]
  0  NEO-T48-B00022:                         20161214095300    - -
  1  tutor172:/raid/ipl_scratch15/Mahsa/Catr 20161213113021    0 *0
  1  tutor172:/raid/ipl_scratch15/Mahsa/ADNI 20161213113021    0 *0
  2  tutor172:/raid/ipl_scratch15/Mahsa/Catr 20161213113021    0 *0
  2  tutor172:/raid/ipl_scratch15/Mahsa/ADNI 20161213113021    0 *0
  3  tutor172:/raid/ipl_scratch15/Mahsa/Catr 20161213113021    0 *0
  4  tutor172:/raid/ipl_scratch15/Mahsa/Catr 20161213113021    0 *0
  3  tutor172:/raid/ipl_scratch15/Mahsa/ADNI 20161213113021    0 *0
  5  tutor172:/raid/ipl_scratch15/Mahsa/Catr 20161213113021    0 *0
  4  tutor172:/raid/ipl_scratch15/Mahsa/ADNI 20161213113021    0 *0
  6  tutor172:/raid/ipl_scratch15/Mahsa/Catr 20161213113021    0 *0
  7  tutor172:/raid/ipl_scratch15/Mahsa/Catr 20161213113021    0 *0
  5  tutor172:/raid/ipl_scratch15/Mahsa/ADNI 20161213113021    0 *0
  8  tutor172:/raid/ipl_scratch15/Mahsa/Catr 20161213113021    0 *0
  6  tutor172:/raid/ipl_scratch15/Mahsa/ADNI 20161213113021    0 *0
  9  tutor172:/raid/ipl_scratch15/Mahsa/Catr 20161213113021    0 *0
 10  tutor172:/raid/ipl_scratch15/Mahsa/Catr 20161213113021    0 *0
  7  tutor172:/raid/ipl_scratch15/Mahsa/ADNI 20161213113021    0 *0
 11  tutor172:/raid/ipl_scratch15/Mahsa/Catr 20161213113021    0 *0
     tutor172:/raid/ipl_scratch15/Mahsa/Catr 20161213113021    0  0
  8  tutor172:/raid/ipl_scratch15/Mahsa/ADNI 20161213113021    0 *0
  9  tutor172:/raid/ipl_scratch15/Mahsa/ADNI 20161213113021    0 *0
 10  tutor172:/raid/ipl_scratch15/Mahsa/ADNI 20161213113021    0 *0
 11  tutor172:/raid/ipl_scratch15/Mahsa/ADNI 20161213113021    0 *0
 12  total:on_tape                           -                 - 230686720

However moving through the tape with mt and extracting the headers of
tape files with dd shows:

~# ~malin/bin/lstape /dev/nst0
AMANDA: SPLIT_FILE 20161213113021 tutor172 /raid/ipl_scratch15/Mahsa/Catriona  
part 1/-1  lev 0 comp N program APPLICATION
AMANDA: SPLIT_FILE 20161213113021 tutor172 /raid/ipl_scratch15/Mahsa/Catriona  
part 2/-1  lev 0 comp N program APPLICATION
AMANDA: SPLIT_FILE 20161213113021 tutor172 /raid/ipl_scratch15/Mahsa/Catriona  
part 3/-1  lev 0 comp N program APPLICATION
AMANDA: SPLIT_FILE 20161213113021 tutor172 /raid/ipl_scratch15/Mahsa/Catriona  
part 4/-1  lev 0 comp N program APPLICATION
AMANDA: SPLIT_FILE 20161213113021 tutor172 /raid/ipl_scratch15/Mahsa/Catriona  
part 5/-1  lev 0 comp N program APPLICATION
AMANDA: SPLIT_FILE 20161213113021 tutor172 /raid/ipl_scratch15/Mahsa/Catriona  
part 6/-1  lev 0 comp N program APPLICATION
AMANDA: SPLIT_FILE 20161213113021 tutor172 /raid/ipl_scratch15/Mahsa/Catriona  
part 7/-1  lev 0 comp N program APPLICATION
AMANDA: SPLIT_FILE 20161213113021 tutor172 /raid/ipl_scratch15/Mahsa/Catriona  
part 8/-1  lev 0 comp N program APPLICATION
AMANDA: SPLIT_FILE 20161213113021 tutor172 /raid/ipl_scratch15/Mahsa/Catriona  
part 9/-1  lev 0 comp N program APPLICATION
AMANDA: SPLIT_FILE 20161213113021 tutor172 /raid/ipl_scratch15/Mahsa/Catriona  
part 10/-1  lev 0 comp N program APPLICATION
AMANDA: SPLIT_FILE 20161213113021 tutor172 /raid/ipl_scratch15/Mahsa/Catriona  
part 11/-1  lev 0 comp N program APPLICATION
AMANDA: SPLIT_FILE 20161214095300 tutor172 /raid/ipl_scratch15/Mahsa/Catriona  
part 1/-1  lev 0 comp N program APPLICATION
AMANDA: SPLIT_FILE 20161214095300 tutor172 /raid/ipl_scratch15/Mahsa/Catriona  
part 2/-1  lev 0 comp N program APPLICATION
AMANDA: SPLIT_FILE 20161214095300 tutor172 /raid/ipl_scratch15/Mahsa/Catriona  
part 3/-1  lev 0 comp N program APPLICATION
AMANDA: SPLIT_FILE 20161214095300 tutor172 /raid/ipl_scratch15/Mahsa/Catriona  
part 4/-1  lev 0 comp N program APPLICATION
AMANDA: SPLIT_FILE 20161214095300 tutor172 /raid/ipl_scratch15/Mahsa/Catriona  
part 5/-1  lev 0 comp N program APPLICATION
AMANDA: SPLIT_FILE 20161214095300 tutor172 /raid/ipl_scratch15/Mahsa/Catriona  
part 6/-1  lev 0 comp N program APPLICATION
AMANDA: SPLIT_FILE 20161214095300 tutor172 /raid/ipl_scratch15/Mahsa/Catriona  
part 7/-1  lev 0 comp N program APPLICATION
AMANDA: SPLIT_FILE 20161214095300 tutor172 /raid/ipl_scratch15/Mahsa/Catriona  
part 8/-1  lev 0 comp N program APPLICATION

This config has 'taper-parallel-write' set to 2 and during the amdump
run both tape drives were in use at the same time at some point. Could
this explain the discrepancy between both outputs?

thanks,
jf


> 
> 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 =


-- 
Jean-Francois Malouin | IT Operations and Infrastructure
McConnell Brain Imaging Centre | MNI | McGill University

Reply via email to