← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~andreserl/maas/ipmi_versioning_support_lp1086162 into lp:maas

 

Andres Rodriguez has proposed merging lp:~andreserl/maas/ipmi_versioning_support_lp1086162 into lp:maas.

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

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1086162 in MAAS: "IPMI based power management default to IPMI 1.5 based authentication"
  https://bugs.launchpad.net/maas/+bug/1086162

For more details, see:
https://code.launchpad.net/~andreserl/maas/ipmi_versioning_support_lp1086162/+merge/143193
-- 
https://code.launchpad.net/~andreserl/maas/ipmi_versioning_support_lp1086162/+merge/143193
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~andreserl/maas/ipmi_versioning_support_lp1086162 into lp:maas.
=== 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-14 22:08:28 +0000
@@ -776,6 +776,7 @@
         power_params.setdefault('power_address', 'qemu://localhost/system')
         power_params.setdefault('username', '')
         power_params.setdefault('power_id', self.system_id)
+        power_params.setdefault('power_driver', '')
 
         # The "mac" parameter defaults to the node's primary MAC
         # address, but only if no power parameters were set at all.

=== 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-14 22:08:28 +0000
@@ -33,7 +33,7 @@
 from django import forms
 from maasserver.config_forms import DictCharField
 from maasserver.fields import MACAddressFormField
-from provisioningserver.enum import POWER_TYPE
+from provisioningserver.enum import POWER_TYPE, IPMI_DRIVER_CHOICES, IPMI_DRIVER
 
 
 POWER_TYPE_PARAMETERS = {
@@ -88,6 +88,13 @@
         DictCharField(
             [
                 (
+                    'power_driver',
+                    forms.ChoiceField(
+                        label="Driver", required=False,
+                        choices=IPMI_DRIVER_CHOICES,
+                        initial=IPMI_DRIVER.DEFAULT)
+                ),
+                (
                     'power_address',
                     forms.CharField(label="IP Address or Hostname",
                         required=False)),

=== modified file 'src/provisioningserver/enum.py'
--- src/provisioningserver/enum.py	2012-12-18 17:33:45 +0000
+++ src/provisioningserver/enum.py	2013-01-14 22:08:28 +0000
@@ -12,6 +12,8 @@
 __metaclass__ = type
 __all__ = [
     'ARP_HTYPE',
+    'IPMI_DRIVER',
+    'IPMI_DRIVER_CHOICES',
     'POWER_TYPE',
     'POWER_TYPE_CHOICES',
     ]
@@ -48,6 +50,19 @@
     )
 
 
+class IPMI_DRIVER:
+    DEFAULT = ''
+    LAN = 'LAN'
+    LAN_2_0 = 'LAN_2_0'
+
+
+IPMI_DRIVER_CHOICES = (
+    (IPMI_DRIVER.DEFAULT, "Auto-detect"),
+    (IPMI_DRIVER.LAN, "LAN (IPMI 1.5)"),
+    (IPMI_DRIVER.LAN_2_0, "LAN_2_0 (IPMI 2.0)"),
+    )
+
+
 class ARP_HTYPE:
     """ARP Hardware Type codes."""
 

=== 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-14 22:08:28 +0000
@@ -8,6 +8,7 @@
 power_address={{power_address}}
 power_user={{power_user}}
 power_pass={{power_pass}}
+power_driver={{power_driver}}
 ipmipower={{ipmipower}}
 ipmi_chassis_config={{ipmi_chassis_config}}
 config={{config_dir}}/{{ipmi_config}}
@@ -41,10 +42,16 @@
 # Issue command to ipmipower, for the given system.
 issue_ipmi_command() {
     # See https://launchpad.net/bugs/1053391 for details of this workaround
-    echo workaround |\
-    ${ipmi_chassis_config} -h ${power_address} -u ${power_user} -p ${power_pass} --commit --filename ${config}
-    echo workaround |\
-    ${ipmipower} -h ${power_address} -u ${power_user} -p ${power_pass} "$@"
+    driver_option=""
+    if [ -n "$power_driver" ]
+        then
+          driver_option="--driver-type=$power_driver"
+    fi
+
+    echo workaround |\
+    ${ipmi_chassis_config} ${driver_option} -h ${power_address} -u ${power_user} -p ${power_pass} --commit --filename ${config}
+    echo workaround |\
+    ${ipmipower} ${driver_option} -h ${power_address} -u ${power_user} -p ${power_pass} "$@"
 }
 
 

=== 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-14 22:08:28 +0000
@@ -179,7 +179,7 @@
             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')
+            ipmi_config='file.conf', power_driver='LAN')
         stdout, stderr = action.run_shell(script)
         self.assertIn("Got unknown power state from ipmipower", stderr)
 
@@ -204,5 +204,5 @@
             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')
+            ipmi_config='file.conf', power_driver='LAN')
         self.assertIn(conf_dir, script)


Follow ups