Merge lp:~mpontillo/maas/fix-0146-populate-subnets-bug-1519247-trunk into lp:~maas-committers/maas/trunk

Proposed by Mike Pontillo
Status: Merged
Approved by: Mike Pontillo
Approved revision: no longer in the source branch.
Merged at revision: 4517
Proposed branch: lp:~mpontillo/maas/fix-0146-populate-subnets-bug-1519247-trunk
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 39 lines (+16/-13)
1 file modified
src/maasserver/models/migrations/populate_subnets_helper.py (+16/-13)
To merge this branch: bzr merge lp:~mpontillo/maas/fix-0146-populate-subnets-bug-1519247-trunk
Reviewer Review Type Date Requested Status
Blake Rouse (community) Approve
Review via email: mp+278413@code.launchpad.net

Commit message

Fix migration to not require a Subnet when migrating each NodeGroupInterface, if the subnet_mask is not present.

To post a comment you must log in.
Revision history for this message
Mike Pontillo (mpontillo) wrote :

Note: there are no accompanying unit tests since this is a migration. I tested this manually by upgrading from 1.8.3 to a patched 1.9 rc2.

Revision history for this message
Andres Rodriguez (andreserl) wrote :

Can you explain a by more why is this ? Also, please have Blake review
this. I have tested this before and the upgrade went fine without any
issues.

Also, why didn't you block rc2 ?

On Tuesday, November 24, 2015, Mike Pontillo <email address hidden>
wrote:

> Note: there are no accompanying unit tests since this is a migration. I
> tested this manually by upgrading from 1.8.3 to a patched 1.9 rc2.
> --
>
> https://code.launchpad.net/~mpontillo/maas/fix-0146-populate-subnets-bug-1519247-trunk/+merge/278413
> You are subscribed to branch lp:maas.
>

--
Andres Rodriguez (RoAkSoAx)
Ubuntu Server Developer
MSc. Telecom & Networking
Systems Engineer

Revision history for this message
Mike Pontillo (mpontillo) wrote :

>
> Can you explain a by more why is this ? Also, please have Blake review
> this. I have tested this before and the upgrade went fine without any
> issues.
>

This occurs whenever you try to migrate a cluster interface that has no
subnet_mask. Such a configuration is valid if you are managing nodes
without DHCP or DNS.

80%+ of people will not see this because they'll either fill in a subnet
mask, or the MAAS cluster will do it for them when it discovers their
interfaces.

> Also, why didn't you block rc2?
>

I don't understand the question. You sent out the RC2 announcement minutes
before commenting on this MP (which I filed 8 hours ago?). You could have
waited and asked me? (it's your call in the end, but I figured we were
doing RC3 anyway for the issue we hit yesterday, and this came out of
triaging that. )

Revision history for this message
Blake Rouse (blake-rouse) wrote :

Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/maasserver/models/migrations/populate_subnets_helper.py'
2--- src/maasserver/models/migrations/populate_subnets_helper.py 2015-07-29 05:51:09 +0000
3+++ src/maasserver/models/migrations/populate_subnets_helper.py 2015-11-24 09:07:12 +0000
4@@ -122,19 +122,22 @@
5 def _create_subnet_from_nodegroupinterface(now, ngi, Subnet, default_space,
6 default_vlan):
7 cidr = _get_cidr_for_nodegroupinterface(ngi)
8- try:
9- subnet = Subnet.objects.get(cidr=cidr)
10- except Subnet.DoesNotExist:
11- subnet = Subnet()
12- subnet.name = cidr
13- # VLAN might have been populated by the migration from Network.
14- subnet.vlan = default_vlan
15- subnet.created = now
16- subnet.cidr = cidr
17- subnet.space = default_space
18- subnet.updated = now
19- subnet.gateway_ip = ngi.router_ip
20- subnet.save()
21+ if cidr is not None:
22+ try:
23+ subnet = Subnet.objects.get(cidr=cidr)
24+ except Subnet.DoesNotExist:
25+ subnet = Subnet()
26+ subnet.name = cidr
27+ # VLAN might have been populated by the migration from Network.
28+ subnet.vlan = default_vlan
29+ subnet.created = now
30+ subnet.cidr = cidr
31+ subnet.space = default_space
32+ subnet.updated = now
33+ subnet.gateway_ip = ngi.router_ip
34+ subnet.save()
35+ else:
36+ subnet = None
37 ngi.subnet = subnet
38 ngi.updated = now
39 ngi.save()