Merge lp:~andreserl/maas/maas_ipmi_lp1064224 into lp:~maas-committers/maas/trunk

Proposed by Andres Rodriguez
Status: Merged
Approved by: Andres Rodriguez
Approved revision: no longer in the source branch.
Merged at revision: 1349
Proposed branch: lp:~andreserl/maas/maas_ipmi_lp1064224
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 69 lines (+23/-5)
2 files modified
contrib/preseeds_v2/enlist_userdata (+12/-3)
etc/maas/commissioning-user-data (+11/-2)
To merge this branch: bzr merge lp:~andreserl/maas/maas_ipmi_lp1064224
Reviewer Review Type Date Requested Status
Julian Edwards (community) Approve
Review via email: mp+134144@code.launchpad.net

Commit message

Do not set IPMI params if detect IPMI IP Address is 0.0.0.0

Description of the change

This change doesn't set the IPMI settings in MAAS for a node, if it was unable to obtain the IPMI IP Address or if the obtained IPMI address is 0.0.0.0.

Note that in order to make sure we detect the correct IP address, we've also increased the wait time to 120sec's if we are changing an IPMI card from Static to DHCP.

To post a comment you must log in.
Revision history for this message
Andres Rodriguez (andreserl) wrote :

Once this branch gets approved I'll propose a backport to the stabilization branch.

Revision history for this message
Julian Edwards (julian-edwards) wrote :

Thanks for the fix Andres - looks good, just a couple of nits:

7 # allow IPMI 60 seconds to obtain an IP address
8 - time.sleep(60)
9 + time.sleep(120)

and

45 # allow IPMI 60 seconds to obtain an IP address
46 - time.sleep(60)
47 + time.sleep(120)

Please fix the comments so they match the code :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'contrib/preseeds_v2/enlist_userdata'
--- contrib/preseeds_v2/enlist_userdata 2012-10-11 13:55:11 +0000
+++ contrib/preseeds_v2/enlist_userdata 2012-11-13 22:43:21 +0000
@@ -143,8 +143,8 @@
143 # '--dhcp-if-static' has been passed, Set it to IPMI to DHCP.143 # '--dhcp-if-static' has been passed, Set it to IPMI to DHCP.
144 if not is_ipmi_dhcp() and args.dhcp:144 if not is_ipmi_dhcp() and args.dhcp:
145 set_ipmi_network_source("Use_DHCP")145 set_ipmi_network_source("Use_DHCP")
146 # allow IPMI 60 seconds to obtain an IP address146 # allow IPMI 120 seconds to obtain an IP address
147 time.sleep(60)147 time.sleep(120)
148148
149 # create user/pass149 # create user/pass
150 if args.commission_creds:150 if args.commission_creds:
@@ -163,6 +163,15 @@
163163
164 # get the IP address164 # get the IP address
165 IPMI_IP_ADDRESS = get_ipmi_ip_address()165 IPMI_IP_ADDRESS = get_ipmi_ip_address()
166 if IPMI_IP_ADDRESS == "0.0.0.0":
167 # if IPMI_IP_ADDRESS is 0.0.0.0, wait 60 seconds and retry.
168 time.sleep(60)
169 IPMI_IP_ADDRESS = get_ipmi_ip_address()
170
171 if IPMI_IP_ADDRESS is None or IPMI_IP_ADDRESS == "0.0.0.0":
172 # Exit (to not set power params in MAAS) if no IPMI_IP_ADDRESS
173 # has been detected
174 exit(1)
166175
167 if args.commission_creds:176 if args.commission_creds:
168 print get_maas_power_settings_json(IPMI_MAAS_USER, IPMI_MAAS_PASSWORD, IPMI_IP_ADDRESS)177 print get_maas_power_settings_json(IPMI_MAAS_USER, IPMI_MAAS_PASSWORD, IPMI_IP_ADDRESS)
@@ -170,7 +179,7 @@
170 print get_maas_power_settings(IPMI_MAAS_USER, IPMI_MAAS_PASSWORD, IPMI_IP_ADDRESS)179 print get_maas_power_settings(IPMI_MAAS_USER, IPMI_MAAS_PASSWORD, IPMI_IP_ADDRESS)
171180
172 if __name__ == '__main__':181 if __name__ == '__main__':
173 main() 182 main()
174 END_MAAS_IPMI_AUTODETECT183 END_MAAS_IPMI_AUTODETECT
175184
176 # we could obtain the interface that booted from the kernel cmdline185 # we could obtain the interface that booted from the kernel cmdline
177186
=== modified file 'etc/maas/commissioning-user-data'
--- etc/maas/commissioning-user-data 2012-10-11 13:55:11 +0000
+++ etc/maas/commissioning-user-data 2012-11-13 22:43:21 +0000
@@ -294,8 +294,8 @@
294 # '--dhcp-if-static' has been passed, Set it to IPMI to DHCP.294 # '--dhcp-if-static' has been passed, Set it to IPMI to DHCP.
295 if not is_ipmi_dhcp() and args.dhcp:295 if not is_ipmi_dhcp() and args.dhcp:
296 set_ipmi_network_source("Use_DHCP")296 set_ipmi_network_source("Use_DHCP")
297 # allow IPMI 60 seconds to obtain an IP address297 # allow IPMI 120 seconds to obtain an IP address
298 time.sleep(60)298 time.sleep(120)
299299
300 # create user/pass300 # create user/pass
301 IPMI_MAAS_USER="maas"301 IPMI_MAAS_USER="maas"
@@ -311,6 +311,15 @@
311311
312 # get the IP address312 # get the IP address
313 IPMI_IP_ADDRESS = get_ipmi_ip_address()313 IPMI_IP_ADDRESS = get_ipmi_ip_address()
314 if IPMI_IP_ADDRESS == "0.0.0.0":
315 # if IPMI_IP_ADDRESS is 0.0.0.0, wait 60 seconds and retry.
316 time.sleep(60)
317 IPMI_IP_ADDRESS = get_ipmi_ip_address()
318
319 if IPMI_IP_ADDRESS is None or IPMI_IP_ADDRESS == "0.0.0.0":
320 # Exit (to not set power params in MAAS) if no IPMI_IP_ADDRESS
321 # has been detected
322 exit(1)
314323
315 print get_maas_power_settings(IPMI_MAAS_USER, IPMI_MAAS_PASSWORD, IPMI_IP_ADDRESS)324 print get_maas_power_settings(IPMI_MAAS_USER, IPMI_MAAS_PASSWORD, IPMI_IP_ADDRESS)
316325