I've been looking at this issue for some time now, and have not been able to convince MAAS to leave in incorrect link in the gateway_link_* fields (which is apparently causing this issue). If a subnet link is completely deleted, the gateway_link_* fields on the machine should be automatically removed.
I see that there may be some related bugs here (for example, if you link a subnet, set it to be the gateway, and then change the link so that it no longer specifies a subnet - such as to be LINK_UP on that VLAN - then we might store a gateway that cannot be used). But I wasn't able to see the exact problem you saw.
One theory I have is that the database contains stale entries from an earlier version. Can you try the following workaround:
sudo maas-region dbshell
UPDATE maasserver_node
SET gateway_link_ipv4_id=NULL
WHERE gateway_link_ipv4_id NOT IN (
SELECT id from maasserver_staticipaddress);
I've been looking at this issue for some time now, and have not been able to convince MAAS to leave in incorrect link in the gateway_link_* fields (which is apparently causing this issue). If a subnet link is completely deleted, the gateway_link_* fields on the machine should be automatically removed.
I see that there may be some related bugs here (for example, if you link a subnet, set it to be the gateway, and then change the link so that it no longer specifies a subnet - such as to be LINK_UP on that VLAN - then we might store a gateway that cannot be used). But I wasn't able to see the exact problem you saw.
One theory I have is that the database contains stale entries from an earlier version. Can you try the following workaround:
sudo maas-region dbshell link_ipv4_ id=NULL link_ipv4_ id NOT IN ( staticipaddress );
UPDATE maasserver_node
SET gateway_
WHERE gateway_
SELECT id from maasserver_