Adding IPADDRESS_TYPE.DISCOVERED to the condition at [0], causes the code to go to [1] when invoked by the release API, resulting in the delete of the IP similarly to how it is done in [2].
I also tested coding something similar to [3] which does ip=None and then ip.save, but in my testing the result was the same as ip.delete().
Adding IPADDRESS_ TYPE.DISCOVERED to the condition at [0], causes the code to go to [1] when invoked by the release API, resulting in the delete of the IP similarly to how it is done in [2].
I also tested coding something similar to [3] which does ip=None and then ip.save, but in my testing the result was the same as ip.delete().
[0] https:/ /github. com/maas/ maas/blob/ 04a456af79ebdfd 4858bd317f48e42 959cc97670/ src/maasserver/ models/ staticipaddress .py#L876
[1] https:/ /github. com/maas/ maas/blob/ 04a456af79ebdfd 4858bd317f48e42 959cc97670/ src/maasserver/ models/ interface. py#L1189
[2] https:/ /github. com/maas/ maas/blob/ 04a456af79ebdfd 4858bd317f48e42 959cc97670/ src/maasserver/ rpc/leases. py#L149
[3] https:/ /github. com/maas/ maas/blob/ 04a456af79ebdfd 4858bd317f48e42 959cc97670/ src/maasserver/ rpc/leases. py#L212