diff --git a/actions.yaml b/actions.yaml index 3be669ce..16c11267 100644 --- a/actions.yaml +++ b/actions.yaml @@ -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'. diff --git a/actions/osd-in b/actions/osd-in new file mode 120000 index 00000000..1cc47e9f --- /dev/null +++ b/actions/osd-in @@ -0,0 +1 @@ +osd_in_out.py \ No newline at end of file diff --git a/actions/osd-out b/actions/osd-out new file mode 120000 index 00000000..1cc47e9f --- /dev/null +++ b/actions/osd-out @@ -0,0 +1 @@ +osd_in_out.py \ No newline at end of file diff --git a/actions/pause_resume.py b/actions/osd_in_out.py similarity index 85% rename from actions/pause_resume.py rename to actions/osd_in_out.py index 1c19d5b1..f5525fec 100755 --- a/actions/pause_resume.py +++ b/actions/osd_in_out.py @@ -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): diff --git a/actions/pause b/actions/pause deleted file mode 120000 index bd4c0e00..00000000 --- a/actions/pause +++ /dev/null @@ -1 +0,0 @@ -pause_resume.py \ No newline at end of file diff --git a/actions/resume b/actions/resume deleted file mode 120000 index bd4c0e00..00000000 --- a/actions/resume +++ /dev/null @@ -1 +0,0 @@ -pause_resume.py \ No newline at end of file diff --git a/unit_tests/test_actions_pause_resume.py b/unit_tests/test_actions_osd_out_in.py similarity index 82% rename from unit_tests/test_actions_pause_resume.py rename to unit_tests/test_actions_osd_out_in.py index b0ac4418..f8b3546c 100644 --- a/unit_tests/test_actions_pause_resume.py +++ b/unit_tests/test_actions_osd_out_in.py @@ -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()