IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 24, 2017, 5:07:43 PM (9 years ago)
Author:
watersc1
Message:

Non-working version due to issues with the replication blocks not
matching rawcheck.pl. Fixes all the typos in the file generation
code, however, which I wanted to have committed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippScripts/scripts/permcheck.pl

    r39901 r39955  
    2626my $staticskytool = can_run('staticskytool') or (warn "Can't find staticskytool" and $missing_tools = 1);
    2727my $fftool = can_run('fftool') or (warn "Can't find fftool" and $missing_tools = 1);
     28my $difftool = can_run('difftool') or (warn "Can't find difftool" and $missing_tools = 1);
    2829
    2930my ($server,$dbname,$stage,$stage_id,$do_cull,$save_log);
     
    5556    unless defined $stage_id;
    5657
     58my $ipprc = PS::IPP::Config->new( "GPC1" ) or die "Could not create config object.\n";
     59
    5760if ($save_log) {
    5861    my $time = time();
    59     my $logDest = "neb://any/perm_check/${stage}/${stage}_${stage_id}.${time}";
    60     my $ipprc = PS::IPP::Config->new( "GPC1" ) or die "Could not create config object.\n";
    61     $ipprc->redirect_output($logDest) or die "Could not redirect output to logfile ${logDest}\n";
     62    my $logDest = "neb://any/perm_check/${stage}/${stage}_${stage_id}";
     63    $ipprc->redirect_to_logfile($logDest) or die "Could not redirect output to logfile ${logDest}\n";
    6264}
    6365
     
    8284my %requirement_map = ();
    8385$requirement_map{ITC} = 1;
    84 $requirement_map{OFFSITE} = 1;
    85 $requirement_map{MRTCB} = 0;
     86$requirement_map{OFFSITE} = 0;
     87$requirement_map{MRTCB} = 1;
    8688
    8789## Second, construct a list of volumes, mapped to their site location, using the                                                     
     
    113115    $volume_map{$vol} = 'ITC';
    114116}
     117for ($i = 118; $i <= 122; $i++) {
     118    my $vol = sprintf("ipp%03d.0",$i);
     119    $volume_map{$vol} = 'MRTCB';
     120    $vol = sprintf("ipp%03d.1",$i);
     121    $volume_map{$vol} = 'MRTCB';
     122}
     123
     124
    115125for ($i = 0; $i <= 15; $i++) {
    116     if ($i == 6) { next; } # This isn't "offsite", it's with the rest of the maui cluster.                                           
     126    my $loc = 'OFFSITE';
     127    if ($i == 6) {
     128        $loc = 'MRTCB';
     129    } # This isn't "offsite", it's with the rest of the maui cluster.
    117130    if ($i == 9) { next; } # Not online                                                                                               
    118131
    119132    my $vol = sprintf("ippb%02d.0",$i);
    120     $volume_map{$vol} = 'OFFSITE';
     133    $volume_map{$vol} = $loc;
    121134    $vol = sprintf("ippb%02d.1",$i);
    122     $volume_map{$vol} = 'OFFSITE';
    123     $vol = sprintf("ippb%02d.2",$i);
    124     $volume_map{$vol} = 'OFFSITE';
     135    $volume_map{$vol} = $loc;
     136    if ($i <= 6) {
     137        $vol = sprintf("ippb%02d.2",$i);
     138        $volume_map{$vol} = $loc;
     139    }
    125140}
    126141
     
    166181# Not technically imfiles, but the nebulous check block already uses files as a variable.
    167182my $imfiles;
    168 if ($stage eq 'camera') {
     183if (($stage eq 'camera')||($stage eq 'cam')) {
     184    $stage = 'camera';
    169185    my $cmd = "$camtool -processedexp -cam_id $stage_id -dbname $dbname";
    170186    my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     
    211227}
    212228elsif ($stage eq 'ff') {
    213     my $cmd = "$fftool -result --ff_id $stage_id -dbname $dbname";
     229
     230    my $cmd = "$fftool -summary -ff_id $stage_id -dbname $dbname";
    214231    my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    215232        run(command => $cmd, verbose => 0);
     
    221238        &my_die("Unable to parse metadata from stagetool", $stage_id);
    222239}
    223 
     240elsif ($stage eq 'diff') {
     241    my $cmd = "$difftool -diffskyfile -diff_id $stage_id -dbname $dbname";
     242    my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     243        run(command => $cmd, verbose => 0);
     244    unless ($success) {
     245        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     246        &my_die("Unable to perform stagetool: $error_code", $stage_id);
     247    }
     248    $imfiles = $mdcParser->parse_list(join "", @$stdout_buf) or
     249        &my_die("Unable to parse metadata from stagetool", $stage_id);
     250}
    224251
    225252my $timer_start = time();
     
    230257                               'PPSTACK.UNCONV.EXP','PPSTACK.UNCONV.EXPNUM','PPSTACK.UNCONV.EXPWT.COMP'],
    231258                  'skycal' => ['PSASTRO.OUTPUT.CMF','PSPHOT.OUTPUT.CFF'],
    232                   'ff'     => ['PSPHOT.OUT.CMF.MEF','PSPHOT.OUTPUT.CFF','PSPHOT.FULLFORCE.OUTPUT']);
    233 
    234 my $timer_start = time();
    235 my $timer = time();
     259                  'ff'     => ['PSPHOT.OUT.CMF.MEF','PSPHOT.OUTPUT.CFF','PSPHOT.FULLFORCE.OUTPUT'],
     260                  'diff'   => ['PPSUB.OUTPUT.SOURCES','PPSUB.INVERSE.SOURCES','PSPHOT.PSF.SKY.SAVE','PSPHOT.BACKMDL.MEF','PPSUB.OUTPUT.KERNELS']
     261    );
    236262
    237263print "## permcheck.pl: $stage $stage_id $dbname $do_cull $do_ops $timer_start\n";
     
    242268    my $quality  = $entry->{quality};
    243269
    244     $timer = $time() - $timer_start;
     270    $timer = time() - $timer_start;
    245271    print "# $path_base $data_state $hostname $quality T: $timer\n";
    246272    if ($quality != 0) { next; }
     
    248274    my @keys = ();
    249275    foreach my $product (@{ $components{$stage} }) {
     276        print "# $product\n";
     277        my $is_done = 0;
    250278        if ($stage eq 'camera') {
    251279            if ($product eq 'PSASTRO.OUTPUT.MASK') {
     
    261289                    push @keys, $ipprc->filename($product,$path_base,$ota);
    262290                }           
     291                $is_done = 1;
    263292            }
    264293            elsif (($product eq 'PSPHOT.BACKMDL')||($product eq 'PSPHOT.PSF.RAW.SAVE')) {
     
    271300                    &my_die("Unable to perform stagetool: $error_code", $stage_id);
    272301                }
    273                 my $chip_$files = $mdcParser->parse_list(join "", @$stdout_buf) or
     302                my $chip_files = $mdcParser->parse_list(join "", @$stdout_buf) or
    274303                    &my_die("Unable to parse metadata from stagetool", $stage_id);
    275304               
     
    279308                    push @keys, $ipprc->filename($product,$chip_path_base,$class_id);
    280309                }
     310                $is_done = 1;
     311            }       
     312        }
     313        elsif ($stage eq 'ff') {
     314            if ($product ne 'PSPHOT.FULLFORCE.OUTPUT') {
     315                my $ffsum_cmd = "$fftool -result -ff_id $stage_id -dbname $dbname";
     316                my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     317                    run(command => $ffsum_cmd, verbose => 0);
     318                unless ($success) {
     319                    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     320                    &my_die("Unable to perform stagetool: $error_code", $stage_id);
     321                }
     322                my $ff_files = $mdcParser->parse_list(join "", @$stdout_buf) or
     323                    &my_die("Unable to parse metadata from stagetool", $stage_id);
     324               
     325                foreach my $ff_entry (@$ff_files) {
     326                    my $ff_path_base = $ff_entry->{path_base};
     327                    push @keys, $ipprc->filename($product,$ff_path_base);
     328                }
     329                $is_done = 1;
    281330            }
    282         }
    283         elsif (($stage eq 'ff')&&($product eq 'PSPHOT.FULLFORCE.OUTPUT')) {
    284             my $ffsum_cmd = "$fftool -summary -ff_id $stage_id -dbname $dbname";
    285             my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    286                 run(command => $ffsum_cmd, verbose => 0);
    287             unless ($success) {
    288                 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    289                 &my_die("Unable to perform stagetool: $error_code", $stage_id);
    290             }
    291             my $chip_$files = $mdcParser->parse_list(join "", @$stdout_buf) or
    292                 &my_die("Unable to parse metadata from stagetool", $stage_id);
    293            
    294             foreach my $chip_entry (@$chip_files) {
    295                 my $chip_path_base = $chip_entry->{path_base};
    296                 my $class_id       = $chip_entry->{class_id};
    297                 push @keys, $ipprc->filename($product,$chip_path_base,);
    298             }
     331
    299332        }           
    300         else {
     333        if ($is_done == 0) {
    301334            push @keys, $ipprc->filename($product,$path_base);
     335#           print "$product\n";
     336#           print ">> " . $ipprc->filename($product,$path_base) . "\n";
    302337        }
    303338# Do validation
     
    308343    printf("# Identified %d : %s\n",$#keys + 1, $timer);
    309344    foreach my $key (@keys) {
    310         # neb-stat level handling
    311         my $stat = $neb->stat($key);
    312         die "nebulous key: $key not found" unless $stat;   
    313         my $instances;
    314         my $md5sum = '';
    315 
    316         # This needs to be in an eval, because although we expect things to exist, they
    317         # may not.  This is a fatal error in rawcheck, but need not be here.
    318         eval {
    319             $instances = $neb->find_instances($key, 'any');
    320         };
    321         unless (defined($instances)) { print "## skipping due to zero instances\n"; next; }
    322         die "no instances found" unless $instances;   
     345        # Testing code.
     346        print "$key\n";
     347        next;
     348    }
     349
     350#       # neb-stat level handling
     351#       my $stat = $neb->stat($key);
     352#       die "nebulous key: $key not found" unless $stat;   
     353#       my $instances;
     354#       my $md5sum = '';
     355
     356#       # This needs to be in an eval, because although we expect things to exist, they
     357#       # may not.  This is a fatal error in rawcheck, but need not be here.
     358#       eval {
     359#           $instances = $neb->find_instances($key, 'any');
     360#       };
     361#       unless (defined($instances)) { print "## skipping due to zero instances\n"; next; }
     362#       die "no instances found" unless $instances;   
    323363       
    324         my $Ngood;
    325         my %good_instances = ();
    326         my %bad_instances  = ();
    327 
    328         my @files = map {URI->new($_)->file if $_} @$instances;
    329         my @validation = ();
    330 
    331         for (my $i = 0; $i <= $#files; $i++) {
    332             my ($instance_exists,$instance_md5sum,$instance_host,$instance_volume,$instance_site, $is_good);
    333             ($instance_host,$instance_volume) = parse_volume($files[$i]);
    334             $instance_site = $volume_map{$instance_volume};
    335             $is_good = 0;
    336 
    337             if (-e $files[$i]) {
    338                 $instance_exists = 1;
    339                 $existing_copies++;
    340                 $instance_md5sum = local_md5sum($files[$i]);
    341 
    342                 # This is bad, but I don't know what the right solution is.  We don't have
    343                 # the md5sum a priori.  I think this is also the only major change needed
    344                 # from rawcheck.pl
    345                 if (($md5sum eq '')&&($instance_md5sum ne 'd41d8cd98f00b204e9800998ecf8427e')) {
    346                     $md5sum = $instance_md5sum;
    347                 }
    348 
    349                 if ($instance_md5sum eq $md5sum) {
    350                     push @{ $good_instance{$instance_site} }, $i;
    351                     $is_good = 1;
    352                     $Ngood++;
    353                 }
    354                 else {
    355                     push @{ $bad_instances{$instance_site} }, $i;
    356                 }
    357             }
    358             else {
    359                 $instance_exists = 0;
    360                 $instance_md5sum = 'NON-EXISTANT';
    361                 push @{ $bad_instances{$instance_site} }, $i;
    362             }
     364#       my $Ngood;
     365#       my %good_instances = ();
     366#       my %bad_instances  = ();
     367
     368#       my @files = map {URI->new($_)->file if $_} @$instances;
     369#       my @validation = ();
     370
     371#       for (my $i = 0; $i <= $#files; $i++) {
     372#           my ($instance_exists,$instance_md5sum,$instance_host,$instance_volume,$instance_site, $is_good);
     373#           ($instance_host,$instance_volume) = parse_volume($files[$i]);
     374#           $instance_site = $volume_map{$instance_volume};
     375#           $is_good = 0;
     376
     377#           if (-e $files[$i]) {
     378#               $instance_exists = 1;
     379#               $existing_copies++;
     380#               $instance_md5sum = local_md5sum($files[$i]);
     381
     382#               # This is bad, but I don't know what the right solution is.  We don't have
     383#               # the md5sum a priori.  I think this is also the only major change needed
     384#               # from rawcheck.pl
     385#               if (($md5sum eq '')&&($instance_md5sum ne 'd41d8cd98f00b204e9800998ecf8427e')) {
     386#                   $md5sum = $instance_md5sum;
     387#               }
     388
     389#               if ($instance_md5sum eq $md5sum) {
     390#                   push @{ $good_instance{$instance_site} }, $i;
     391#                   $is_good = 1;
     392#                   $Ngood++;
     393#               }
     394#               else {
     395#                   push @{ $bad_instances{$instance_site} }, $i;
     396#               }
     397#           }
     398#           else {
     399#               $instance_exists = 0;
     400#               $instance_md5sum = 'NON-EXISTANT';
     401#               push @{ $bad_instances{$instance_site} }, $i;
     402#           }
    363403           
    364             $validation[$i] = sprintf("    % 3d %d %32s %s %s %s\n",
    365                                       $instance_exists,$is_good,$instance_md5sum,
    366                                       $files[$i],$instance_host,$instance_volume);
    367         }
    368 
    369         $time = time() - $timer_start;
    370         # object_id ext_id epoch available existing total timer
    371         printf("%s %s %s %d %d %d %d\n",@$stat[0],@$stat[1],@$stat[4],@$stat[6],$existing_copies,@$stat[7],$timer);
    372         # instance_exists is_good instance_md5sum file instance_host instance_volume
    373         my $val_string = join('',@validation);
    374         print "$val_string";
    375 
    376             # Decide what to do
    377 
    378     ## This block attempts to find an out-of-nebulous instance with a good md5sum,
    379     ## and substitutes it for the 0-th listed instance.  This gives us one good
    380     ## copy to work with.
    381         if ($Ngood == 0) {
    382         # DO something to attempt to fix this.
    383             my $deneb_key = $key; $deneb_key =~ s/.*?gpc/gpc/;
    384 
    385             open(DD,"/home/panstarrs/ipp/local/bin/deneb-locate.py $deneb_key 2> /dev/null |");
    386             my $good_file = '';
    387             while (<DD>) {
    388                 $_ =~ s/^\s+//;
    389                 my ($z,undef,$ff) = split /\s+/;
    390                 if (($ff)&&(-e $ff)) {
    391                     my $md_response = `md5sum $ff`;
    392                     if ($md_response =~ /$md5sum/) {
    393                         $good_file = (split /\s+/,$md_response)[1];
    394                     }
    395                 }
    396             }
    397             close(DD);
    398             if ($good_file eq '') {
    399                 die "No valid instance of key: $key";
    400             }
    401             else {
    402                 print "cp $good_file $files[0]\n";
    403                 if ($do_ops) {
    404                     system("cp $good_file $files[0]");
    405                 }
    406             }
    407             # Begin my best validation thought
    408             {
    409                 my $tmpmd5 = local_md5sum($files[0]);
    410                 if ($tmpmd5 ne $md5sum) {
    411                     die "Post-replication md5sum does not match! $tmpmd5 != $md5sum";
    412                 }
    413             }
    414             # End my best validation thought.
    415 
    416             $Ngood = 1;  # We now hand off this single valid instance object to be handled by the Ngood=1 case.
    417             ## We've done work here, so we can't do a cull this iteration.
    418             if ($do_cull == 1) { $do_cull = -1; }
    419         }
    420         ## We have more than zero bad copies.  We may cull some of these in the future, but we should try to
    421         ## leave everything in the best state possible.
    422         printf(">> %d %d\n",$Ngood, $#files + 1);
    423         if ($Ngood != $#files + 1) {
    424             my $good_copy;
    425             my $good_copy_index;
    426             foreach my $site_key (keys %good_instances) {
    427                 if ($#{ $good_instances{$site_key} } != -1) {
    428                     $good_copy_index = $good_instances{$site_key}[0];
    429                     $good_copy = $files[$good_copy_index];
    430                     last;
    431                 }
    432             }
    433             printf(">> GOOD: $good_copy\n");
    434             foreach my $site_key (keys %bad_instances) {
    435                 foreach my $bad_copy_index (@{ $bad_instances{$site_key} }) {
    436                     print "cp $good_copy $files[$bad_copy_index]\n";
    437                     if ($do_ops) {
    438                         system("cp $good_copy $files[$bad_copy_index]");
    439                     }
    440                     my $tmpmd5 = local_md5sum($files[$bad_copy_index]);
    441                     if ($tmpmd5 ne $md5sum) {
    442                     ## This isn't super critical, so we don't need to die here.
    443                         warn "Post-repair md5sum does not match! $tmpmd5 != $md5sum: $files[$bad_copy_index]";
    444                     }
    445                     else {
    446                     ## success
    447                         push @{ $good_instances{$site_key} }, $bad_copy_index;
    448                     }
    449                 }
    450             }
    451         ## We've done work here, so we can't do a cull this iteration.
    452             if ($do_cull == 1) { $do_cull = -1; }
    453         }
    454 
    455             ## We can now attempt to make replicated copies to the sites that require additional copies.
    456         foreach my $site_key (keys %requirement_map) {
    457             my $have_instances = $#{ $good_instances{$site_key} } + 1;
    458             print "## $site_key $have_instances $requirement_map{$site_key}\n";
    459             if ($#{ $good_instances{$site_key} } + 1 < $requirement_map{$site_key}) {
    460                 my $rep_vol = get_random_site_volume($site_key);
    461                 print "neb-replicate --volume $rep_vol  $key\n";
    462                 if ($do_ops) {
    463                     $neb->replicate($key,$rep_vol) or die "failed to replicate the single valid copy to the backup node";
    464                     if ($@) { die $@; }
     404#           $validation[$i] = sprintf("    % 3d %d %32s %s %s %s\n",
     405#                                     $instance_exists,$is_good,$instance_md5sum,
     406#                                     $files[$i],$instance_host,$instance_volume);
     407#       }
     408
     409#       $time = time() - $timer_start;
     410#         # object_id ext_id epoch available existing total timer
     411#       printf("%s %s %s %d %d %d %d\n",@$stat[0],@$stat[1],@$stat[4],@$stat[6],$existing_copies,@$stat[7],$timer);
     412#       # instance_exists is_good instance_md5sum file instance_host instance_volume
     413#       my $val_string = join('',@validation);
     414#       print "$val_string";
     415
     416#       # Decide what to do
     417       
     418#       if ($Ngood == 0) {
     419#           # If we have no copies, we can't do anything.
     420#           die "No valid instance of key: $key\n";
     421#       }
     422#       ## We have more than zero bad copies.  We may cull some of these in the future, but we should try to
     423#       ## leave everything in the best state possible.
     424#       printf(">> %d %d\n",$Ngood, $#files + 1);
     425#       my $site_key; # Scope issues?
     426
     427#       if ($Ngood != $#files + 1) {
     428#           my $good_copy;
     429#           my $good_copy_index;
     430#           foreach $site_key (keys %good_instances) {
     431#               if ($#{ $good_instances{$site_key} } != -1) {
     432#                   $good_copy_index = $good_instances{$site_key}[0];
     433#                   $good_copy = $files[$good_copy_index];
     434#                   last;
     435#               }
     436#           }
     437#           printf(">> GOOD: $good_copy\n");
     438#           foreach $site_key (keys %bad_instances) {
     439#               foreach my $bad_copy_index (@{ $bad_instances{$site_key} }) {
     440#                   print "cp $good_copy $files[$bad_copy_index]\n";
     441#                   if ($do_ops) {
     442#                       system("cp $good_copy $files[$bad_copy_index]");
     443#                   }
     444#                   my $tmpmd5 = local_md5sum($files[$bad_copy_index]);
     445#                   if ($tmpmd5 ne $md5sum) {
     446#                     ## This isn't super critical, so we don't need to die here.
     447#                       warn "Post-repair md5sum does not match! $tmpmd5 != $md5sum: $files[$bad_copy_index]";
     448#                   }
     449#                   else {
     450#                     ## success
     451#                       push @{ $good_instances{$site_key} }, $bad_copy_index;
     452#                   }
     453#               }
     454#           }
     455#         ## We've done work here, so we can't do a cull this iteration.
     456#           if ($do_cull == 1) { $do_cull = -1; }
     457#       }
     458
     459#       ## We can now attempt to make replicated copies to the sites that require additional copies.
     460#       foreach $site_key (keys %requirement_map) {
     461#           my $have_instances = $#{ $good_instances{$site_key} } + 1;
     462#           print "## $site_key $have_instances $requirement_map{$site_key}\n";
     463#           if ($#{ $good_instances{$site_key} } + 1 < $requirement_map{$site_key}) {
     464#               my $rep_vol = get_random_site_volume($site_key);
     465#               print "neb-replicate --volume $rep_vol  $key\n";
     466#               if ($do_ops) {
     467#                   $neb->replicate($key,$rep_vol) or die "failed to replicate the single valid copy to the backup node";
     468#                   if ($@) { die $@; }
    465469               
    466                 # Begin my best validation thought
    467                     system("sync") == 0 or die "Couldn't sync?";
    468                     my $uris = $neb->find_instances($key,$rep_vol);
    469                     @$uris = map {URI->new($_)->file if $_} @$uris;
    470                     my $tmpmd5 = local_md5sum(${ $uris }[0]);
    471 
    472                 my $validation_str = sprintf("% 3d %d %32s %s %s %s",
    473                                           -1,-1,$tmpmd5,
    474                                              ${ $uris }[0],"repl",$rep_vol);
    475                 print
    476                     join("\n" . " " x 4, $validation_str), "\n";
     470#                 # Begin my best validation thought
     471#                   system("sync") == 0 or die "Couldn't sync?";
     472#                   my $uris = $neb->find_instances($key,$rep_vol);
     473#                   @$uris = map {URI->new($_)->file if $_} @$uris;
     474#                   my $tmpmd5 = local_md5sum(${ $uris }[0]);
     475
     476#                 my $validation_str = sprintf("% 3d %d %32s %s %s %s",
     477#                                           -1,-1,$tmpmd5,
     478#                                            ${ $uris }[0],"repl",$rep_vol);
     479#                 print
     480#                     join("\n" . " " x 4, $validation_str), "\n";
    477481               
    478                     if ($tmpmd5 ne $md5sum) {
    479                         die "Post-replication md5sum does not match! $tmpmd5 != $md5sum";
    480                     }
    481                 # End my best validation thought.
    482                 }       
    483             ## We've done work here, so we can't do a cull this iteration.
    484                 if ($do_cull == 1) { $do_cull = -1; }
    485             }
    486         }
     482#                   if ($tmpmd5 ne $md5sum) {
     483#                       die "Post-replication md5sum does not match! $tmpmd5 != $md5sum";
     484#                   }
     485#                 # End my best validation thought.
     486#               }       
     487#             ## We've done work here, so we can't do a cull this iteration.
     488#               if ($do_cull == 1) { $do_cull = -1; }
     489#           }
     490#       }
    487491   
    488     ## Do culls if that's what we were going to do.
    489         if ($do_cull == -1) {
    490             die "Cull option passed, but files were modified in the scan/repair/replicate phase.  Not running cull!\n";
    491         }
    492         elsif ($do_cull == 1) {
    493         ## At this point, we should have no files in the bad_instances lists, because we've repaired them.
    494             foreach my $site_key (keys %good_instances) {
    495                 if ($#{ $good_instances{$site_key} } + 1 > $requirement_map{$site_key}) {
    496                     for ($i = $requirement_map{$site_key}; $i <= $#{ $good_instances{$site_key} }; $i++) {
    497                         my $cull_index = ${ $good_instances{$site_key} }[$i];
    498                     my ($instance_host,$instance_volume) = parse_volume($files[$cull_index]);
    499                     print "neb-cull --volume $instance_volume $key\n";
    500                     if ($do_ops) {
    501                         # The tilde here is to force hard volumes.  Don't touch it.
    502                         # Also: the 2 is a "minimum number of copies" restriction.  Let's not be crazy here.
    503                         $neb->cull($key,"~${instance_volume}",2) or die "failed to cull a superfluous instance";
    504                         if ($@) { die "$@"; }
    505                     }
    506                 } # End loop over extra instances
    507             } # End check for sites with extra instances
    508         } # End loop over sites.
    509     } # End cull
     492#     ## Do culls if that's what we were going to do.
     493#       if ($do_cull == -1) {
     494#           die "Cull option passed, but files were modified in the scan/repair/replicate phase.  Not running cull!\n";
     495#       }
     496#       elsif ($do_cull == 1) {
     497#         ## At this point, we should have no files in the bad_instances lists, because we've repaired them.
     498#           foreach my $site_key (keys %good_instances) {
     499#               if ($#{ $good_instances{$site_key} } + 1 > $requirement_map{$site_key}) {
     500#                   for ($i = $requirement_map{$site_key}; $i <= $#{ $good_instances{$site_key} }; $i++) {
     501#                       my $cull_index = ${ $good_instances{$site_key} }[$i];
     502#                     my ($instance_host,$instance_volume) = parse_volume($files[$cull_index]);
     503#                     print "neb-cull --volume $instance_volume $key\n";
     504#                     if ($do_ops) {
     505#                         # The tilde here is to force hard volumes.  Don't touch it.
     506#                         # Also: the 2 is a "minimum number of copies" restriction.  Let's not be crazy here.
     507#                         $neb->cull($key,"~${instance_volume}",2) or die "failed to cull a superfluous instance";
     508#                         if ($@) { die "$@"; }
     509#                     }
     510#                 } # End loop over extra instances
     511#             } # End check for sites with extra instances
     512#         } # End loop over sites.
     513#     } # End cull
    510514
    511515} ## End loop over imfiles.
Note: See TracChangeset for help on using the changeset viewer.