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
1=== modified file 'src/provisioningserver/power/templates/ipmi.template'
2--- src/provisioningserver/power/templates/ipmi.template 2013-04-18 19:30:26 +0000
3+++ src/provisioningserver/power/templates/ipmi.template 2013-04-22 16:26:27 +0000
4@@ -45,7 +45,7 @@
5 driver_option=""
6 if [ -n "$power_driver" ]
7 then
8- driver_option="--driver-type=$power_driver"
9+ driver_option="--driver-type=${power_driver}"
10 fi
11
12 echo workaround |\
13@@ -54,16 +54,8 @@
14 ${ipmipower} ${driver_option} -h ${power_address} -u ${power_user} -p ${power_pass} "$@"
15 }
16
17-
18-# Get the given system's power state: 'on' or 'off'.
19-get_power_state() {
20- ipmi_state=$(issue_ipmi_command --stat)
21- formulate_power_state ${ipmi_state}
22-}
23-
24-
25-if [ "$(get_power_state)" != "${power_change}" ]
26-then
27- power_command=$(formulate_power_command ${power_change})
28- issue_ipmi_command ${power_command}
29-fi
30+# This script deliberately does not check the current power state
31+# before issuing the requested power command. See bug 1171418 for an
32+# explanation.
33+power_command=$(formulate_power_command ${power_change})
34+issue_ipmi_command ${power_command}
35
36=== modified file 'src/provisioningserver/power/tests/test_poweraction.py'
37--- src/provisioningserver/power/tests/test_poweraction.py 2013-03-15 11:47:04 +0000
38+++ src/provisioningserver/power/tests/test_poweraction.py 2013-04-22 16:26:27 +0000
39@@ -180,16 +180,6 @@
40 output = action.run_shell(script)
41 self.assertIn("Got unknown power state from fence_cdu", output)
42
43- def test_ipmi_checks_state(self):
44- action = PowerAction(POWER_TYPE.IPMI)
45- script = action.render_template(
46- action.get_template(), power_change='on',
47- power_address='mystystem', power_user='me', power_pass='me',
48- ipmipower='echo', ipmi_chassis_config='echo', config_dir='dir',
49- ipmi_config='file.conf', power_driver='LAN')
50- output = action.run_shell(script)
51- self.assertIn("Got unknown power state from ipmipower", output)
52-
53 def configure_power_config_dir(self, path=None):
54 """Configure POWER_CONFIG_DIR to `path`."""
55 self.patch(