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
1=== modified file 'src/provisioningserver/drivers/power/hmc.py'
2--- src/provisioningserver/drivers/power/hmc.py 2016-04-11 16:23:26 +0000
3+++ src/provisioningserver/drivers/power/hmc.py 2016-06-24 03:08:58 +0000
4@@ -48,7 +48,7 @@
5 ssh_client.connect(
6 power_address, username=power_user, password=power_pass)
7 _, stdout, _ = ssh_client.exec_command(command)
8- output = stdout.read().decode('utf-8')
9+ output = stdout.read().decode('utf-8').strip()
10 except (SSHException, EOFError, SOCKETError) as e:
11 raise PowerConnError(
12 "Could not make SSH connection to HMC for "
13@@ -66,7 +66,7 @@
14 # Power lpar on
15 self.run_hmc_command(
16 "chsysstate -r lpar -m %s -o on -n %s --bootstring network-all"
17- % (context['server_name'], context['lpar']))
18+ % (context['server_name'], context['lpar']), **context)
19 except PowerConnError as e:
20 raise PowerActionError(
21 "HMC Power Driver unable to power on lpar %s: %s"
22@@ -78,7 +78,7 @@
23 # Power lpar off
24 self.run_hmc_command(
25 "chsysstate -r lpar -m %s -o shutdown -n %s --immed"
26- % (context['server_name'], context['lpar']))
27+ % (context['server_name'], context['lpar']), **context)
28 except PowerConnError as e:
29 raise PowerActionError(
30 "HMC Power Driver unable to power off lpar %s: %s"
31@@ -90,7 +90,7 @@
32 # Power query lpar
33 power_state = self.run_hmc_command(
34 "lssyscfg -m %s -r lpar -F state --filter lpar_names=%s"
35- % (context['server_name'], context['lpar']))
36+ % (context['server_name'], context['lpar']), **context)
37 except PowerConnError as e:
38 raise PowerActionError(
39 "HMC Power Driver unable to power query lpar %s: %s"
40
41=== modified file 'src/provisioningserver/drivers/power/tests/test_hmc.py'
42--- src/provisioningserver/drivers/power/tests/test_hmc.py 2016-05-12 19:07:37 +0000
43+++ src/provisioningserver/drivers/power/tests/test_hmc.py 2016-06-24 03:08:58 +0000
44@@ -96,7 +96,7 @@
45 self.assertThat(
46 run_hmc_command, MockCalledOnceWith(
47 "chsysstate -r lpar -m %s -o on -n %s --bootstring network-all"
48- % (context['server_name'], context['lpar'])))
49+ % (context['server_name'], context['lpar']), **context))
50
51 def test_power_on_crashes_for_connection_error(self):
52 driver = HMCPowerDriver()
53@@ -118,7 +118,7 @@
54 self.assertThat(
55 run_hmc_command, MockCalledOnceWith(
56 "chsysstate -r lpar -m %s -o shutdown -n %s --immed"
57- % (context['server_name'], context['lpar'])))
58+ % (context['server_name'], context['lpar']), **context))
59
60 def test_power_off_crashes_for_connection_error(self):
61 driver = HMCPowerDriver()

Subscribers

People subscribed via source and target branches

to all changes: