Rename pause/resume osd-out/osd-in

The actions pause and resume actually take all osds on a unit out of the
cluster. This is incredibly misleading.

This change renames to osd-out and osd-in to better describe what the
actions actually do.

Change-Id: I76793999f5d3382563eff308a5d7c4db18d065a0
Closes-Bug: #1793507
This commit is contained in:
David Ames 2018-11-26 14:40:48 -08:00
parent 17c64df681
commit 1e0c6548b8
7 changed files with 20 additions and 32 deletions

View File

@ -4,12 +4,12 @@
#
# Verify with `juju list-action` before proposing/committing
# changes.
pause:
osd-out:
description: |
\
USE WITH CAUTION - Mark unit OSDs as 'out'.
Documentation: https://jujucharms.com/ceph-osd/
resume:
osd-in:
description: |
\
Set the local osd units in the charm to 'in'.

1
actions/osd-in Symbolic link
View File

@ -0,0 +1 @@
osd_in_out.py

1
actions/osd-out Symbolic link
View File

@ -0,0 +1 @@
osd_in_out.py

View File

@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# pause/resume actions file.
# osd_out/osd_in actions file.
import os
import sys
@ -30,18 +30,12 @@ from charmhelpers.core.hookenv import (
from ceph.utils import get_local_osd_ids
from ceph_hooks import assess_status
from charmhelpers.contrib.openstack.utils import (
set_unit_paused,
clear_unit_paused,
)
def pause(args):
def osd_out(args):
"""Pause the ceph-osd units on the local machine only.
Optionally uses the 'osd-number' from juju action param to only pause a
specific osd. If all the osds are not stopped then the paused status is
not set.
Optionally uses the 'osd-number' from juju action param to only osd_out a
specific osd.
@raises CalledProcessError if the ceph commands fails.
@raises OSError if it can't get the local osd ids.
@ -52,14 +46,13 @@ def pause(args):
'--id', 'osd-upgrade',
'osd', 'out', str(local_id)]
check_call(cmd)
set_unit_paused()
assess_status()
def resume(args):
def osd_in(args):
"""Resume the ceph-osd units on this local machine only
@raises subprocess.CalledProcessError should the osd units fails to resume.
@raises subprocess.CalledProcessError should the osd units fails to osd_in.
@raises OSError if the unit can't get the local osd ids
"""
for local_id in get_local_osd_ids():
@ -68,12 +61,11 @@ def resume(args):
'--id', 'osd-upgrade',
'osd', 'in', str(local_id)]
check_call(cmd)
clear_unit_paused()
assess_status()
# A dictionary of all the defined actions to callables (which take
# parsed arguments).
ACTIONS = {"pause": pause, "resume": resume}
ACTIONS = {"osd-out": osd_out, "osd-in": osd_in}
def main(args):

View File

@ -1 +0,0 @@
pause_resume.py

View File

@ -1 +0,0 @@
pause_resume.py

View File

@ -20,42 +20,38 @@ from test_utils import CharmTestCase
sys.path.append('hooks')
import pause_resume as actions
import osd_in_out as actions
class PauseTestCase(CharmTestCase):
class OSDOutTestCase(CharmTestCase):
def setUp(self):
super(PauseTestCase, self).setUp(
super(OSDOutTestCase, self).setUp(
actions, ["check_call",
"get_local_osd_ids",
"set_unit_paused",
"assess_status"])
def test_pauses_services(self):
def test_osd_out(self):
self.get_local_osd_ids.return_value = [5]
actions.pause([])
actions.osd_out([])
cmd = ['ceph', '--id',
'osd-upgrade', 'osd', 'out', '5']
self.check_call.assert_called_once_with(cmd)
self.set_unit_paused.assert_called_once_with()
self.assess_status.assert_called_once_with()
class ResumeTestCase(CharmTestCase):
class OSDInTestCase(CharmTestCase):
def setUp(self):
super(ResumeTestCase, self).setUp(
super(OSDInTestCase, self).setUp(
actions, ["check_call",
"get_local_osd_ids",
"clear_unit_paused",
"assess_status"])
def test_pauses_services(self):
def test_osd_in(self):
self.get_local_osd_ids.return_value = [5]
actions.resume([])
actions.osd_in([])
cmd = ['ceph', '--id',
'osd-upgrade', 'osd', 'in', '5']
self.check_call.assert_called_once_with(cmd)
self.clear_unit_paused.assert_called_once_with()
self.assess_status.assert_called_once_with()