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
1=== modified file 'contrib/preseeds_v2/enlist_userdata'
2--- contrib/preseeds_v2/enlist_userdata 2012-10-11 13:55:11 +0000
3+++ contrib/preseeds_v2/enlist_userdata 2012-11-13 22:43:21 +0000
4@@ -143,8 +143,8 @@
5 # '--dhcp-if-static' has been passed, Set it to IPMI to DHCP.
6 if not is_ipmi_dhcp() and args.dhcp:
7 set_ipmi_network_source("Use_DHCP")
8- # allow IPMI 60 seconds to obtain an IP address
9- time.sleep(60)
10+ # allow IPMI 120 seconds to obtain an IP address
11+ time.sleep(120)
12
13 # create user/pass
14 if args.commission_creds:
15@@ -163,6 +163,15 @@
16
17 # get the IP address
18 IPMI_IP_ADDRESS = get_ipmi_ip_address()
19+ if IPMI_IP_ADDRESS == "0.0.0.0":
20+ # if IPMI_IP_ADDRESS is 0.0.0.0, wait 60 seconds and retry.
21+ time.sleep(60)
22+ IPMI_IP_ADDRESS = get_ipmi_ip_address()
23+
24+ if IPMI_IP_ADDRESS is None or IPMI_IP_ADDRESS == "0.0.0.0":
25+ # Exit (to not set power params in MAAS) if no IPMI_IP_ADDRESS
26+ # has been detected
27+ exit(1)
28
29 if args.commission_creds:
30 print get_maas_power_settings_json(IPMI_MAAS_USER, IPMI_MAAS_PASSWORD, IPMI_IP_ADDRESS)
31@@ -170,7 +179,7 @@
32 print get_maas_power_settings(IPMI_MAAS_USER, IPMI_MAAS_PASSWORD, IPMI_IP_ADDRESS)
33
34 if __name__ == '__main__':
35- main()
36+ main()
37 END_MAAS_IPMI_AUTODETECT
38
39 # we could obtain the interface that booted from the kernel cmdline
40
41=== modified file 'etc/maas/commissioning-user-data'
42--- etc/maas/commissioning-user-data 2012-10-11 13:55:11 +0000
43+++ etc/maas/commissioning-user-data 2012-11-13 22:43:21 +0000
44@@ -294,8 +294,8 @@
45 # '--dhcp-if-static' has been passed, Set it to IPMI to DHCP.
46 if not is_ipmi_dhcp() and args.dhcp:
47 set_ipmi_network_source("Use_DHCP")
48- # allow IPMI 60 seconds to obtain an IP address
49- time.sleep(60)
50+ # allow IPMI 120 seconds to obtain an IP address
51+ time.sleep(120)
52
53 # create user/pass
54 IPMI_MAAS_USER="maas"
55@@ -311,6 +311,15 @@
56
57 # get the IP address
58 IPMI_IP_ADDRESS = get_ipmi_ip_address()
59+ if IPMI_IP_ADDRESS == "0.0.0.0":
60+ # if IPMI_IP_ADDRESS is 0.0.0.0, wait 60 seconds and retry.
61+ time.sleep(60)
62+ IPMI_IP_ADDRESS = get_ipmi_ip_address()
63+
64+ if IPMI_IP_ADDRESS is None or IPMI_IP_ADDRESS == "0.0.0.0":
65+ # Exit (to not set power params in MAAS) if no IPMI_IP_ADDRESS
66+ # has been detected
67+ exit(1)
68
69 print get_maas_power_settings(IPMI_MAAS_USER, IPMI_MAAS_PASSWORD, IPMI_IP_ADDRESS)
70