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
1=== modified file 'src/maasserver/models/node.py'
2--- src/maasserver/models/node.py 2012-12-18 17:33:45 +0000
3+++ src/maasserver/models/node.py 2013-01-15 00:26:23 +0000
4@@ -776,6 +776,7 @@
5 power_params.setdefault('power_address', 'qemu://localhost/system')
6 power_params.setdefault('username', '')
7 power_params.setdefault('power_id', self.system_id)
8+ power_params.setdefault('power_driver', '')
9
10 # The "mac" parameter defaults to the node's primary MAC
11 # address, but only if no power parameters were set at all.
12
13=== modified file 'src/maasserver/power_parameters.py'
14--- src/maasserver/power_parameters.py 2012-12-18 17:33:45 +0000
15+++ src/maasserver/power_parameters.py 2013-01-15 00:26:23 +0000
16@@ -33,7 +33,11 @@
17 from django import forms
18 from maasserver.config_forms import DictCharField
19 from maasserver.fields import MACAddressFormField
20-from provisioningserver.enum import POWER_TYPE
21+from provisioningserver.enum import (
22+ POWER_TYPE,
23+ IPMI_DRIVER_CHOICES,
24+ IPMI_DRIVER
25+ )
26
27
28 POWER_TYPE_PARAMETERS = {
29@@ -88,6 +92,13 @@
30 DictCharField(
31 [
32 (
33+ 'power_driver',
34+ forms.ChoiceField(
35+ label="Driver", required=False,
36+ choices=IPMI_DRIVER_CHOICES,
37+ initial=IPMI_DRIVER.DEFAULT)
38+ ),
39+ (
40 'power_address',
41 forms.CharField(label="IP Address or Hostname",
42 required=False)),
43
44=== modified file 'src/provisioningserver/enum.py'
45--- src/provisioningserver/enum.py 2012-12-18 17:33:45 +0000
46+++ src/provisioningserver/enum.py 2013-01-15 00:26:23 +0000
47@@ -12,6 +12,8 @@
48 __metaclass__ = type
49 __all__ = [
50 'ARP_HTYPE',
51+ 'IPMI_DRIVER',
52+ 'IPMI_DRIVER_CHOICES',
53 'POWER_TYPE',
54 'POWER_TYPE_CHOICES',
55 ]
56@@ -48,6 +50,19 @@
57 )
58
59
60+class IPMI_DRIVER:
61+ DEFAULT = ''
62+ LAN = 'LAN'
63+ LAN_2_0 = 'LAN_2_0'
64+
65+
66+IPMI_DRIVER_CHOICES = (
67+ (IPMI_DRIVER.DEFAULT, "Auto-detect"),
68+ (IPMI_DRIVER.LAN, "LAN (IPMI 1.5)"),
69+ (IPMI_DRIVER.LAN_2_0, "LAN_2_0 (IPMI 2.0)"),
70+ )
71+
72+
73 class ARP_HTYPE:
74 """ARP Hardware Type codes."""
75
76
77=== modified file 'src/provisioningserver/power/templates/ipmi.template'
78--- src/provisioningserver/power/templates/ipmi.template 2012-12-21 15:10:41 +0000
79+++ src/provisioningserver/power/templates/ipmi.template 2013-01-15 00:26:23 +0000
80@@ -8,6 +8,7 @@
81 power_address={{power_address}}
82 power_user={{power_user}}
83 power_pass={{power_pass}}
84+power_driver={{power_driver}}
85 ipmipower={{ipmipower}}
86 ipmi_chassis_config={{ipmi_chassis_config}}
87 config={{config_dir}}/{{ipmi_config}}
88@@ -41,10 +42,16 @@
89 # Issue command to ipmipower, for the given system.
90 issue_ipmi_command() {
91 # See https://launchpad.net/bugs/1053391 for details of this workaround
92- echo workaround |\
93- ${ipmi_chassis_config} -h ${power_address} -u ${power_user} -p ${power_pass} --commit --filename ${config}
94- echo workaround |\
95- ${ipmipower} -h ${power_address} -u ${power_user} -p ${power_pass} "$@"
96+ driver_option=""
97+ if [ -n "$power_driver" ]
98+ then
99+ driver_option="--driver-type=$power_driver"
100+ fi
101+
102+ echo workaround |\
103+ ${ipmi_chassis_config} ${driver_option} -h ${power_address} -u ${power_user} -p ${power_pass} --commit --filename ${config}
104+ echo workaround |\
105+ ${ipmipower} ${driver_option} -h ${power_address} -u ${power_user} -p ${power_pass} "$@"
106 }
107
108
109
110=== modified file 'src/provisioningserver/power/tests/test_poweraction.py'
111--- src/provisioningserver/power/tests/test_poweraction.py 2012-12-19 17:19:03 +0000
112+++ src/provisioningserver/power/tests/test_poweraction.py 2013-01-15 00:26:23 +0000
113@@ -179,7 +179,7 @@
114 action.get_template(), power_change='on',
115 power_address='mystystem', power_user='me', power_pass='me',
116 ipmipower='echo', ipmi_chassis_config='echo', config_dir='dir',
117- ipmi_config='file.conf')
118+ ipmi_config='file.conf', power_driver='LAN')
119 stdout, stderr = action.run_shell(script)
120 self.assertIn("Got unknown power state from ipmipower", stderr)
121
122@@ -204,5 +204,5 @@
123 action.get_template(), power_change='on',
124 power_address='mystystem', power_user='me', power_pass='me',
125 ipmipower='echo', ipmi_chassis_config='echo', config_dir='dir',
126- ipmi_config='file.conf')
127+ ipmi_config='file.conf', power_driver='LAN')
128 self.assertIn(conf_dir, script)