Merge lp:~newell-jensen/maas/2.0-fix-1595753 into lp:maas/2.0

Proposed by Newell Jensen on 2016-06-24
Status: Merged
Approved by: Newell Jensen on 2016-06-24
Approved revision: 5137
Merged at revision: 5137
Proposed branch: lp:~newell-jensen/maas/2.0-fix-1595753
Merge into: lp:maas/2.0
Diff against target: 61 lines (+6/-6)
2 files modified
src/provisioningserver/drivers/power/hmc.py (+4/-4)
src/provisioningserver/drivers/power/tests/test_hmc.py (+2/-2)
To merge this branch: bzr merge lp:~newell-jensen/maas/2.0-fix-1595753
Reviewer Review Type Date Requested Status
Newell Jensen Approve on 2016-06-24
Review via email: mp+298269@code.launchpad.net

Commit message

Trunk backport r5142: This branch fixes an HMC regression from MAAS 1.9 to MAAS 2.0. Updates faulty unit tests as well.

To post a comment you must log in.
Newell Jensen (newell-jensen) wrote :

Self approve backport.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/provisioningserver/drivers/power/hmc.py'
--- src/provisioningserver/drivers/power/hmc.py 2016-04-11 16:23:26 +0000
+++ src/provisioningserver/drivers/power/hmc.py 2016-06-24 03:08:58 +0000
@@ -48,7 +48,7 @@
48 ssh_client.connect(48 ssh_client.connect(
49 power_address, username=power_user, password=power_pass)49 power_address, username=power_user, password=power_pass)
50 _, stdout, _ = ssh_client.exec_command(command)50 _, stdout, _ = ssh_client.exec_command(command)
51 output = stdout.read().decode('utf-8')51 output = stdout.read().decode('utf-8').strip()
52 except (SSHException, EOFError, SOCKETError) as e:52 except (SSHException, EOFError, SOCKETError) as e:
53 raise PowerConnError(53 raise PowerConnError(
54 "Could not make SSH connection to HMC for "54 "Could not make SSH connection to HMC for "
@@ -66,7 +66,7 @@
66 # Power lpar on66 # Power lpar on
67 self.run_hmc_command(67 self.run_hmc_command(
68 "chsysstate -r lpar -m %s -o on -n %s --bootstring network-all"68 "chsysstate -r lpar -m %s -o on -n %s --bootstring network-all"
69 % (context['server_name'], context['lpar']))69 % (context['server_name'], context['lpar']), **context)
70 except PowerConnError as e:70 except PowerConnError as e:
71 raise PowerActionError(71 raise PowerActionError(
72 "HMC Power Driver unable to power on lpar %s: %s"72 "HMC Power Driver unable to power on lpar %s: %s"
@@ -78,7 +78,7 @@
78 # Power lpar off78 # Power lpar off
79 self.run_hmc_command(79 self.run_hmc_command(
80 "chsysstate -r lpar -m %s -o shutdown -n %s --immed"80 "chsysstate -r lpar -m %s -o shutdown -n %s --immed"
81 % (context['server_name'], context['lpar']))81 % (context['server_name'], context['lpar']), **context)
82 except PowerConnError as e:82 except PowerConnError as e:
83 raise PowerActionError(83 raise PowerActionError(
84 "HMC Power Driver unable to power off lpar %s: %s"84 "HMC Power Driver unable to power off lpar %s: %s"
@@ -90,7 +90,7 @@
90 # Power query lpar90 # Power query lpar
91 power_state = self.run_hmc_command(91 power_state = self.run_hmc_command(
92 "lssyscfg -m %s -r lpar -F state --filter lpar_names=%s"92 "lssyscfg -m %s -r lpar -F state --filter lpar_names=%s"
93 % (context['server_name'], context['lpar']))93 % (context['server_name'], context['lpar']), **context)
94 except PowerConnError as e:94 except PowerConnError as e:
95 raise PowerActionError(95 raise PowerActionError(
96 "HMC Power Driver unable to power query lpar %s: %s"96 "HMC Power Driver unable to power query lpar %s: %s"
9797
=== modified file 'src/provisioningserver/drivers/power/tests/test_hmc.py'
--- src/provisioningserver/drivers/power/tests/test_hmc.py 2016-05-12 19:07:37 +0000
+++ src/provisioningserver/drivers/power/tests/test_hmc.py 2016-06-24 03:08:58 +0000
@@ -96,7 +96,7 @@
96 self.assertThat(96 self.assertThat(
97 run_hmc_command, MockCalledOnceWith(97 run_hmc_command, MockCalledOnceWith(
98 "chsysstate -r lpar -m %s -o on -n %s --bootstring network-all"98 "chsysstate -r lpar -m %s -o on -n %s --bootstring network-all"
99 % (context['server_name'], context['lpar'])))99 % (context['server_name'], context['lpar']), **context))
100100
101 def test_power_on_crashes_for_connection_error(self):101 def test_power_on_crashes_for_connection_error(self):
102 driver = HMCPowerDriver()102 driver = HMCPowerDriver()
@@ -118,7 +118,7 @@
118 self.assertThat(118 self.assertThat(
119 run_hmc_command, MockCalledOnceWith(119 run_hmc_command, MockCalledOnceWith(
120 "chsysstate -r lpar -m %s -o shutdown -n %s --immed"120 "chsysstate -r lpar -m %s -o shutdown -n %s --immed"
121 % (context['server_name'], context['lpar'])))121 % (context['server_name'], context['lpar']), **context))
122122
123 def test_power_off_crashes_for_connection_error(self):123 def test_power_off_crashes_for_connection_error(self):
124 driver = HMCPowerDriver()124 driver = HMCPowerDriver()

Subscribers

People subscribed via source and target branches

to all changes: