Merge lp:~julian-edwards/maas/release-host-maps-fix-bug-1391411 into lp:~maas-committers/maas/trunk

Proposed by Julian Edwards
Status: Merged
Approved by: Julian Edwards
Approved revision: no longer in the source branch.
Merged at revision: 3360
Proposed branch: lp:~julian-edwards/maas/release-host-maps-fix-bug-1391411
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 41 lines (+14/-6)
2 files modified
src/metadataserver/api.py (+5/-6)
src/metadataserver/tests/test_api.py (+9/-0)
To merge this branch: bzr merge lp:~julian-edwards/maas/release-host-maps-fix-bug-1391411
Reviewer Review Type Date Requested Status
Jeroen T. Vermeulen (community) Approve
Review via email: mp+241385@code.launchpad.net

Commit message

Only release leases when the metadata server's signal() is called if the node is commissioning. Previously it was doing it when the node was installing, which meant it lost its IP address.

To post a comment you must log in.
Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

That should fix it.

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

The attempt to merge lp:~julian-edwards/maas/release-host-maps-fix-bug-1391411 into lp:maas failed. Below is the output from the failed tests.

Ign http://security.ubuntu.com trusty-security InRelease
Get:1 http://security.ubuntu.com trusty-security Release.gpg [933 B]
Ign http://nova.clouds.archive.ubuntu.com trusty InRelease
Get:2 http://security.ubuntu.com trusty-security Release [62.0 kB]
Ign http://nova.clouds.archive.ubuntu.com trusty-updates InRelease
Hit http://nova.clouds.archive.ubuntu.com trusty Release.gpg
Get:3 http://nova.clouds.archive.ubuntu.com trusty-updates Release.gpg [933 B]
Hit http://nova.clouds.archive.ubuntu.com trusty Release
Get:4 http://nova.clouds.archive.ubuntu.com trusty-updates Release [62.0 kB]
Get:5 http://security.ubuntu.com trusty-security/main Sources [49.5 kB]
Hit http://nova.clouds.archive.ubuntu.com trusty/main Sources
Get:6 http://security.ubuntu.com trusty-security/universe Sources [13.1 kB]
Get:7 http://security.ubuntu.com trusty-security/main amd64 Packages [153 kB]
Get:8 http://security.ubuntu.com trusty-security/universe amd64 Packages [60.5 kB]
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://security.ubuntu.com trusty-security/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en
Hit http://security.ubuntu.com trusty-security/universe Translation-en
Get:9 http://nova.clouds.archive.ubuntu.com trusty-updates/main Sources [135 kB]
Get:10 http://nova.clouds.archive.ubuntu.com trusty-updates/universe Sources [89.5 kB]
Get:11 http://nova.clouds.archive.ubuntu.com trusty-updates/main amd64 Packages [356 kB]
Get:12 http://nova.clouds.archive.ubuntu.com trusty-updates/universe amd64 Packages [217 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
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,200 kB in 2s (415 kB/s)
Reading package lists...
sudo DEBIAN_FRONTEND=noninteractive apt-get -y \
     --no-install-recommends install apache2 authbind bind9 bind9utils build-essential bzr-builddeb curl daemontools debhelper dh-apport distro-info dnsutils firefox freeipmi-tools gjs ipython isc-dhcp-common libjs-raphael libjs-yui3-full libjs-yui3-min libpq-dev make pep8 postgresql pyflakes python-amqplib python-bzrlib python-celery python-convoy 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-lockfile python-lxml python-mimeparse python-mock python-netaddr python-netifaces python-nose python-oauth python-oops python-oops-amqp python-oops-datedir-repo python-oops-twisted python...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/metadataserver/api.py'
2--- src/metadataserver/api.py 2014-11-07 06:10:40 +0000
3+++ src/metadataserver/api.py 2014-11-11 10:13:58 +0000
4@@ -278,13 +278,12 @@
5 # If it is installing, should be in deploying state.
6 return rc.ALL_OK
7
8- # Ensure that any IP addresses are forcefully released in case
9- # the host didn't bother doing that. No static IPs are assigned
10- # at this stage, so we just deal with the dynamic ones.
11- if status != SIGNAL_STATUS.WORKING:
12- node.delete_host_maps(set(node.dynamic_ip_addresses()))
13-
14 if node.status == NODE_STATUS.COMMISSIONING:
15+ # Ensure that any IP addresses are forcefully released in case
16+ # the host didn't bother doing that. No static IPs are assigned
17+ # at this stage, so we just deal with the dynamic ones.
18+ if status != SIGNAL_STATUS.WORKING:
19+ node.delete_host_maps(set(node.dynamic_ip_addresses()))
20 self._store_commissioning_results(node, request)
21 store_node_power_parameters(node, request)
22 node.stop_transition_monitor()
23
24=== modified file 'src/metadataserver/tests/test_api.py'
25--- src/metadataserver/tests/test_api.py 2014-11-07 06:10:19 +0000
26+++ src/metadataserver/tests/test_api.py 2014-11-11 10:13:58 +0000
27@@ -879,6 +879,15 @@
28 self.assertEqual(httplib.OK, response.status_code, response.content)
29 self.assertThat(node.delete_host_maps, MockNotCalled())
30
31+ def test_signal_doesnt_clear_dynamic_ip_leases_if_not_commissioning(self):
32+ node = factory.make_Node(status=NODE_STATUS.DEPLOYING)
33+ ips = [factory.make_ipv4_address() for _ in range(2)]
34+ self.patch(Node, 'dynamic_ip_addresses').return_value = ips
35+ client = make_node_client(node=node)
36+ response = call_signal(client, status='OK')
37+ self.assertEqual(httplib.OK, response.status_code, response.content)
38+ self.assertThat(node.delete_host_maps, MockNotCalled())
39+
40
41 class TestDiskErasingAPI(MAASServerTestCase):
42