Add set/unset noout actions

Adds two new actions, to drive ceph osd set noout and it's opposite.

Change-Id: I5b80c18d21a6e9118bb13ad9af6bc80d353e3436
Depends-On: I3d5fc96b9b69fd98b7d84b5aed6079f3b02c19ab
This commit is contained in:
Xav Paice 2017-09-29 16:03:33 +13:00
parent 5dbafb0b2f
commit 91d6885e50
6 changed files with 83 additions and 0 deletions

View File

@ -229,3 +229,7 @@ crushmap-update:
show-disk-free:
description: Show disk utilization by host and OSD.
additionalProperties: false
set-noout:
description: Set ceph noout across the cluster.
unset-noout:
description: Unset ceph noout across the cluster.

1
actions/set-noout Symbolic link
View File

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

28
actions/set_noout.py Executable file
View File

@ -0,0 +1,28 @@
#!/usr/bin/python
#
# Copyright 2017 Canonical Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import sys
sys.path.append('hooks')
from charmhelpers.core.hookenv import action_set, action_fail
sys.path.append('lib')
from ceph.utils import osd_noout
if __name__ == '__main__':
result = osd_noout(True)
if result:
action_set({'message': 'Ceph osd noout has been set'})
else:
action_fail('Ceph osd noout failed to set')

1
actions/unset-noout Symbolic link
View File

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

28
actions/unset_noout.py Executable file
View File

@ -0,0 +1,28 @@
#!/usr/bin/python
#
# Copyright 2017 Canonical Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import sys
sys.path.append('hooks')
from charmhelpers.core.hookenv import action_set, action_fail
sys.path.append('lib')
from ceph.utils import osd_noout
if __name__ == '__main__':
result = osd_noout(False)
if result:
action_set({'message': 'Ceph osd noout has been unset'})
else:
action_fail('Ceph osd noout failed to unset')

View File

@ -568,6 +568,27 @@ class CephBasicDeployment(OpenStackAmuletDeployment):
assert "cache_mode" not in pool_line, \
"cache_mode is still enabled on cache pool"
def test_404_set_noout_actions(self):
"""Verify that set/unset noout works"""
u.log.debug("Testing set noout")
cmd = "ceph -s"
sentry_unit = self.ceph0_sentry
action_id = u.run_action(sentry_unit, 'set-noout')
assert u.wait_on_action(action_id), "Set noout action failed."
output, code = sentry_unit.run(cmd)
if 'noout' not in output:
amulet.raise_status(amulet.FAIL, msg="Missing noout")
u.log.debug("Testing unset noout")
action_id = u.run_action(sentry_unit, 'unset-noout')
assert u.wait_on_action(action_id), "Unset noout action failed."
output, code = sentry_unit.run(cmd)
if 'noout' in output:
amulet.raise_status(amulet.FAIL, msg="Still has noout")
def test_410_ceph_cinder_vol_create(self):
"""Create and confirm a ceph-backed cinder volume, and inspect
ceph cinder pool object count as the volume is created