Merge ~jjqq/maas:james-create-discovered-subnet-in-correct-fabric into maas:master

Proposed by Adam Collard
Status: Rejected
Rejected by: Adam Collard
Proposed branch: ~jjqq/maas:james-create-discovered-subnet-in-correct-fabric
Merge into: maas:master
Diff against target: 13 lines (+1/-1)
1 file modified
src/maasserver/models/interface.py (+1/-1)
Reviewer Review Type Date Requested Status
Alberto Donato (community) Approve
MAAS Lander Needs Fixing
Review via email: mp+439086@code.launchpad.net

Commit message

There is a use case:

    MAAS's DHCP is disabled, and an external DHCP sever is used for PXE boot.
    MAAS has 2 nics, named nic1, nic2. The nic2 is actually the one used for provisioning.
    MAAS based on the nic name order, created fabric-0, fabric-1 for them respectively. The fabric-1 is actually the one used for provisioning, while default fabric is fabric-0 which is almost usless.
    Commission a node, the node get an ip, the node UI shows its IP as "Auto assigned".
    MAAS detected the ip is bound coming from nic2 so it set the node's fabric=1 (more precisely, set vlan_id = id of untagged vlan of fabric-1)
    MAAS found the ip is not belonging to any existing subnets, so it automatically create a subnet, but it always create the subnet on fabric-0. This is the begining of all wrong things later.
    Deploy the node, also succeeded, when finished, it is node UI shows ip correctly
    Release the node, then the node status shows "Node must be attached to a network", this is because it could not find a proper subnet in fabric-1.
    The node become unavailable for Deploying unless Commission again.

So this MP create such discovered subnet in correct fabric.

To post a comment you must log in.
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b james-create-discovered-subnet-in-correct-fabric lp:~jjqq/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: FAILED
LOG: http://maas-ci.internal:8080/job/maas-tester/2160/consoleText
COMMIT: 4d5e41f567605fc7a1e01e201d8fadd0c9c94688

review: Needs Fixing
Revision history for this message
Alberto Donato (ack) wrote :

+1

review: Approve
Revision history for this message
Adam Collard (adam-collard) wrote :

Unmerged commits

4d5e41f... by jjqq <email address hidden>

Create discovered subnets in CORRECT fabric.

There is a use case:
- MAAS's DHCP is disabled, and an external DHCP sever is used for PXE boot.
- MAAS has 2 nics, named nic1, nic2. The nic2 is actually the one used for provisioning.
- MAAS based on the nic name order, created fabric-0, fabric-1 for them respectively. The fabric-1 is actually the one used for provisioning, while default fabric is fabric-0 which is almost usless.
- Commission a node, the node get an ip, the node UI shows its IP as "Auto assigned".
- MAAS detected the ip is bound coming from nic2 so it set the node's fabric=1 (more precisely, set vlan_id = id of untagged vlan of fabric-1)
- MAAS found the ip is not belonging to any existing subnets, so it automatically create a subnet, but it always create the subnet on fabric-0. This is the begining of all wrong things later.
- Deploy the node, also succeeded, when finished, it is node UI shows ip correctly
- Release the node, then the node status shows "Node must be attached to a network", this is because it could not find a proper subnet in fabric-1.
- The node become unavailable for Deploying unless Commission again.

So this PR create such discovered subnet in correct fabric.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/maasserver/models/interface.py b/src/maasserver/models/interface.py
2index a2c83ef..0ad0864 100644
3--- a/src/maasserver/models/interface.py
4+++ b/src/maasserver/models/interface.py
5@@ -891,7 +891,7 @@ class Interface(CleanSave, TimestampedModel):
6 # so that the user gets a chance to configure it. Note,
7 # however, that if this is already a managed cluster
8 # interface, a Fabric/VLAN will already have been created.
9- subnet = Subnet.objects.create_from_cidr(cidr)
10+ subnet = Subnet.objects.create_from_cidr(cidr, vlan=self.vlan)
11 maaslog.info(
12 f"Creating subnet {cidr} connected to interface "
13 f"{self} of node {self.get_node()}."

Subscribers

People subscribed via source and target branches