Merge ~seyeongkim/maas:lp1999827_3.2 into maas:3.2

Proposed by Seyeong Kim
Status: Merged
Approved by: Alberto Donato
Approved revision: 04fec091679e814cb389cef88e249b912117711e
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~seyeongkim/maas:lp1999827_3.2
Merge into: maas:3.2
Diff against target: 54 lines (+31/-1)
2 files modified
src/maasserver/models/staticipaddress.py (+2/-1)
src/maasserver/models/tests/test_staticipaddress.py (+29/-0)
Reviewer Review Type Date Requested Status
MAAS Lander Approve
Support Engineering Sponsors Pending
MAAS Maintainers Pending
Review via email: mp+450086@code.launchpad.net

Commit message

Fix reverse order ip address

When controller's nic has several ip and virtual ip,
SQL collect them reverse order. this fixes it.

(cherry picked from commit cfe8cf628f7189a84a98d74b3c079d744f1c1b5f)

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

UNIT TESTS
-b lp1999827_3.2 lp:~seyeongkim/maas/+git/maas into -b 3.2 lp:~maas-committers/maas

STATUS: SUCCESS
COMMIT: 04fec091679e814cb389cef88e249b912117711e

review: Approve
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNABLE TO START LANDING

STATUS: MISSING COMMIT MESSAGE

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/maasserver/models/staticipaddress.py b/src/maasserver/models/staticipaddress.py
2index 4144a9e..e7424a6 100644
3--- a/src/maasserver/models/staticipaddress.py
4+++ b/src/maasserver/models/staticipaddress.py
5@@ -659,7 +659,8 @@ class StaticIPAddressManager(Manager):
6 ELSE staticip.alloc_type
7 END,
8 interface.id,
9- inet 'fc00::/7' >> ip /* ULA after non-ULA */
10+ inet 'fc00::/7' >> ip /* ULA after non-ULA */,
11+ staticip.id
12 """
13 iface_sql_query = (
14 """
15diff --git a/src/maasserver/models/tests/test_staticipaddress.py b/src/maasserver/models/tests/test_staticipaddress.py
16index b202a32..347d5c8 100644
17--- a/src/maasserver/models/tests/test_staticipaddress.py
18+++ b/src/maasserver/models/tests/test_staticipaddress.py
19@@ -446,6 +446,35 @@ class TestStaticIPAddressManagerMapping(MAASServerTestCase):
20 },
21 )
22
23+ def test_get_hostname_ip_mapping_ip_order(self):
24+ domain = Domain.objects.get_default_domain()
25+ node = factory.make_Node()
26+ interface1 = factory.make_Interface(node_config=node.current_config)
27+ subnet = factory.make_Subnet()
28+ staticip1 = factory.make_StaticIPAddress(
29+ alloc_type=IPADDRESS_TYPE.STICKY,
30+ ip=factory.pick_ip_in_Subnet(subnet),
31+ subnet=subnet,
32+ interface=interface1,
33+ )
34+ staticip2 = factory.make_StaticIPAddress(
35+ alloc_type=IPADDRESS_TYPE.STICKY,
36+ ip=factory.pick_ip_in_Subnet(subnet),
37+ subnet=subnet,
38+ interface=interface1,
39+ )
40+ self.assertEqual(
41+ dict(StaticIPAddress.objects.get_hostname_ip_mapping(subnet)),
42+ {
43+ f"{node.hostname}.{domain.name}": HostnameIPMapping(
44+ node.system_id, 30, {staticip1.ip}, node.node_type
45+ ),
46+ f"{interface1.name}.{node.hostname}.{domain.name}": HostnameIPMapping(
47+ node.system_id, 30, {staticip2.ip}, node.node_type
48+ ),
49+ },
50+ )
51+
52 def test_get_hostname_ip_mapping_returns_fqdn_and_other(self):
53 hostname = factory.make_name("hostname")
54 domainname = factory.make_name("domain")

Subscribers

People subscribed via source and target branches