launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #10225
[Merge] lp:~andreserl/maas/ipmi_add_template into lp:maas
Andres Rodriguez has proposed merging lp:~andreserl/maas/ipmi_add_template into lp:maas.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~andreserl/maas/ipmi_add_template/+merge/116509
--
https://code.launchpad.net/~andreserl/maas/ipmi_add_template/+merge/116509
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~andreserl/maas/ipmi_add_template into lp:maas.
=== modified file 'src/provisioningserver/enum.py'
--- src/provisioningserver/enum.py 2012-07-13 18:27:44 +0000
+++ src/provisioningserver/enum.py 2012-07-24 16:02:22 +0000
@@ -59,7 +59,7 @@
IPMI = 'ipmitool'
# IPMI over LAN.
- IPMI_LAN = 'ipmitool'
+ IPMI_LAN = 'ipmilan'
POWER_TYPE_CHOICES = (
=== added file 'src/provisioningserver/power/templates/ipmilan.template'
--- src/provisioningserver/power/templates/ipmilan.template 1970-01-01 00:00:00 +0000
+++ src/provisioningserver/power/templates/ipmilan.template 2012-07-24 16:02:22 +0000
@@ -0,0 +1,41 @@
+# -*- mode: shell-script -*-
+#
+# Control a system via ipmitool
+#
+
+# Parameters.
+power_change={{power_change}}
+power_address={{power_address}}
+power_user={{power_user}}
+power_pass={{power_pass}}
+ipmitool={{ipmitool}}
+interface={{power_ipmi_interface}}
+
+
+formulate_power_state() {
+ case $1 in
+ 'Chassis Power is on') echo 'on' ;;
+ 'Chassis Power is off') echo 'off' ;;
+ *)
+ echo "Got unknown power state from ipmitool: '$1'" >&2
+ exit 1
+ esac
+}
+
+# Issue command to ipmitool, for the given system.
+issue_ipmi_command() {
+ ${ipmitool} -I ${interface} -H ${power_address} -U ${power_user} -P ${power_pass} power $1
+}
+
+
+# Get the given system's power state: 'on' or 'off'.
+get_power_state() {
+ ipmi_state=$(issue_ipmi_command status)
+ formulate_power_state ${ipmi_state}
+}
+
+
+if [ "$(get_power_state)" != "${power_change}" ]
+then
+ issue_ipmi_command ${power_change}
+fi
Follow ups