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

Proposed by Andres Rodriguez
Status: Merged
Approved by: Andres Rodriguez
Approved revision: 1421
Merged at revision: 1420
Proposed branch: lp:~andreserl/maas/ipmi_versioning_support_lp1086162
Merge into: lp:maas/trunk
Diff against target: 128 lines (+41/-7)
5 files modified
src/maasserver/models/node.py (+1/-0)
src/maasserver/power_parameters.py (+12/-1)
src/provisioningserver/enum.py (+15/-0)
src/provisioningserver/power/templates/ipmi.template (+11/-4)
src/provisioningserver/power/tests/test_poweraction.py (+2/-2)
To merge this branch: bzr merge lp:~andreserl/maas/ipmi_versioning_support_lp1086162
Reviewer Review Type Date Requested Status
Julian Edwards (community) Approve
Review via email: mp+143193@code.launchpad.net

Commit message

IPMI support for driver versions (LAN 1.5, LAN+ 2.0).

To post a comment you must log in.
Revision history for this message
Andres Rodriguez (andreserl) wrote :

Thanks to Raphael for this patch. I tested it and fixed a minor issue. Otherwise seems to be working as expected.

Revision history for this message
Andres Rodriguez (andreserl) wrote :
Revision history for this message
Julian Edwards (julian-edwards) wrote :

20 -from provisioningserver.enum import POWER_TYPE
21 +from provisioningserver.enum import POWER_TYPE, IPMI_DRIVER_CHOICES, IPMI_DRIVER

Can you reformat this as:

from provisioningserver.enum import (
    IPMI_DRIVER,
    IPMI_DRIVER_CHOICES,
    POWER_TYPE,
    )

Otherwise looks good!

review: Approve
1421. By Andres Rodriguez

