Changeset 730 for trunk/cgi-bin


Ignore:
Timestamp:
05/21/15 14:55:10 (10 years ago)
Author:
Kris Deugau
Message:

/trunk

Fill in first mergeBlocks() working segment: Merge to container, keep
all allocations. See #8

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cgi-bin/IPDB.pm

    r729 r730  
    21272127
    21282128      if ($args{scope} eq 'keepall') {
     2129        # Create a new parent with the same info as the passed "primary".
     2130        $newparent->execute($newblock, $args{newtype}, $prime);
     2131        # and now retrieve the new parent ID
     2132        ($prime) = $dbh->selectrow_array("SELECT currval('allocations_id_seq')");
     2133        # Reparent the free blocks in the new block
     2134        $fbreparentsth->execute($prime, $binfo->{master_id}, $binfo->{city}, $newcontainerclass, $binfo->{vrf},
     2135            $binfo->{parent_id}, $newblock);
     2136        # keep existing allocations (including the original primary), just push them down a level
     2137        while (my ($pcidr,$peer_id,$ptype,$m_id) = $peersth->fetchrow_array) {
     2138          $reparentsth->execute($prime, $binfo->{master_id}, $peer_id);
     2139          # Fix up master_id on free blocks if we're merging a master block
     2140          $mfbsth->execute($binfo->{master_id}, $m_id) if $ptype eq 'mm';
     2141        }
     2142
    21292143      } elsif ($args{scope} =~ /^clear/) {
    21302144      } elsif ($args{scope} eq 'mergepeer') { # should this just be an else?
Note: See TracChangeset for help on using the changeset viewer.