← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~andreserl/maas/commissioning_improvements into lp:maas

 

Andres Rodriguez has proposed merging lp:~andreserl/maas/commissioning_improvements into lp:maas.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~andreserl/maas/commissioning_improvements/+merge/128318
-- 
https://code.launchpad.net/~andreserl/maas/commissioning_improvements/+merge/128318
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~andreserl/maas/commissioning_improvements into lp:maas.
=== modified file 'etc/maas/commissioning-user-data'
--- etc/maas/commissioning-user-data	2012-10-05 17:27:14 +0000
+++ etc/maas/commissioning-user-data	2012-10-05 21:03:23 +0000
@@ -6,6 +6,18 @@
 # main does a run-parts of all "scripts" and then calls home to maas with
 # maas-signal, posting output of each of the files added with add_script()
 #
+####  IPMI setup  ######
+# If IPMI has been configured with an Static IP address, the following
+# option, if enabled, will allow to override that value and use DHCP
+# as the network source instead. To enable set it to 'true'.
+IPMI_CHANGE_STATIC_TO_DHCP="false"
+
+# In certain hardware, like HP MicroServers, the parameters for
+# the ipmi_si kernel module might need be specified. Otherwise,
+# IPMI won't. If you wish to send parameters uncomment the
+# following line
+#IPMI_SI_PARAMS="type=kcs ports=0xca2"
+
 #### script setup ######
 TEMP_D=$(mktemp -d "${TMPDIR:-/tmp}/${0##*/}.XXXXXX")
 SCRIPTS_D="${TEMP_D}/scripts"
@@ -114,7 +126,11 @@
    CRED_CFG="$creds"
 
    # power settings
-   power_settings=$(maas-ipmi-autodetect --configdir "$IPMI_CONFIG_D")
+   local pargs=""
+   if $IPMI_CHANGE_STATIC_TO_DHCP; then
+      pargs="--dhcp-if-static"
+   fi
+   power_settings=$(maas-ipmi-autodetect --configdir "$IPMI_CONFIG_D" ${pargs})
    if [ ! -z "power_settings" ]; then
       signal "--power-type=ipmi" "--power-parameters=${power_settings}" WORKING "finished [maas-ipmi-autodetect]"
    fi
@@ -162,10 +178,7 @@
 load_modules() {
    modprobe ipmi_msghandler
    modprobe ipmi_devintf
-   # In certain hardware, like HP MicroServers, the parameters need
-   # be specified. Otherwise, IPMI won't work due to incorrect port.
-   #modprobe ipmi_si type=kcs ports=0xca2
-   modprobe ipmi_si
+   modprobe ipmi_si ${IPMI_SI_PARAMS}
 }
 
 ### begin writing files ###
@@ -251,6 +264,8 @@
         description='send config file to modify IPMI settings with')
     parser.add_argument("--configdir", metavar="folder",
         help="specify config file", default=None)
+    parser.add_argument("--dhcp-if-static", action="store_true",
+        dest="dhcp", help="specify config file", default=False)
 
     args = parser.parse_args()
 
@@ -260,9 +275,9 @@
         # if False, then failed to detect ipmi
         exit(1)
 
-    # Check whether IPMI is being set to DHCP
-    # If it is not DHCP, set it to DHCP.
-    if not is_ipmi_dhcp():
+    # Check whether IPMI is being set to DHCP. If it is not, and
+    # '--dhcp-if-static' has been passed,  Set it to IPMI to DHCP.
+    if not is_ipmi_dhcp() and args.dhcp:
         set_ipmi_network_source("Use_DHCP")
         # allow IPMI 60 seconds to obtain an IP address
         time.sleep(60)