Improve formatting

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/maasserver/models/node.py'
--- src/maasserver/models/node.py 2012-12-18 17:33:45 +0000
+++ src/maasserver/models/node.py 2013-01-15 00:26:23 +0000
@@ -776,6 +776,7 @@
776 power_params.setdefault('power_address', 'qemu://localhost/system')776 power_params.setdefault('power_address', 'qemu://localhost/system')
777 power_params.setdefault('username', '')777 power_params.setdefault('username', '')
778 power_params.setdefault('power_id', self.system_id)778 power_params.setdefault('power_id', self.system_id)
779 power_params.setdefault('power_driver', '')
779780
780 # The "mac" parameter defaults to the node's primary MAC781 # The "mac" parameter defaults to the node's primary MAC
781 # address, but only if no power parameters were set at all.782 # address, but only if no power parameters were set at all.
782783
=== modified file 'src/maasserver/power_parameters.py'
--- src/maasserver/power_parameters.py 2012-12-18 17:33:45 +0000
+++ src/maasserver/power_parameters.py 2013-01-15 00:26:23 +0000
@@ -33,7 +33,11 @@
33from django import forms33from django import forms
34from maasserver.config_forms import DictCharField34from maasserver.config_forms import DictCharField
35from maasserver.fields import MACAddressFormField35from maasserver.fields import MACAddressFormField
36from provisioningserver.enum import POWER_TYPE36from provisioningserver.enum import (
37 POWER_TYPE,
38 IPMI_DRIVER_CHOICES,
39 IPMI_DRIVER
40 )
3741
3842
39POWER_TYPE_PARAMETERS = {43POWER_TYPE_PARAMETERS = {
@@ -88,6 +92,13 @@
88 DictCharField(92 DictCharField(
89 [93 [
90 (94 (
95 'power_driver',
96 forms.ChoiceField(
97 label="Driver", required=False,
98 choices=IPMI_DRIVER_CHOICES,
99 initial=IPMI_DRIVER.DEFAULT)
100 ),
101 (
91 'power_address',102 'power_address',
92 forms.CharField(label="IP Address or Hostname",103 forms.CharField(label="IP Address or Hostname",
93 required=False)),104 required=False)),
94105
=== modified file 'src/provisioningserver/enum.py'
--- src/provisioningserver/enum.py 2012-12-18 17:33:45 +0000
+++ src/provisioningserver/enum.py 2013-01-15 00:26:23 +0000
@@ -12,6 +12,8 @@
12__metaclass__ = type12__metaclass__ = type
13__all__ = [13__all__ = [
14 'ARP_HTYPE',14 'ARP_HTYPE',
15 'IPMI_DRIVER',
16 'IPMI_DRIVER_CHOICES',
15 'POWER_TYPE',17 'POWER_TYPE',
16 'POWER_TYPE_CHOICES',18 'POWER_TYPE_CHOICES',
17 ]19 ]
@@ -48,6 +50,19 @@
48 )50 )
4951
5052
53class IPMI_DRIVER:
54 DEFAULT = ''
55 LAN = 'LAN'
56 LAN_2_0 = 'LAN_2_0'
57
58
59IPMI_DRIVER_CHOICES = (
60 (IPMI_DRIVER.DEFAULT, "Auto-detect"),
61 (IPMI_DRIVER.LAN, "LAN (IPMI 1.5)"),
62 (IPMI_DRIVER.LAN_2_0, "LAN_2_0 (IPMI 2.0)"),
63 )
64
65
51class ARP_HTYPE:66class ARP_HTYPE:
52 """ARP Hardware Type codes."""67 """ARP Hardware Type codes."""
5368
5469
=== modified file 'src/provisioningserver/power/templates/ipmi.template'
--- src/provisioningserver/power/templates/ipmi.template 2012-12-21 15:10:41 +0000
+++ src/provisioningserver/power/templates/ipmi.template 2013-01-15 00:26:23 +0000
@@ -8,6 +8,7 @@
8power_address={{power_address}}8power_address={{power_address}}
9power_user={{power_user}}9power_user={{power_user}}
10power_pass={{power_pass}}10power_pass={{power_pass}}
11power_driver={{power_driver}}
11ipmipower={{ipmipower}}12ipmipower={{ipmipower}}
12ipmi_chassis_config={{ipmi_chassis_config}}13ipmi_chassis_config={{ipmi_chassis_config}}
13config={{config_dir}}/{{ipmi_config}}14config={{config_dir}}/{{ipmi_config}}
@@ -41,10 +42,16 @@
41# Issue command to ipmipower, for the given system.42# Issue command to ipmipower, for the given system.
42issue_ipmi_command() {43issue_ipmi_command() {
43 # See https://launchpad.net/bugs/1053391 for details of this workaround44 # See https://launchpad.net/bugs/1053391 for details of this workaround
44 echo workaround |\45 driver_option=""
45 ${ipmi_chassis_config} -h ${power_address} -u ${power_user} -p ${power_pass} --commit --filename ${config}46 if [ -n "$power_driver" ]
46 echo workaround |\47 then
47 ${ipmipower} -h ${power_address} -u ${power_user} -p ${power_pass} "$@"48 driver_option="--driver-type=$power_driver"
49 fi
50
51 echo workaround |\
52 ${ipmi_chassis_config} ${driver_option} -h ${power_address} -u ${power_user} -p ${power_pass} --commit --filename ${config}
53 echo workaround |\
54 ${ipmipower} ${driver_option} -h ${power_address} -u ${power_user} -p ${power_pass} "$@"
48}55}
4956
5057
5158
=== modified file 'src/provisioningserver/power/tests/test_poweraction.py'
--- src/provisioningserver/power/tests/test_poweraction.py 2012-12-19 17:19:03 +0000
+++ src/provisioningserver/power/tests/test_poweraction.py 2013-01-15 00:26:23 +0000
@@ -179,7 +179,7 @@
179 action.get_template(), power_change='on',179 action.get_template(), power_change='on',
180 power_address='mystystem', power_user='me', power_pass='me',180 power_address='mystystem', power_user='me', power_pass='me',
181 ipmipower='echo', ipmi_chassis_config='echo', config_dir='dir',181 ipmipower='echo', ipmi_chassis_config='echo', config_dir='dir',
182 ipmi_config='file.conf')182 ipmi_config='file.conf', power_driver='LAN')
183 stdout, stderr = action.run_shell(script)183 stdout, stderr = action.run_shell(script)
184 self.assertIn("Got unknown power state from ipmipower", stderr)184 self.assertIn("Got unknown power state from ipmipower", stderr)
185185
@@ -204,5 +204,5 @@
204 action.get_template(), power_change='on',204 action.get_template(), power_change='on',
205 power_address='mystystem', power_user='me', power_pass='me',205 power_address='mystystem', power_user='me', power_pass='me',
206 ipmipower='echo', ipmi_chassis_config='echo', config_dir='dir',206 ipmipower='echo', ipmi_chassis_config='echo', config_dir='dir',
207 ipmi_config='file.conf')207 ipmi_config='file.conf', power_driver='LAN')
208 self.assertIn(conf_dir, script)208 self.assertIn(conf_dir, script)