Changeset 739
- Timestamp:
- 05/29/15 18:06:09 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/IPDB.pm
r738 r739 1908 1908 } 1909 1909 1910 # Holder for freeblocks-to-delete. Should be impossible to have more than one... 1911 my %fbdel; 1912 1910 1913 # Loop over the new blocks that are not the base block 1911 1914 for (my $i = 1; $i <= $#newblocks; $i++) { … … 1929 1932 $nbsth->execute($args{id}, $newblocks[$i]->addr); 1930 1933 $newblocks[$i]++; 1931 } 1934 } # $binfo->{type} =~ /.d/ 1935 1936 # Check for free blocks larger than the new mask length, and split those as needed. 1937 if ($binfo->{type} =~ /.[cm]/) { 1938 # get a "list" of freeblocks bigger than the allocation in the parent. there's only one, right? 1939 my $fblist = $dbh->selectall_arrayref("SELECT id FROM freeblocks WHERE cidr >> ? AND parent_id = ? ", 1940 {Slice=>{}}, $newblocks[$i], $args{id}); 1941 if (@$fblist) { 1942 # create a new freeblock for the new block we created earlier 1943 $dbh->do(q{ 1944 INSERT INTO freeblocks (cidr, parent_id, master_id, city, routed,vrf) 1945 SELECT ? AS cidr, ? AS parent_id, master_id, city, routed, vrf FROM freeblocks 1946 WHERE id = ? 1947 }, undef, ($newblocks[$i], $nid, $fblist->[0]->{id}) ); 1948 $fbdel{$fblist->[0]->{id}}++; 1949 } 1950 } # $binfo->{type} =~ /.[cm]/ 1932 1951 1933 1952 # Reparent allocations, freeblocks, and pool IPs. … … 1943 1962 } 1944 1963 1964 ##fixme: 1965 # Still missing one edge case - megasplitting a large block such that "many" children also need to be split. 1966 # I'm going to call this "unsupported" because I really can't imagine a sane reason for doing this. 1967 # Should probably check and error out at least 1968 1945 1969 } # for (... @newblocks) 1970 1971 $dbh->do("DELETE FROM freeblocks WHERE id IN (".join(',', keys %fbdel).")"); 1946 1972 1947 1973 $dbh->commit;
Note:
See TracChangeset
for help on using the changeset viewer.