launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #12088
[Merge] lp:~andreserl/maas/use_ipmipower_instead_of_ipmitool into lp:maas
Andres Rodriguez has proposed merging lp:~andreserl/maas/use_ipmipower_instead_of_ipmitool into lp:maas.
Requested reviews:
MAAS Maintainers (maas-maintainers)
For more details, see:
https://code.launchpad.net/~andreserl/maas/use_ipmipower_instead_of_ipmitool/+merge/124752
--
https://code.launchpad.net/~andreserl/maas/use_ipmipower_instead_of_ipmitool/+merge/124752
Your team MAAS Maintainers is requested to review the proposed merge of lp:~andreserl/maas/use_ipmipower_instead_of_ipmitool into lp:maas.
=== modified file 'required-packages/base'
--- required-packages/base 2012-09-12 17:01:41 +0000
+++ required-packages/base 2012-09-17 17:32:19 +0000
@@ -5,7 +5,7 @@
daemontools
distro-info
dnsutils
-ipmitool
+freeipmi-tools
isc-dhcp-common
libpq-dev
postgresql-9.1
=== modified file 'src/maasserver/models/node.py'
--- src/maasserver/models/node.py 2012-08-24 10:45:47 +0000
+++ src/maasserver/models/node.py 2012-09-17 17:32:19 +0000
@@ -560,18 +560,11 @@
power_params.setdefault('system_id', self.system_id)
power_params.setdefault('virsh', '/usr/bin/virsh')
- power_params.setdefault('ipmitool', '/usr/bin/ipmitool')
+ power_params.setdefault('ipmipower', '/usr/bin/ipmipower')
power_params.setdefault('power_address', 'qemu://localhost/system')
power_params.setdefault('username', '')
power_params.setdefault('power_id', self.system_id)
- # Set the default ipmi interface based on the IPMI/IPMI_LAN
- # POWER_TYPE selected
- if self.power_type == POWER_TYPE.IPMI:
- power_params.setdefault('power_ipmi_interface', 'lan')
- if self.power_type == POWER_TYPE.IPMI_LAN:
- power_params.setdefault('power_ipmi_interface', 'lanplus')
-
# The "mac" parameter defaults to the node's primary MAC
# address, but only if no power parameters were set at all.
if not self.power_parameters:
=== modified file 'src/maasserver/power_parameters.py'
--- src/maasserver/power_parameters.py 2012-08-15 13:53:43 +0000
+++ src/maasserver/power_parameters.py 2012-09-17 17:32:19 +0000
@@ -80,20 +80,4 @@
],
required=False,
skip_check=True),
- POWER_TYPE.IPMI_LAN:
- DictCharField(
- [
- (
- 'power_address',
- forms.CharField(label="IP Address or Hostname",
- required=False)),
- (
- 'power_user',
- forms.CharField(label="Username", required=False)),
- (
- 'power_pass',
- forms.CharField(label="Password", required=False)),
- ],
- required=False,
- skip_check=True),
}
=== modified file 'src/provisioningserver/enum.py'
--- src/provisioningserver/enum.py 2012-08-16 09:50:00 +0000
+++ src/provisioningserver/enum.py 2012-09-17 17:32:19 +0000
@@ -34,17 +34,13 @@
WAKE_ON_LAN = 'ether_wake'
# IPMI (Intelligent Platform Management Interface).
- IPMI = 'ipmitool'
-
- # IPMI over LAN.
- IPMI_LAN = 'ipmilan'
+ IPMI = 'ipmi'
POWER_TYPE_CHOICES = (
(POWER_TYPE.VIRSH, "virsh (virtual systems)"),
(POWER_TYPE.WAKE_ON_LAN, "Wake-on-LAN"),
- (POWER_TYPE.IPMI, "IPMI v1.5 (LAN Interface)"),
- (POWER_TYPE.IPMI_LAN, "IPMI v2.0 (RMCP+ LAN Interface)"),
+ (POWER_TYPE.IPMI, "IPMI"),
)
=== renamed file 'src/provisioningserver/power/templates/ipmitool.template' => 'src/provisioningserver/power/templates/ipmi.template'
--- src/provisioningserver/power/templates/ipmitool.template 2012-07-13 19:03:59 +0000
+++ src/provisioningserver/power/templates/ipmi.template 2012-09-17 17:32:19 +0000
@@ -1,6 +1,6 @@
# -*- mode: shell-script -*-
#
-# Control a system via ipmitool
+# Control a system via ipmipower
#
# Parameters.
@@ -8,29 +8,28 @@
power_address={{power_address}}
power_user={{power_user}}
power_pass={{power_pass}}
-ipmitool={{ipmitool}}
-interface={{power_ipmi_interface}}
+ipmipower={{ipmipower}}
formulate_power_state() {
- case $1 in
- 'Chassis Power is on') echo 'on' ;;
- 'Chassis Power is off') echo 'off' ;;
+ case $2 in
+ 'on') echo 'on' ;;
+ 'off') echo 'off' ;;
*)
- echo "Got unknown power state from ipmitool: '$1'" >&2
+ echo "Got unknown power state from ipmipower: '$2'" >&2
exit 1
esac
}
-# Issue command to ipmitool, for the given system.
+# Issue command to ipmipower, for the given system.
issue_ipmi_command() {
- ${ipmitool} -I ${interface} -H ${power_address} -U ${power_user} -P ${power_pass} power $1
+ ${ipmipower} -h ${power_address} -u ${power_user} -p ${power_pass} --$1
}
# Get the given system's power state: 'on' or 'off'.
get_power_state() {
- ipmi_state=$(issue_ipmi_command status)
+ ipmi_state=$(issue_ipmi_command stat)
formulate_power_state ${ipmi_state}
}
=== removed file 'src/provisioningserver/power/templates/ipmilan.template'
--- src/provisioningserver/power/templates/ipmilan.template 2012-07-24 15:49:26 +0000
+++ src/provisioningserver/power/templates/ipmilan.template 1970-01-01 00:00:00 +0000
@@ -1,41 +0,0 @@
-# -*- 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
=== modified file 'src/provisioningserver/power/tests/test_poweraction.py'
--- src/provisioningserver/power/tests/test_poweraction.py 2012-07-13 19:22:34 +0000
+++ src/provisioningserver/power/tests/test_poweraction.py 2012-09-17 17:32:19 +0000
@@ -162,15 +162,6 @@
script = action.render_template(
action.get_template(), power_change='on',
power_address='mystystem', power_user='me', power_pass='me',
- power_ipmi_interface='lan', ipmitool='echo')
- stdout, stderr = action.run_shell(script)
- self.assertIn("Got unknown power state from ipmitool", stderr)
-
- def test_ipmi_lan_checks_state(self):
- action = PowerAction(POWER_TYPE.IPMI_LAN)
- script = action.render_template(
- action.get_template(), power_change='on',
- power_address='mystystem', power_user='me', power_pass='me',
- power_ipmi_interface='lanplus', ipmitool='echo')
- stdout, stderr = action.run_shell(script)
- self.assertIn("Got unknown power state from ipmitool", stderr)
+ ipmipower='echo')
+ stdout, stderr = action.run_shell(script)
+ self.assertIn("Got unknown power state from ipmipower", stderr)
Follow ups