[OpenAFS] status/progress for vos move?

Rich Sudlow rich@nd.edu
Mon, 22 Apr 2013 13:37:22 -0400


This is a multi-part message in MIME format.
--------------080601000800040805030000
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

On 04/22/2013 01:10 PM, hozer wrote:
> Is there any way to get something like what
> 'rsync --progress' does with vos move?
>
> If not, then what code do I change, and will
> this require a protocol change, or can this
> be done with the existing vos-to-server
> communication RPCs?
> _______________________________________________
> OpenAFS-info mailing list
> OpenAFS-info@openafs.org
> https://lists.openafs.org/mailman/listinfo/openafs-info
>

Attached is a program which we use that isn't exact but
works fairly well -  there may be changes necessary
for your cell but it's pretty simple.

Rich


-- 
Rich Sudlow
University of Notre Dame
Center for Research Computing - Union Station
310 West South St
South Bend, In 46601

(574) 631-7258 (office)
(574) 807-1046 (cell)

--------------080601000800040805030000
Content-Type: application/x-perl;
 name="tran_status.pl"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="tran_status.pl"

#!/usr/bin/perl
#
#Program to check AFS volume transactions and estimate percetage of completion <Requires Volume name as a parameter>
# 
#
use lib '/afs/crc.nd.edu/x86_64_linux/usr/local/lib/site_perl/current';
use Math::Round::Var;
use AFS::Command::VOS;

if ($#ARGV != 0)
{
  print "\n";
  print "Usage $0  <File Server || all> \n";
  print "\n";
  exit;  
}

    my $vos = AFS::Command::VOS->new();

    my $vos = AFS::Command::VOS->new
      (
       command                  => '/usr/sbin/vos',
      );

$svr_control = 0;
@svrs  = `vos listaddrs`; 
@SvAll = ();
$Ser_Num = 0;
if (lc($ARGV[0]) eq 'all' )
{
  foreach (@svrs)
  {
    chomp($_);
    $Ser_Num = push(@SvAll,$_)
  }  
}

if (lc($ARGV[0]) ne 'all' )
{
  for $ss ( @svrs )
  {
    chomp($ss);
    if ( (index($ss,$ARGV[0]) != -1 && length($ARGV[0]) == index($ss,'.')) || (index($ARGV[0],$ss) != -1) && (length($ss) == length($ARGV[0])))
    {
#    	print "$ss\n";
        $svr_control = 1;
        $Ser_Num = push(@SvAll,$ss)
    }  
  }
}

if ($svr_control == 0 && lc($ARGV[0]) ne 'all')
{
  print "\n";
  print "**** File Server => $ARGV[0] does not exist !!! *** \n";
  print "\n";
  exit;
}

#foreach (@SvAll)
#{
#  print "...\n";
#  print "Srv -> $_\n";
#}
#$print "Number -> $Ser_Num\n";

      $cell = 'crc.nd.edu';
      $rnd = Math::Round::Var->new(0);
print "\n";
foreach (@SvAll)
{
    $server = $_;
    my $result = $vos->status
      (
       server                   => $server,
       cell			=> $cell,
      ) || die $vos->errors();
    print "Server $server has -> " . $result->transactions() . " <- active transactions\n";

    foreach my $transaction ( $result->getTransactions() ) {
        $volname = $transaction->volume();
 #       print "There are active transactions for volume ID -> $volname \n";
 #       print "====================================================\n";
 #       print "\n";
          
      foreach $tranvol ($result->getTransactionByVolume($volname))
        {
         if(index(lc($tranvol->procedure),'restore') != -1)
         {
          $procedure = $tranvol->procedure; 
          $packread  = $tranvol->packetRead();
          print "\n";
          print "Procedure ->  $procedure\n";
          print "Pack Read ->  $packread\n";
        

          my $res = $vos->examine
          (
            id			=> $volname,
            cell		=> $cell,
          ) || print  "\n *** Can not get volume information - $volname from VLDB \n\n" ;
          
          if ( $res != 1) {
          
          foreach my $header ( $res->getVolumeHeaders() ) {
            my ($name,$server,$partition,$size) = ($header->name(),$header->server(),$header->partition(),$header->size());
            if ($size < 1)
            {
              $size = 1;
            }
            $pctcmpl	= ($packread/$size)*100*1.389;
            $pctcmpl	= $rnd->round($pctcmpl);
            $size	= $size/1024/1024;
            $size	= $rnd->round($size);
            if (length($name) ==0)
            {
              print "Tere s no information about volume\n";
            }
            else 
            {
              print "Vol.Name  -> $name\n";
              print "Server    -> $server\n";
              print "Partition -> $partition\n";
              print "Size      -> $size GB   ......  Completed -> $pctcmpl\%\n";
            }
            print "\n";
          }   }
         }
        }
    }
}


--------------080601000800040805030000--