Merge lp:~lamont/maas/bug-1675844 into lp:~maas-committers/maas/trunk

Proposed by LaMont Jones
Status: Merged
Approved by: LaMont Jones
Approved revision: no longer in the source branch.
Merged at revision: 5859
Proposed branch: lp:~lamont/maas/bug-1675844
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 46 lines (+24/-1)
2 files modified
src/maasserver/models/staticipaddress.py (+2/-1)
src/maasserver/models/tests/test_staticipaddress.py (+22/-0)
To merge this branch: bzr merge lp:~lamont/maas/bug-1675844
Reviewer Review Type Date Requested Status
Gavin Panella (community) Approve
Review via email: mp+321014@code.launchpad.net

Commit message

For the IPv6 address for a host, prefer non-ULA addresses over ULA addresses.

Description of the change

For the IPv6 address for a host, prefer non-ULA addresses over ULA addresses.

To post a comment you must log in.
Revision history for this message
Gavin Panella (allenap) wrote :

get_hostname_ip_mapping makes me sad — though the use of SQL is good — but this change looks sound.

review: Approve
Revision history for this message
MAAS Lander (maas-lander) wrote :
Download full text (1.8 MiB)

The attempt to merge lp:~lamont/maas/bug-1675844 into lp:maas failed. Below is the output from the failed tests.

Hit:1 http://prodstack-zone-2.clouds.archive.ubuntu.com/ubuntu xenial InRelease
Get:2 http://prodstack-zone-2.clouds.archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]
Get:3 http://prodstack-zone-2.clouds.archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB]
Get:4 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Get:5 http://prodstack-zone-2.clouds.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [498 kB]
Get:6 http://prodstack-zone-2.clouds.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [444 kB]
Fetched 1,248 kB in 0s (2,329 kB/s)
Reading package lists...
sudo DEBIAN_FRONTEND=noninteractive apt-get -y \
    --no-install-recommends install apache2 archdetect-deb authbind avahi-utils bash bind9 bind9utils build-essential bzr 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 isc-dhcp-server libjs-angularjs libjs-jquery libjs-jquery-hotkeys libjs-yui3-full libjs-yui3-min libnss-wrapper libpq-dev make nodejs-legacy npm postgresql psmisc pxelinux python3-all python3-apt python3-attr python3-bson python3-convoy python3-crochet python3-cssselect python3-curtin python3-dev python3-distro-info python3-django python3-django-nose python3-django-piston3 python3-dnspython python3-docutils python3-formencode python3-hivex python3-httplib2 python3-jinja2 python3-jsonschema python3-lxml python3-netaddr python3-netifaces python3-novaclient python3-oauth python3-oauthlib python3-openssl python3-paramiko python3-petname python3-pexpect python3-psycopg2 python3-pyinotify python3-pyparsing python3-pyvmomi python3-requests python3-seamicroclient python3-setuptools python3-simplestreams python3-sphinx python3-tempita python3-twisted python3-txtftp python3-tz python3-yaml python3-zope.interface python-bson python-crochet python-django python-django-piston python-djorm-ext-pgarray python-formencode python-lxml python-netaddr python-netifaces python-pocket-lint python-psycopg2 python-simplejson python-tempita python-twisted python-yaml socat syslinux-common tgt ubuntu-cloudimage-keyring wget xvfb
