Merge lp:~mpontillo/maas/fix-1516815-1.9 into lp:maas/1.9
- fix-1516815-1.9
- Merge into 1.9
Status: | Merged |
---|---|
Approved by: | Mike Pontillo |
Approved revision: | no longer in the source branch. |
Merged at revision: | 4499 |
Proposed branch: | lp:~mpontillo/maas/fix-1516815-1.9 |
Merge into: | lp:maas/1.9 |
Diff against target: |
75 lines (+35/-12) 2 files modified
src/maasserver/models/staticipaddress.py (+12/-12) src/maasserver/models/tests/test_staticipaddress.py (+23/-0) |
To merge this branch: | bzr merge lp:~mpontillo/maas/fix-1516815-1.9 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mike Pontillo (community) | Approve | ||
Review via email: mp+277639@code.launchpad.net |
Commit message
Backport fix for bug #1516815 to MAAS 1.9.
Description of the change
Mike Pontillo (mpontillo) wrote : | # |
Mike Pontillo (mpontillo) : | # |
MAAS Lander (maas-lander) wrote : | # |
The attempt to merge lp:~mpontillo/maas/fix-1516815-1.9 into lp:maas/1.9 failed. Below is the output from the failed tests.
Get:1 http://
Ign http://
Get:2 http://
Hit http://
Hit http://
Get:3 http://
Get:4 http://
Get:5 http://
Get:6 http://
Get:7 http://
Get:8 http://
Get:9 http://
Hit http://
Hit http://
Get:10 http://
Hit http://
Hit http://
Hit http://
Hit http://
Hit http://
Hit http://
Hit http://
Hit http://
Ign http://
Ign http://
Fetched 2,116 kB in 6s (323 kB/s)
Reading package lists...
sudo DEBIAN_
--
Mike Pontillo (mpontillo) wrote : | # |
Not really sure why this one didn't land. I'll have to say "canonistack/weird race condition".
MAAS Lander (maas-lander) wrote : | # |
The attempt to merge lp:~mpontillo/maas/fix-1516815-1.9 into lp:maas/1.9 failed. Below is the output from the failed tests.
Get:1 http://
Ign http://
Get:2 http://
Hit http://
Hit http://
Get:3 http://
Get:4 http://
Get:5 http://
Get:6 http://
Get:7 http://
Get:8 http://
Get:9 http://
Hit http://
Hit http://
Get:10 http://
Hit http://
Hit http://
Hit http://
Hit http://
Hit http://
Hit http://
Hit http://
Hit http://
Ign http://
Ign http://
Fetched 2,116 kB in 7s (295 kB/s)
Reading package lists...
sudo DEBIAN_
--
Mike Pontillo (mpontillo) wrote : | # |
http://
MAAS Lander (maas-lander) wrote : | # |
The attempt to merge lp:~mpontillo/maas/fix-1516815-1.9 into lp:maas/1.9 failed. Below is the output from the failed tests.
Get:1 http://
Ign http://
Get:2 http://
Hit http://
Hit http://
Get:3 http://
Get:4 http://
Get:5 http://
Get:6 http://
Get:7 http://
Get:8 http://
Get:9 http://
Hit http://
Hit http://
Get:10 http://
Hit http://
Hit http://
Hit http://
Hit http://
Hit http://
Hit http://
Hit http://
Hit http://
Ign http://
Ign http://
Fetched 2,116 kB in 6s (317 kB/s)
Reading package lists...
sudo DEBIAN_
--
Preview Diff
1 | === modified file 'src/maasserver/models/staticipaddress.py' |
2 | --- src/maasserver/models/staticipaddress.py 2015-11-12 19:58:24 +0000 |
3 | +++ src/maasserver/models/staticipaddress.py 2015-11-17 17:13:19 +0000 |
4 | @@ -347,6 +347,18 @@ |
5 | ORDER BY |
6 | node.hostname, |
7 | family(staticip.ip), |
8 | + CASE |
9 | + WHEN interface.type = 'bond' AND |
10 | + parent.id = node.boot_interface_id THEN 1 |
11 | + WHEN interface.type = 'physical' AND |
12 | + interface.id = node.boot_interface_id THEN 2 |
13 | + WHEN interface.type = 'bond' THEN 3 |
14 | + WHEN interface.type = 'physical' THEN 4 |
15 | + WHEN interface.type = 'vlan' THEN 5 |
16 | + WHEN interface.type = 'alias' THEN 6 |
17 | + WHEN interface.type = 'unknown' THEN 7 |
18 | + ELSE 8 |
19 | + END, |
20 | /* |
21 | * We want STICKY and USER_RESERVED addresses to be preferred, |
22 | * followed by AUTO, DHCP, and finally DISCOVERED. |
23 | @@ -364,18 +376,6 @@ |
24 | THEN 5 |
25 | ELSE staticip.alloc_type |
26 | END, |
27 | - CASE |
28 | - WHEN interface.type = 'bond' AND |
29 | - parent.id = node.boot_interface_id THEN 1 |
30 | - WHEN interface.type = 'physical' AND |
31 | - interface.id = node.boot_interface_id THEN 2 |
32 | - WHEN interface.type = 'bond' THEN 3 |
33 | - WHEN interface.type = 'physical' THEN 4 |
34 | - WHEN interface.type = 'vlan' THEN 5 |
35 | - WHEN interface.type = 'alias' THEN 6 |
36 | - WHEN interface.type = 'unknown' THEN 7 |
37 | - ELSE 8 |
38 | - END, |
39 | interface.id |
40 | """, (nodegroup.id,)) |
41 | mapping = defaultdict(list) |
42 | |
43 | === modified file 'src/maasserver/models/tests/test_staticipaddress.py' |
44 | --- src/maasserver/models/tests/test_staticipaddress.py 2015-11-12 18:44:56 +0000 |
45 | +++ src/maasserver/models/tests/test_staticipaddress.py 2015-11-17 17:13:19 +0000 |
46 | @@ -908,6 +908,29 @@ |
47 | node.nodegroup) |
48 | self.assertEqual({node.hostname: [boot_sip.ip]}, mapping) |
49 | |
50 | + def test_get_hostname_ip_mapping_prefers_boot_interface_to_alias(self): |
51 | + self.patch_autospec(interface_module, "update_host_maps") |
52 | + subnet = factory.make_Subnet( |
53 | + cidr=unicode(factory.make_ipv4_network().cidr)) |
54 | + node = factory.make_Node_with_Interface_on_Subnet( |
55 | + hostname=factory.make_name('host'), subnet=subnet, |
56 | + disable_ipv4=False) |
57 | + iface = node.get_boot_interface() |
58 | + factory.make_StaticIPAddress( |
59 | + alloc_type=IPADDRESS_TYPE.STICKY, interface=iface, |
60 | + subnet=subnet) |
61 | + new_boot_interface = factory.make_Interface( |
62 | + INTERFACE_TYPE.PHYSICAL, node=node) |
63 | + node.boot_interface = new_boot_interface |
64 | + node.save() |
65 | + # IP address should be selected over the other STICKY IP address. |
66 | + boot_sip = factory.make_StaticIPAddress( |
67 | + alloc_type=IPADDRESS_TYPE.AUTO, interface=new_boot_interface, |
68 | + subnet=subnet) |
69 | + mapping = StaticIPAddress.objects.get_hostname_ip_mapping( |
70 | + node.nodegroup) |
71 | + self.assertEqual({node.hostname: [boot_sip.ip]}, mapping) |
72 | + |
73 | def test_get_hostname_ip_mapping_prefers_physical_interfaces_to_vlan(self): |
74 | self.patch_autospec(interface_module, "update_host_maps") |
75 | subnet = factory.make_Subnet( |
Self-approving approved backport from trunk.