Merge lp:~allenap/maas/remove-ipmi-optimisation into lp:~maas-committers/maas/trunk

Proposed by Gavin Panella
Status: Merged
Approved by: Raphaël Badin
Approved revision: no longer in the source branch.
Merged at revision: 1467
Proposed branch: lp:~allenap/maas/remove-ipmi-optimisation
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 55 lines (+6/-24)
2 files modified
src/provisioningserver/power/templates/ipmi.template (+6/-14)
src/provisioningserver/power/tests/test_poweraction.py (+0/-10)
To merge this branch: bzr merge lp:~allenap/maas/remove-ipmi-optimisation
Reviewer Review Type Date Requested Status
Raphaël Badin (community) Approve
Andres Rodriguez Pending
Review via email: mp+160146@code.launchpad.net

Commit message

Formally revert to old IPMI power control behaviour: do not check the current state before issuing a power command.

To post a comment you must log in.
Revision history for this message
Raphaël Badin (rvb) wrote :

Looks good to me.

[0]

30 +# This script used to get the current power state, then only send a power
31 +# command if a change was needed. See bug 1171418 for an explanation.

It sounds a bit weird to only say what *used to* happen here. I think a short line explaining that we do not check the current power state and why would be welcome.

review: Approve
Revision history for this message
Raphaël Badin (rvb) wrote :

I've added Andres as a reviewer for this as he's the one who know this IPMI stuff best.

Revision history for this message
Raphaël Badin (rvb) wrote :

I'm building a package from this branch to test it in the lab.

Revision history for this message
Raphaël Badin (rvb) wrote :

> I'm building a package from this branch to test it in the lab.

Tests passed: http://10.189.74.2:8080/view/MAAS/job/raring-adt-maas-manual/31/ARCH=amd64,label=lenovo-RD230-01/console

Revision history for this message
Raphaël Badin (rvb) wrote :

After discussing the matter with the team we decided to land this. But we will ping Andres so he could have a look at it. If he thinks we should change this, we will do it in a follow-up branch.

Revision history for this message
Andres Rodriguez (andreserl) wrote :

So I have tested this in hardware and have not been able to reproduce.

What I believe is happening here, however, is that the integration tests run too fast in comparison to how fast the BMC actually reacts to the power changes. For example:

Say we tell a node to 'stop' and immediately after to 'start'. Say this is happening in 2 microseconds. However, the BMC takes 5 seconds to actually turn off the node. So by the time the 'start' command is executed with the ipmi.template, the --stat shows that the node is on because the BMC hasn't turn it off yet (say it's in second 2 out of 5 the BMC takes to turn off the node), hence, causing this causes the script to eventually not turn the node on.

I do believe that the fix here is an improvement that is necessary to ensure that a node gets turned off or turned on regardless of its current power status. However, this does *not* break MAAS, nor makes it unusable. I have tested this several ways in my local Hardware Environment and have not been able to reproduce this.

However, I'm happy to fix this in Raring though! I'll SRU as soon as raring is out.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/provisioningserver/power/templates/ipmi.template'
--- src/provisioningserver/power/templates/ipmi.template 2013-04-18 19:30:26 +0000
+++ src/provisioningserver/power/templates/ipmi.template 2013-04-22 16:26:27 +0000
@@ -45,7 +45,7 @@
45 driver_option=""45 driver_option=""
46 if [ -n "$power_driver" ]46 if [ -n "$power_driver" ]
47 then47 then
48 driver_option="--driver-type=$power_driver"48 driver_option="--driver-type=${power_driver}"
49 fi49 fi
5050
51 echo workaround |\51 echo workaround |\
@@ -54,16 +54,8 @@
54 ${ipmipower} ${driver_option} -h ${power_address} -u ${power_user} -p ${power_pass} "$@"54 ${ipmipower} ${driver_option} -h ${power_address} -u ${power_user} -p ${power_pass} "$@"
55}55}
5656
5757# This script deliberately does not check the current power state
58# Get the given system's power state: 'on' or 'off'.58# before issuing the requested power command. See bug 1171418 for an
59get_power_state() {59# explanation.
60 ipmi_state=$(issue_ipmi_command --stat)60power_command=$(formulate_power_command ${power_change})
61 formulate_power_state ${ipmi_state}61issue_ipmi_command ${power_command}
62}
63
64
65if [ "$(get_power_state)" != "${power_change}" ]
66then
67 power_command=$(formulate_power_command ${power_change})
68 issue_ipmi_command ${power_command}
69fi
7062
=== modified file 'src/provisioningserver/power/tests/test_poweraction.py'
--- src/provisioningserver/power/tests/test_poweraction.py 2013-03-15 11:47:04 +0000
+++ src/provisioningserver/power/tests/test_poweraction.py 2013-04-22 16:26:27 +0000
@@ -180,16 +180,6 @@
180 output = action.run_shell(script)180 output = action.run_shell(script)
181 self.assertIn("Got unknown power state from fence_cdu", output)181 self.assertIn("Got unknown power state from fence_cdu", output)
182182
183 def test_ipmi_checks_state(self):
184 action = PowerAction(POWER_TYPE.IPMI)
185 script = action.render_template(
186 action.get_template(), power_change='on',
187 power_address='mystystem', power_user='me', power_pass='me',
188 ipmipower='echo', ipmi_chassis_config='echo', config_dir='dir',
189 ipmi_config='file.conf', power_driver='LAN')
190 output = action.run_shell(script)
191 self.assertIn("Got unknown power state from ipmipower", output)
192
193 def configure_power_config_dir(self, path=None):183 def configure_power_config_dir(self, path=None):
194 """Configure POWER_CONFIG_DIR to `path`."""184 """Configure POWER_CONFIG_DIR to `path`."""
195 self.patch(185 self.patch(