← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~rvb/maas/fix-ipmi-template into lp:maas/1.2

 

Raphaël Badin has proposed merging lp:~rvb/maas/fix-ipmi-template into lp:maas/1.2.

Commit message:
Backport revisions 1465 and 1467.

Requested reviews:
  MAAS Maintainers (maas-maintainers)
Related bugs:
  Bug #1086160 in MAAS: "IPMI Power command does not work"
  https://bugs.launchpad.net/maas/+bug/1086160
  Bug #1171418 in MAAS: "MAAS fails to power up machines when trying to install nodes"
  https://bugs.launchpad.net/maas/+bug/1171418

For more details, see:
https://code.launchpad.net/~rvb/maas/fix-ipmi-template/+merge/160372

This has been tested in the lab (http://10.189.74.2:8080/view/MAAS/job/precise-adt-maas-manual/121/).
-- 
https://code.launchpad.net/~rvb/maas/fix-ipmi-template/+merge/160372
Your team MAAS Maintainers is requested to review the proposed merge of lp:~rvb/maas/fix-ipmi-template into lp:maas/1.2.
=== modified file 'src/provisioningserver/power/templates/ipmi.template'
--- src/provisioningserver/power/templates/ipmi.template	2013-01-14 19:34:18 +0000
+++ src/provisioningserver/power/templates/ipmi.template	2013-04-23 13:55:33 +0000
@@ -45,7 +45,7 @@
     driver_option=""
     if [ -n "$power_driver" ]
         then
-          driver_option="--driver-type=$power_driver"
+          driver_option="--driver-type=${power_driver}"
     fi
 
     echo workaround |\
@@ -54,16 +54,8 @@
     ${ipmipower} ${driver_option} -h ${power_address} -u ${power_user} -p ${power_pass} "$@"
 }
 
-
-# Get the given system's power state: 'on' or 'off'.
-get_power_state() {
-    ipmi_state=$(issue_ipmi_command stat)
-    formulate_power_state ${ipmi_state}
-}
-
-
-if [ "$(get_power_state)" != "${power_change}" ]
-then
-    power_command=$(formulate_power_command ${power_change})
-    issue_ipmi_command ${power_command}
-fi
+# This script deliberately does not check the current power state
+# before issuing the requested power command. See bug 1171418 for an
+# explanation.
+power_command=$(formulate_power_command ${power_change})
+issue_ipmi_command ${power_command}

=== modified file 'src/provisioningserver/power/tests/test_poweraction.py'
--- src/provisioningserver/power/tests/test_poweraction.py	2013-01-14 16:16:57 +0000
+++ src/provisioningserver/power/tests/test_poweraction.py	2013-04-23 13:55:33 +0000
@@ -173,16 +173,6 @@
         stdout, stderr = action.run_shell(script)
         self.assertIn("Got unknown power state from fence_cdu", stderr)
 
-    def test_ipmi_checks_state(self):
-        action = PowerAction(POWER_TYPE.IPMI)
-        script = action.render_template(
-            action.get_template(), power_change='on',
-            power_address='mystystem', power_user='me', power_pass='me',
-            ipmipower='echo', ipmi_chassis_config='echo', config_dir='dir',
-            ipmi_config='file.conf', power_driver='LAN')
-        stdout, stderr = action.run_shell(script)
-        self.assertIn("Got unknown power state from ipmipower", stderr)
-
     def configure_power_config_dir(self, path=None):
         """Configure POWER_CONFIG_DIR to `path`."""
         self.patch(