Conversation
…nical#555) [LP#2162993](https://bugs.launchpad.net/maas/+bug/2162993) states that when an interface is set to "Unconfigured" (i.e. is not configured for an IP address), it still continues to act as the default gateway for a machine. Since the interface is unconfigured, this prevents the machine from receiving outbound network connectivity. Ideally, if there is another active and configured interface on a subnet with a valid gateway, MAAS should point the default_gateways reference to that interface. - This change can be made by excluding links with no IPs or are unconfigured when getting the default_gateways Resolves [LP:2162993](https://bugs.launchpad.net/maas/+bug/2162993)
There was a problem hiding this comment.
[maas-code-reviewer review]
LLM-generated review from https://github.com/canonical/maas-code-reviewer.
Intended to assist a human reviewer, not replace one — suggestions may be
incorrect, please verify before acting.
The proposed changes correctly address LP#2162993 by preventing unconfigured (LINK_UP) interfaces from being selected or retained as default gateways. The implementation logic matches the issue description perfectly, correctly checking for alloc_type = 1 (STICKY) with a NULL IP in the raw SQL, and utilizing get_interface_link_type() to filter out explicit gateway links. The provided test accurately simulates the condition and guards against regressions.
| staticip.alloc_type != 6 AND /* Ignore DISCOVERED */ | ||
| /* Ignore LINK_UP / Unconfigured (STICKY with no IP), but keep | ||
| AUTO links that have no IP assigned yet (pre-deployment) */ | ||
| NOT (staticip.alloc_type = 1 AND staticip.ip IS NULL) |
There was a problem hiding this comment.
Consider replacing the hardcoded enum value 1 with a string formatting parameter using IPADDRESS_TYPE.STICKY (or its .value). While 5 and 6 are already hardcoded here, reducing the reliance on magic numbers in raw SQL improves maintainability and makes the query's intent even clearer without reading the comments.
|
@AloizioMacedo is this something to merge or apply the "blocked" label? Could you please check? |
Note: This PR is being cherry-picked from commit 6ad3ba6.
LP#2162993 states that when an interface is set to "Unconfigured" (i.e. is not configured for an IP address), it still continues to act as the default gateway for a machine. Since the interface is unconfigured, this prevents the machine from receiving outbound network connectivity. Ideally, if there is another active and configured interface on a subnet with a valid gateway, MAAS should point the default_gateways reference to that interface.
Resolves LP:2162993
(Copied over from the original PR#555)