Comment 4 for bug 1671891

Revision history for this message
Mike Pontillo (mpontillo) wrote :

Below is some more background on this one.

In `models/node.py` we have the following code:

    # Default IPv4 subnet link on an interface for this node. This is used to
    # define the default IPv4 route the node should use.
    gateway_link_ipv4 = ForeignKey(
        StaticIPAddress, default=None, blank=True, null=True,
        editable=False, related_name='+', on_delete=SET_NULL)

    # Default IPv6 subnet link on an interface for this node. This is used to
    # define the default IPv6 route the node should use.
    gateway_link_ipv6 = ForeignKey(
        StaticIPAddress, default=None, blank=True, null=True,
        editable=False, related_name='+', on_delete=SET_NULL)

The on_delete=SET_NULL means that there should never be a gateway_link_* field containing an IP address link if that IP address link has been removed.

This bug is incomplete until we can determine how the gateway_link_* fields have a value referencing a deleted StaticIPAddress.

The SQL in comment #3 will clean up the stale IP address link. If you can run the SQL and then determine the steps to reproduce the issue, please reopen this bug.