Reading package lists...
Building dependency tree...
Reading state information...
authbind is already the newest version (2.1.1+nmu1).
avahi-utils is already the newest version (0.6.32~rc+dfsg-1ubuntu2).
build-essential is already the newest version (12.1ubuntu2).
debhelper is already the newest version (9.20160115ubuntu3).
distro-info is already the newest version (0.14build1).
git is already the newest version (1:2.7.4-0ubuntu1).
libjs-angularjs is already the newest version (1.2.28-1ubuntu2).
libjs-jquery is already the newest version (1.11.3+dfsg-4).
libjs-yui3-full is already the newest version (3.5.1-1ubuntu3).
libjs-yui3-min is already the newest version (3.5.1-1ubuntu3).
make is already the newest version (4.1-6).
postgresql is already the newest version (9.5+173).
psmisc is already the newest version (22.21-2.1build1).
pxelinux is already the newest version (3:6.03+...

Revision history for this message
MAAS Lander (maas-lander) wrote :
Download full text (1.8 MiB)

The attempt to merge lp:~lamont/maas/bug-1675844 into lp:maas failed. Below is the output from the failed tests.

Get:1 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Hit:2 http://prodstack-zone-2.clouds.archive.ubuntu.com/ubuntu xenial InRelease
Get:3 http://prodstack-zone-2.clouds.archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]
Get:4 http://prodstack-zone-2.clouds.archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB]
Fetched 306 kB in 0s (535 kB/s)
Reading package lists...
sudo DEBIAN_FRONTEND=noninteractive apt-get -y \
    --no-install-recommends install apache2 archdetect-deb authbind avahi-utils bash bind9 bind9utils build-essential bzr 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 isc-dhcp-server libjs-angularjs libjs-jquery libjs-jquery-hotkeys libjs-yui3-full libjs-yui3-min libnss-wrapper libpq-dev make nodejs-legacy npm postgresql psmisc pxelinux python3-all python3-apt python3-attr python3-bson python3-convoy python3-crochet python3-cssselect python3-curtin python3-dev python3-distro-info python3-django python3-django-nose python3-django-piston3 python3-dnspython python3-docutils python3-formencode python3-hivex python3-httplib2 python3-jinja2 python3-jsonschema python3-lxml python3-netaddr python3-netifaces python3-novaclient python3-oauth python3-oauthlib python3-openssl python3-paramiko python3-petname python3-pexpect python3-psycopg2 python3-pyinotify python3-pyparsing python3-pyvmomi python3-requests python3-seamicroclient python3-setuptools python3-simplestreams python3-sphinx python3-tempita python3-twisted python3-txtftp python3-tz python3-yaml python3-zope.interface python-bson python-crochet python-django python-django-piston python-djorm-ext-pgarray python-formencode python-lxml python-netaddr python-netifaces python-pocket-lint python-psycopg2 python-simplejson python-tempita python-twisted python-yaml socat syslinux-common tgt ubuntu-cloudimage-keyring wget xvfb
Reading package lists...
Building dependency tree...
Reading state information...
authbind is already the newest version (2.1.1+nmu1).
avahi-utils is already the newest version (0.6.32~rc+dfsg-1ubuntu2).
build-essential is already the newest version (12.1ubuntu2).
debhelper is already the newest version (9.20160115ubuntu3).
distro-info is already the newest version (0.14build1).
git is already the newest version (1:2.7.4-0ubuntu1).
libjs-angularjs is already the newest version (1.2.28-1ubuntu2).
libjs-jquery is already the newest version (1.11.3+dfsg-4).
libjs-yui3-full is already the newest version (3.5.1-1ubuntu3).
libjs-yui3-min is already the newest version (3.5.1-1ubuntu3).
make is already the newest version (4.1-6).
postgresql is already the newest version (9.5+173).
psmisc is already the newest version (22.21-2.1build1).
pxelinux is already the newest version (3:6.03+dfsg-11ubuntu1).
python-formencode is already the newest version (1.3.0-0ubuntu5).
python-lxml is already the newest version (3.5.0-1build1).
python-netaddr is already the newest version (0.7.18-1).
python-netifaces is alr...

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 2016-12-07 12:46:14 +0000
3+++ src/maasserver/models/staticipaddress.py 2017-03-26 16:57:18 +0000
4@@ -511,7 +511,8 @@
5 THEN 5
6 ELSE staticip.alloc_type
7 END,
8- interface.id
9+ interface.id,
10+ inet 'fc00::/7' >> ip /* ULA after non-ULA */
11 """
12 iface_sql_query = """
13 SELECT
14
15=== modified file 'src/maasserver/models/tests/test_staticipaddress.py'
16--- src/maasserver/models/tests/test_staticipaddress.py 2017-01-28 00:51:47 +0000
17+++ src/maasserver/models/tests/test_staticipaddress.py 2017-03-26 16:57:18 +0000
18@@ -635,6 +635,28 @@
19 node.system_id, 30, {staticip.ip}, node.node_type)}
20 self.assertEqual(expected_mapping, mapping)
21
22+ def test_get_hostname_ip_mapping_prefers_non_ula_addresses(self):
23+ subnet = factory.make_Subnet(cidr='2001:db8::/64')
24+ ula_subnet = factory.make_Subnet(
25+ cidr='fdd7:39:2::/48', vlan=subnet.vlan)
26+ node = factory.make_Node_with_Interface_on_Subnet(
27+ hostname=factory.make_name('host'), subnet=subnet)
28+ iface = node.get_boot_interface()
29+ staticip = factory.make_StaticIPAddress(
30+ alloc_type=IPADDRESS_TYPE.AUTO, interface=iface,
31+ subnet=subnet)
32+ ula_ip = factory.make_StaticIPAddress(
33+ alloc_type=IPADDRESS_TYPE.AUTO, interface=iface,
34+ subnet=ula_subnet)
35+ mapping = StaticIPAddress.objects.get_hostname_ip_mapping(
36+ node.domain)
37+ expected_mapping = {
38+ node.fqdn: HostnameIPMapping(
39+ node.system_id, 30, {staticip.ip}, node.node_type),
40+ "%s.%s" % (iface.name, node.fqdn): HostnameIPMapping(
41+ node.system_id, 30, {ula_ip.ip}, node.node_type)}
42+ self.assertEqual(expected_mapping, mapping)
43+
44 def test_get_hostname_ip_mapping_prefers_bond_with_no_boot_interface(self):
45 subnet = factory.make_Subnet(
46 cidr=str(factory.make_ipv4_network().cidr))