Merge lp:~blake-rouse/maas/fix-1512109 into lp:maas/trunk

Proposed by Blake Rouse on 2015-11-02
Status: Merged
Approved by: Blake Rouse on 2015-11-02
Approved revision: 4449
Merged at revision: 4448
Proposed branch: lp:~blake-rouse/maas/fix-1512109
Merge into: lp:maas/trunk
Diff against target: 56 lines (+30/-5)
2 files modified
src/maasserver/models/staticipaddress.py (+7/-5)
src/maasserver/models/tests/test_staticipaddress.py (+23/-0)
To merge this branch: bzr merge lp:~blake-rouse/maas/fix-1512109
Reviewer Review Type Date Requested Status
Andres Rodriguez 2015-11-02 Approve on 2015-11-02
Review via email: mp+276407@code.launchpad.net

Commit message

Use PXE interface over other physical interfaces for IP address for DNS.

To post a comment you must log in.
Andres Rodriguez (andreserl) wrote :

lgtm!

review: Approve
MAAS Lander (maas-lander) wrote :
Download full text (62.6 KiB)

The attempt to merge lp:~blake-rouse/maas/fix-1512109 into lp:maas failed. Below is the output from the failed tests.

Hit http://security.ubuntu.com trusty-security InRelease
Ign http://nova.clouds.archive.ubuntu.com trusty InRelease
Get:1 http://nova.clouds.archive.ubuntu.com trusty-updates InRelease [64.4 kB]
Hit http://nova.clouds.archive.ubuntu.com trusty Release.gpg
Hit http://nova.clouds.archive.ubuntu.com trusty Release
Hit http://security.ubuntu.com trusty-security/main Sources
Hit http://security.ubuntu.com trusty-security/universe Sources
Hit http://security.ubuntu.com trusty-security/main amd64 Packages
Hit http://security.ubuntu.com trusty-security/universe amd64 Packages
Hit http://security.ubuntu.com trusty-security/main Translation-en
Get:2 http://nova.clouds.archive.ubuntu.com trusty-updates/main Sources [242 kB]
Hit http://security.ubuntu.com trusty-security/universe Translation-en
Get:3 http://nova.clouds.archive.ubuntu.com trusty-updates/universe Sources [143 kB]
Get:4 http://nova.clouds.archive.ubuntu.com trusty-updates/main amd64 Packages [639 kB]
Get:5 http://nova.clouds.archive.ubuntu.com trusty-updates/universe amd64 Packages [326 kB]
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/universe Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty/main Sources
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Sources
Hit http://nova.clouds.archive.ubuntu.com trusty/main amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/universe amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en
Ign http://nova.clouds.archive.ubuntu.com trusty/main Translation-en_US
Ign http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en_US
Fetched 1,414 kB in 3s (379 kB/s)
Reading package lists...
sudo DEBIAN_FRONTEND=noninteractive apt-get -y \
     --no-install-recommends install apache2 authbind bind9 bind9utils build-essential bzr-builddeb chromium-browser chromium-chromedriver curl daemontools debhelper dh-apport dh-systemd distro-info dnsutils firefox freeipmi-tools git gjs ipython isc-dhcp-common libjs-angularjs libjs-jquery libjs-jquery-hotkeys libjs-yui3-full libjs-yui3-min libpq-dev make nodejs-legacy npm pep8 phantomjs postgresql pyflakes python-apt python-bson python-bzrlib python-convoy python-coverage python-crochet python-cssselect python-curtin python-dev python-distro-info python-django python-django-piston python-django-south python-djorm-ext-pgarray python-docutils python-extras python-fixtures python-flake8 python-formencode python-hivex python-httplib2 python-jinja2 python-jsonschema python-lxml python-mock python-netaddr python-netifaces python-nose python-oauth python-openssl python-paramiko python-pexpect python-pip python-pocket-lint python-psycopg2 python-pyinotify python-pyparsing python-seamicroclient python-simplejson python-simplestreams python-sphinx python-subunit python-tempita python-testresources python-testscenarios python-testtools python-twisted python-txtftp python-tz python-unitt...

lp:~blake-rouse/maas/fix-1512109 updated on 2015-11-02
4449. By Blake Rouse on 2015-11-02

Fix lint.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/maasserver/models/staticipaddress.py'
2--- src/maasserver/models/staticipaddress.py 2015-10-27 15:20:53 +0000
3+++ src/maasserver/models/staticipaddress.py 2015-11-02 15:57:46 +0000
4@@ -362,11 +362,13 @@
5 END,
6 CASE
7 WHEN interface.type = 'bond' THEN 1
8- WHEN interface.type = 'physical' THEN 2
9- WHEN interface.type = 'vlan' THEN 3
10- WHEN interface.type = 'alias' THEN 4
11- WHEN interface.type = 'unknown' THEN 5
12- ELSE 6
13+ WHEN interface.type = 'physical' AND
14+ interface.id = node.boot_interface_id THEN 2
15+ WHEN interface.type = 'physical' THEN 3
16+ WHEN interface.type = 'vlan' THEN 4
17+ WHEN interface.type = 'alias' THEN 5
18+ WHEN interface.type = 'unknown' THEN 6
19+ ELSE 7
20 END,
21 interface.id
22 """, (nodegroup.id,))
23
24=== modified file 'src/maasserver/models/tests/test_staticipaddress.py'
25--- src/maasserver/models/tests/test_staticipaddress.py 2015-09-24 16:22:12 +0000
26+++ src/maasserver/models/tests/test_staticipaddress.py 2015-11-02 15:57:46 +0000
27@@ -794,6 +794,29 @@
28 node.nodegroup)
29 self.assertEqual({node.hostname: [bond_staticip.ip]}, mapping)
30
31+ def test_get_hostname_ip_mapping_prefers_boot_interface(self):
32+ self.patch_autospec(interface_module, "update_host_maps")
33+ subnet = factory.make_Subnet(
34+ cidr=unicode(factory.make_ipv4_network().cidr))
35+ node = factory.make_Node_with_Interface_on_Subnet(
36+ hostname=factory.make_name('host'), subnet=subnet,
37+ disable_ipv4=False)
38+ iface = node.get_boot_interface()
39+ factory.make_StaticIPAddress(
40+ alloc_type=IPADDRESS_TYPE.STICKY, interface=iface,
41+ subnet=subnet)
42+ new_boot_interface = factory.make_Interface(
43+ INTERFACE_TYPE.PHYSICAL, node=node)
44+ node.boot_interface = new_boot_interface
45+ node.save()
46+ # IP address should be selected over the other physical IP address.
47+ boot_sip = factory.make_StaticIPAddress(
48+ alloc_type=IPADDRESS_TYPE.STICKY, interface=new_boot_interface,
49+ subnet=subnet)
50+ mapping = StaticIPAddress.objects.get_hostname_ip_mapping(
51+ node.nodegroup)
52+ self.assertEqual({node.hostname: [boot_sip.ip]}, mapping)
53+
54 def test_get_hostname_ip_mapping_prefers_physical_interfaces_to_vlan(self):
55 self.patch_autospec(interface_module, "update_host_maps")
56 subnet = factory.make_Subnet(