Merge lp:~andreserl/maas/commissioning_improvements into lp:maas/trunk

Proposed by Andres Rodriguez on 2012-10-05
Status: Merged
Approved by: Andres Rodriguez on 2012-10-05
Approved revision: 1194
Merged at revision: 1193
Proposed branch: lp:~andreserl/maas/commissioning_improvements
Merge into: lp:maas/trunk
Diff against target: 68 lines (+22/-8)
1 file modified
etc/maas/commissioning-user-data (+22/-8)
To merge this branch: bzr merge lp:~andreserl/maas/commissioning_improvements
Reviewer Review Type Date Requested Status
Scott Moser 2012-10-05 Approve on 2012-10-05
Review via email: mp+128318@code.launchpad.net

Commit Message

Only change from network source from Static to DHCP if required in commissioning script

To post a comment you must log in.
Scott Moser (smoser) wrote :

2 comments, but will say approve:
 a.) first paragraph (explanation of the variable) is a long runon sentance. possibly you could explain that better.
 b.) I'd drop the string "HP Microservers" personally.
 c.) IPMI_SI_PARAMS="type=kcs ports=0xca2"
     if that is not a suitable default, then do not put it in there. if its supposed to "just work", let it "just work". but do not set that default if you're fixing a single piece of hardware with it.

Scott Moser (smoser) :
review: Approve
MAAS Lander (maas-lander) wrote :

No commit message specified.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'etc/maas/commissioning-user-data'
2--- etc/maas/commissioning-user-data 2012-10-05 17:27:14 +0000
3+++ etc/maas/commissioning-user-data 2012-10-05 21:21:23 +0000
4@@ -6,6 +6,17 @@
5 # main does a run-parts of all "scripts" and then calls home to maas with
6 # maas-signal, posting output of each of the files added with add_script()
7 #
8+#### IPMI setup ######
9+# If IPMI network settings have been configured statically, you can
10+# make them DHCP. If 'true', the IPMI network source will be changed
11+# to DHCP.
12+IPMI_CHANGE_STATIC_TO_DHCP="false"
13+
14+# In certain hardware, the parameters for the ipmi_si kernel module
15+# might need be specified. If you wish to send parameters uncomment
16+# the following line.
17+#IPMI_SI_PARAMS="type=kcs ports=0xca2"
18+
19 #### script setup ######
20 TEMP_D=$(mktemp -d "${TMPDIR:-/tmp}/${0##*/}.XXXXXX")
21 SCRIPTS_D="${TEMP_D}/scripts"
22@@ -114,7 +125,11 @@
23 CRED_CFG="$creds"
24
25 # power settings
26- power_settings=$(maas-ipmi-autodetect --configdir "$IPMI_CONFIG_D")
27+ local pargs=""
28+ if $IPMI_CHANGE_STATIC_TO_DHCP; then
29+ pargs="--dhcp-if-static"
30+ fi
31+ power_settings=$(maas-ipmi-autodetect --configdir "$IPMI_CONFIG_D" ${pargs})
32 if [ ! -z "power_settings" ]; then
33 signal "--power-type=ipmi" "--power-parameters=${power_settings}" WORKING "finished [maas-ipmi-autodetect]"
34 fi
35@@ -162,10 +177,7 @@
36 load_modules() {
37 modprobe ipmi_msghandler
38 modprobe ipmi_devintf
39- # In certain hardware, like HP MicroServers, the parameters need
40- # be specified. Otherwise, IPMI won't work due to incorrect port.
41- #modprobe ipmi_si type=kcs ports=0xca2
42- modprobe ipmi_si
43+ modprobe ipmi_si ${IPMI_SI_PARAMS}
44 }
45
46 ### begin writing files ###
47@@ -251,6 +263,8 @@
48 description='send config file to modify IPMI settings with')
49 parser.add_argument("--configdir", metavar="folder",
50 help="specify config file", default=None)
51+ parser.add_argument("--dhcp-if-static", action="store_true",
52+ dest="dhcp", help="specify config file", default=False)
53
54 args = parser.parse_args()
55
56@@ -260,9 +274,9 @@
57 # if False, then failed to detect ipmi
58 exit(1)
59
60- # Check whether IPMI is being set to DHCP
61- # If it is not DHCP, set it to DHCP.
62- if not is_ipmi_dhcp():
63+ # Check whether IPMI is being set to DHCP. If it is not, and
64+ # '--dhcp-if-static' has been passed, Set it to IPMI to DHCP.
65+ if not is_ipmi_dhcp() and args.dhcp:
66 set_ipmi_network_source("Use_DHCP")
67 # allow IPMI 60 seconds to obtain an IP address
68 time.sleep(60)