Merge lp:~nobuto/maas-deployer/fix-sticky-ip into lp:~maas-deployers/maas-deployer/next

Proposed by Nobuto Murata
Status: Merged
Approved by: Edward Hope-Morley
Approved revision: 20
Merged at revision: 27
Proposed branch: lp:~nobuto/maas-deployer/fix-sticky-ip
Merge into: lp:~maas-deployers/maas-deployer/next
Diff against target: 58 lines (+24/-10)
1 file modified
maas_deployer/vmaas/engine.py (+24/-10)
To merge this branch: bzr merge lp:~nobuto/maas-deployer/fix-sticky-ip
Reviewer Review Type Date Requested Status
MAAS Deployers Pending
Review via email: mp+268295@code.launchpad.net

Description of the change

sticky IP address cannot be claimed during commissioning. try to get it after all nodes are ready. LP: #1478967

To post a comment you must log in.
Revision history for this message
Edward Hope-Morley (hopem) wrote :

Hey nobuto, this will need rebasing once https://code.launchpad.net/~hopem/maas-deployer/lp1478789/+merge/268474 lands as it has a bit of a refactor in it. Nice work though!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'maas_deployer/vmaas/engine.py'
2--- maas_deployer/vmaas/engine.py 2015-08-25 20:07:52 +0000
3+++ maas_deployer/vmaas/engine.py 2015-09-01 03:38:01 +0000
4@@ -391,16 +391,6 @@
5
6 self._add_tags_to_node(client, node, maas_node)
7
8- if 'sticky_ip_address' in node:
9- sticky_ip_addr = node['sticky_ip_address']
10- mac_address = sticky_ip_addr.get('mac_address', None)
11- requested_address = sticky_ip_addr.get('requested_address',
12- None)
13-
14- fn = client.claim_sticky_ip_address
15- if not fn(maas_node, requested_address, mac_address):
16- log.warning(">> Failed to claim sticky ip address")
17-
18 def configure_maas(self, maas_config):
19 """
20 Configures the MAAS instance.
21@@ -470,6 +460,7 @@
22 util.virsh(['start', juju_node])
23
24 self._wait_for_nodes_to_commission(client)
25+ self._claim_sticky_ip_address(client, maas_config)
26 log.debug("Done")
27
28 def _render_environments_yaml(self):
29@@ -518,6 +509,29 @@
30 time.sleep(5)
31 nodes = client.get_nodes()
32
33+ def _claim_sticky_ip_address(self, client, maas_config):
34+ """
35+ Claim sticky IP address
36+ """
37+ maas_nodes = client.get_nodes()
38+ nodes = maas_config.get('nodes', [])
39+ for maas_node in maas_nodes:
40+ hostname = maas_node['hostname']
41+ for node in nodes:
42+ if hostname.startswith("%s." % node['name']) and \
43+ 'sticky_ip_address' in node:
44+
45+ sticky_ip_addr = node['sticky_ip_address']
46+ mac_address = sticky_ip_addr.get('mac_address', None)
47+ requested_address = sticky_ip_addr.get('requested_address',
48+ None)
49+
50+ # log.debug("Claiming sticky IP address %s",
51+ # requested_address)
52+ fn = client.claim_sticky_ip_address
53+ if not fn(maas_node, requested_address, mac_address):
54+ log.warning(">> Failed to claim sticky ip address")
55+
56 def get_power_parameters(self, config_parms):
57 """
58 Converts the power parameters entry

Subscribers

People subscribed via source and target branches

to all changes: