All the staticipaddress foreign key constraints are now taking into
account.
LP #1817305: Remove duplicate null ip records for the same interface and subnet Edit
This cleans up the data mostly, so that we don't have 10s of thousands
redundant records in the database slowing things down.
This patch doesn't handle the case where there are multiple interfaces
sharing the same ip address records, but only a few redundant records
should remain, so they won't affect performance.
LP #1817056: StaticIPAddress records with NULL ip keeps adding up
When the update_lease() RCP method gets called for an expired
lease, it adds a null IP record so that the interface stays linked to
the subnet. It didn't re-use existing such records, though.
LP: 1816452 - Loading network related page, such as 'interfaces' or 'add device' takes too long
The subnet.list websocket handler didn't scale with many observed IPs in
the database.
With the old code, subnet.list took 30 seconds when there were 40 000
observed IPs in the database. with the new code it takes 2.5 seconds.
There's a bug where we keep adding observered IP records in the database
with a null ip field. That was how we discovered the scaling problem in
the first place. But with the new code having those records in the
database doesn't affect performance.