Merge lp:~mpontillo/maas/fix-1516815-1.9 into lp:maas/1.9

Proposed by Mike Pontillo
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
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.

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

Self-approving approved backport from trunk.

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

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://security.ubuntu.com trusty-security InRelease [64.4 kB]
Ign http://nova.clouds.archive.ubuntu.com trusty InRelease
Get:2 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
Get:3 http://security.ubuntu.com trusty-security/main Sources [99.2 kB]
Get:4 http://security.ubuntu.com trusty-security/universe Sources [31.5 kB]
Get:5 http://nova.clouds.archive.ubuntu.com trusty-updates/main Sources [244 kB]
Get:6 http://security.ubuntu.com trusty-security/main amd64 Packages [370 kB]
Get:7 http://nova.clouds.archive.ubuntu.com trusty-updates/universe Sources [143 kB]
Get:8 http://nova.clouds.archive.ubuntu.com trusty-updates/main amd64 Packages [652 kB]
Get:9 http://security.ubuntu.com trusty-security/universe amd64 Packages [119 kB]
Hit http://security.ubuntu.com trusty-security/main Translation-en
Hit http://security.ubuntu.com trusty-security/universe Translation-en
Get:10 http://nova.clouds.archive.ubuntu.com trusty-updates/universe amd64 Packages [327 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 2,116 kB in 6s (323 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 pyt...

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

Not really sure why this one didn't land. I'll have to say "canonistack/weird race condition".

http://paste.ubuntu.com/13309571/

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

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://security.ubuntu.com trusty-security InRelease [64.4 kB]
Ign http://nova.clouds.archive.ubuntu.com trusty InRelease
Get:2 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
Get:3 http://security.ubuntu.com trusty-security/main Sources [99.2 kB]
Get:4 http://nova.clouds.archive.ubuntu.com trusty-updates/main Sources [244 kB]
Get:5 http://security.ubuntu.com trusty-security/universe Sources [31.5 kB]
Get:6 http://nova.clouds.archive.ubuntu.com trusty-updates/universe Sources [143 kB]
Get:7 http://security.ubuntu.com trusty-security/main amd64 Packages [370 kB]
Get:8 http://nova.clouds.archive.ubuntu.com trusty-updates/main amd64 Packages [652 kB]
Get:9 http://security.ubuntu.com trusty-security/universe amd64 Packages [119 kB]
Hit http://security.ubuntu.com trusty-security/main Translation-en
Hit http://security.ubuntu.com trusty-security/universe Translation-en
Get:10 http://nova.clouds.archive.ubuntu.com trusty-updates/universe amd64 Packages [327 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 2,116 kB in 7s (295 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 pyt...

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

http://paste.ubuntu.com/13314953/ << strange "random" failures; seems unrelated to this branch.

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

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://security.ubuntu.com trusty-security InRelease [64.4 kB]
Ign http://nova.clouds.archive.ubuntu.com trusty InRelease
Get:2 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
Get:3 http://security.ubuntu.com trusty-security/main Sources [99.2 kB]
Get:4 http://nova.clouds.archive.ubuntu.com trusty-updates/main Sources [244 kB]
Get:5 http://security.ubuntu.com trusty-security/universe Sources [31.5 kB]
Get:6 http://security.ubuntu.com trusty-security/main amd64 Packages [370 kB]
Get:7 http://nova.clouds.archive.ubuntu.com trusty-updates/universe Sources [143 kB]
Get:8 http://nova.clouds.archive.ubuntu.com trusty-updates/main amd64 Packages [652 kB]
Get:9 http://security.ubuntu.com trusty-security/universe amd64 Packages [119 kB]
Hit http://security.ubuntu.com trusty-security/main Translation-en
Hit http://security.ubuntu.com trusty-security/universe Translation-en
Get:10 http://nova.clouds.archive.ubuntu.com trusty-updates/universe amd64 Packages [327 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 2,116 kB in 6s (317 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 pyt...

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-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(

Subscribers

People subscribed via source and target branches