Use osd-upgrade user for pause/resume
The pause and resume actions shell out to the ceph command to run OSD operations (in/out). Because the default cephx key given out by the monitor cluster does not contain the correct permissions, these commands fail. Use the osd-upgrade user which has the correct permissions. Closes-Bug: 1602826 Depends-On: I6af43b61149c6eeeeb5c77950701194beda2da71 Change-Id: Ie31bc9048972dbb0986ac8deb5b821a4db5d585f
This commit is contained in:
parent
107291ea84
commit
3ab6133c2a
@ -46,7 +46,10 @@ def pause(args):
|
|||||||
@raises OSError if it can't get the local osd ids.
|
@raises OSError if it can't get the local osd ids.
|
||||||
"""
|
"""
|
||||||
for local_id in get_local_osd_ids():
|
for local_id in get_local_osd_ids():
|
||||||
cmd = ['ceph', 'osd', 'out', str(local_id)]
|
cmd = [
|
||||||
|
'ceph',
|
||||||
|
'--id', 'osd-upgrade',
|
||||||
|
'osd', 'out', str(local_id)]
|
||||||
check_call(cmd)
|
check_call(cmd)
|
||||||
set_unit_paused()
|
set_unit_paused()
|
||||||
assess_status()
|
assess_status()
|
||||||
@ -59,12 +62,14 @@ def resume(args):
|
|||||||
@raises OSError if the unit can't get the local osd ids
|
@raises OSError if the unit can't get the local osd ids
|
||||||
"""
|
"""
|
||||||
for local_id in get_local_osd_ids():
|
for local_id in get_local_osd_ids():
|
||||||
cmd = ['ceph', 'osd', 'in', str(local_id)]
|
cmd = [
|
||||||
|
'ceph',
|
||||||
|
'--id', 'osd-upgrade',
|
||||||
|
'osd', 'in', str(local_id)]
|
||||||
check_call(cmd)
|
check_call(cmd)
|
||||||
clear_unit_paused()
|
clear_unit_paused()
|
||||||
assess_status()
|
assess_status()
|
||||||
|
|
||||||
|
|
||||||
# A dictionary of all the defined actions to callables (which take
|
# A dictionary of all the defined actions to callables (which take
|
||||||
# parsed arguments).
|
# parsed arguments).
|
||||||
ACTIONS = {"pause": pause, "resume": resume}
|
ACTIONS = {"pause": pause, "resume": resume}
|
||||||
|
@ -24,7 +24,6 @@ import pause_resume as actions
|
|||||||
|
|
||||||
|
|
||||||
class PauseTestCase(CharmTestCase):
|
class PauseTestCase(CharmTestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(PauseTestCase, self).setUp(
|
super(PauseTestCase, self).setUp(
|
||||||
actions, ["check_call",
|
actions, ["check_call",
|
||||||
@ -35,14 +34,14 @@ class PauseTestCase(CharmTestCase):
|
|||||||
def test_pauses_services(self):
|
def test_pauses_services(self):
|
||||||
self.get_local_osd_ids.return_value = [5]
|
self.get_local_osd_ids.return_value = [5]
|
||||||
actions.pause([])
|
actions.pause([])
|
||||||
cmd = ['ceph', 'osd', 'out', '5']
|
cmd = ['ceph', '--id',
|
||||||
|
'osd-upgrade', 'osd', 'out', '5']
|
||||||
self.check_call.assert_called_once_with(cmd)
|
self.check_call.assert_called_once_with(cmd)
|
||||||
self.set_unit_paused.assert_called_once_with()
|
self.set_unit_paused.assert_called_once_with()
|
||||||
self.assess_status.assert_called_once_with()
|
self.assess_status.assert_called_once_with()
|
||||||
|
|
||||||
|
|
||||||
class ResumeTestCase(CharmTestCase):
|
class ResumeTestCase(CharmTestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(ResumeTestCase, self).setUp(
|
super(ResumeTestCase, self).setUp(
|
||||||
actions, ["check_call",
|
actions, ["check_call",
|
||||||
@ -53,14 +52,14 @@ class ResumeTestCase(CharmTestCase):
|
|||||||
def test_pauses_services(self):
|
def test_pauses_services(self):
|
||||||
self.get_local_osd_ids.return_value = [5]
|
self.get_local_osd_ids.return_value = [5]
|
||||||
actions.resume([])
|
actions.resume([])
|
||||||
cmd = ['ceph', 'osd', 'in', '5']
|
cmd = ['ceph', '--id',
|
||||||
|
'osd-upgrade', 'osd', 'in', '5']
|
||||||
self.check_call.assert_called_once_with(cmd)
|
self.check_call.assert_called_once_with(cmd)
|
||||||
self.clear_unit_paused.assert_called_once_with()
|
self.clear_unit_paused.assert_called_once_with()
|
||||||
self.assess_status.assert_called_once_with()
|
self.assess_status.assert_called_once_with()
|
||||||
|
|
||||||
|
|
||||||
class MainTestCase(CharmTestCase):
|
class MainTestCase(CharmTestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(MainTestCase, self).setUp(actions, ["action_fail"])
|
super(MainTestCase, self).setUp(actions, ["action_fail"])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user