Commit 1ca401a1 authored by Gary Wong's avatar Gary Wong
Browse files

Fix bit rot when deleting addresses in addvpubaddr.

It assumed addresses were unused if node_id was NULL.  This used to be
true before the introduction of per-experiment dynamic address pools (when
public addresses were mapped one-to-one with VMs).  Unfortunately this
code was not updated when experiment address pools were added, and so
it would have permitted the deletion of currently assigned addresses.
parent 6053a89b
......@@ -92,7 +92,8 @@ for( $i = $first; $i <= $last; $i++ ) {
if( $delete ) {
$result = DBQueryWarn( "DELETE FROM virt_node_public_addr WHERE " .
"IP='$addr' AND node_id IS NULL" );
"IP='$addr' AND node_id IS NULL AND " .
"pid IS NULL AND eid IS NULL" );
} else {
$result = DBQueryWarn( "INSERT INTO virt_node_public_addr SET " .
"IP='$addr', mask='$netmask'" );
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment