Comment 1 for bug 1246737

Revision history for this message
Robert Kukura (rkukura) wrote : Re: ML2 plugin deletes port even if associated with multiple subnetrs on subnet deletion

In NeutronDbPluginV2.delete_subnet(), there is a statement "allocated.delete()" that I had erroneously interpreted as deleting the port at the DB level - probably mislead by the "# remove network owned ports" comment. I therefore changed Ml2Plugin.delete_subnet() to not call the base class and to instead use its own delete_port() method so that MechanismDrivers would be called for the auto-deleted port.

But, as Oleg discovered, the base class's "allocated.delete()" statement is actually just deleting the IPAllocation record, not the port itself. This is in effect removing the subnet's IP from the port's fixed_ips attribute. Therefore, instead of calling delete_port(), the Ml2Plugin.delete_subnet() method should be calling update_port() for each allocation to remove the IP from the port and call the MechanismDrivers.