Symlink Actions
This change symlinks the python actions files so that tox can properly test the code. Change-Id: Ib6d070555535dc202735124afdafa8dd401350df
This commit is contained in:
parent
43d03f0fac
commit
1d27ca64b9
@ -1 +1 @@
|
||||
create-cache-tier.py
|
||||
./create-cache-tier.py
|
@ -1,89 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
from subprocess import CalledProcessError
|
||||
import sys
|
||||
|
||||
sys.path.append('hooks')
|
||||
|
||||
from charmhelpers.contrib.storage.linux.ceph import create_erasure_profile
|
||||
from charmhelpers.core.hookenv import action_get, log, action_fail
|
||||
|
||||
|
||||
def make_erasure_profile():
|
||||
name = action_get("name")
|
||||
plugin = action_get("plugin")
|
||||
failure_domain = action_get("failure-domain")
|
||||
|
||||
# jerasure requires k+m
|
||||
# isa requires k+m
|
||||
# local requires k+m+l
|
||||
# shec requires k+m+c
|
||||
|
||||
if plugin == "jerasure":
|
||||
k = action_get("data-chunks")
|
||||
m = action_get("coding-chunks")
|
||||
try:
|
||||
create_erasure_profile(service='admin',
|
||||
erasure_plugin_name=plugin,
|
||||
profile_name=name,
|
||||
data_chunks=k,
|
||||
coding_chunks=m,
|
||||
failure_domain=failure_domain)
|
||||
except CalledProcessError as e:
|
||||
log(e)
|
||||
action_fail("Create erasure profile failed with "
|
||||
"message: {}".format(e.message))
|
||||
elif plugin == "isa":
|
||||
k = action_get("data-chunks")
|
||||
m = action_get("coding-chunks")
|
||||
try:
|
||||
create_erasure_profile(service='admin',
|
||||
erasure_plugin_name=plugin,
|
||||
profile_name=name,
|
||||
data_chunks=k,
|
||||
coding_chunks=m,
|
||||
failure_domain=failure_domain)
|
||||
except CalledProcessError as e:
|
||||
log(e)
|
||||
action_fail("Create erasure profile failed with "
|
||||
"message: {}".format(e.message))
|
||||
elif plugin == "local":
|
||||
k = action_get("data-chunks")
|
||||
m = action_get("coding-chunks")
|
||||
l = action_get("locality-chunks")
|
||||
try:
|
||||
create_erasure_profile(service='admin',
|
||||
erasure_plugin_name=plugin,
|
||||
profile_name=name,
|
||||
data_chunks=k,
|
||||
coding_chunks=m,
|
||||
locality=l,
|
||||
failure_domain=failure_domain)
|
||||
except CalledProcessError as e:
|
||||
log(e)
|
||||
action_fail("Create erasure profile failed with "
|
||||
"message: {}".format(e.message))
|
||||
elif plugin == "shec":
|
||||
k = action_get("data-chunks")
|
||||
m = action_get("coding-chunks")
|
||||
c = action_get("durability-estimator")
|
||||
try:
|
||||
create_erasure_profile(service='admin',
|
||||
erasure_plugin_name=plugin,
|
||||
profile_name=name,
|
||||
data_chunks=k,
|
||||
coding_chunks=m,
|
||||
durability_estimator=c,
|
||||
failure_domain=failure_domain)
|
||||
except CalledProcessError as e:
|
||||
log(e)
|
||||
action_fail("Create erasure profile failed with "
|
||||
"message: {}".format(e.message))
|
||||
else:
|
||||
# Unknown erasure plugin
|
||||
action_fail("Unknown erasure-plugin type of {}. "
|
||||
"Only jerasure, isa, local or shec is "
|
||||
"allowed".format(plugin))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
make_erasure_profile()
|
1
actions/create-erasure-profile
Symbolic link
1
actions/create-erasure-profile
Symbolic link
@ -0,0 +1 @@
|
||||
./create-erasure-profile.py
|
89
actions/create-erasure-profile.py
Executable file
89
actions/create-erasure-profile.py
Executable file
@ -0,0 +1,89 @@
|
||||
#!/usr/bin/python
|
||||
from subprocess import CalledProcessError
|
||||
import sys
|
||||
|
||||
sys.path.append('hooks')
|
||||
|
||||
from charmhelpers.contrib.storage.linux.ceph import create_erasure_profile
|
||||
from charmhelpers.core.hookenv import action_get, log, action_fail
|
||||
|
||||
|
||||
def make_erasure_profile():
|
||||
name = action_get("name")
|
||||
plugin = action_get("plugin")
|
||||
failure_domain = action_get("failure-domain")
|
||||
|
||||
# jerasure requires k+m
|
||||
# isa requires k+m
|
||||
# local requires k+m+l
|
||||
# shec requires k+m+c
|
||||
|
||||
if plugin == "jerasure":
|
||||
k = action_get("data-chunks")
|
||||
m = action_get("coding-chunks")
|
||||
try:
|
||||
create_erasure_profile(service='admin',
|
||||
erasure_plugin_name=plugin,
|
||||
profile_name=name,
|
||||
data_chunks=k,
|
||||
coding_chunks=m,
|
||||
failure_domain=failure_domain)
|
||||
except CalledProcessError as e:
|
||||
log(e)
|
||||
action_fail("Create erasure profile failed with "
|
||||
"message: {}".format(e.message))
|
||||
elif plugin == "isa":
|
||||
k = action_get("data-chunks")
|
||||
m = action_get("coding-chunks")
|
||||
try:
|
||||
create_erasure_profile(service='admin',
|
||||
erasure_plugin_name=plugin,
|
||||
profile_name=name,
|
||||
data_chunks=k,
|
||||
coding_chunks=m,
|
||||
failure_domain=failure_domain)
|
||||
except CalledProcessError as e:
|
||||
log(e)
|
||||
action_fail("Create erasure profile failed with "
|
||||
"message: {}".format(e.message))
|
||||
elif plugin == "local":
|
||||
k = action_get("data-chunks")
|
||||
m = action_get("coding-chunks")
|
||||
l = action_get("locality-chunks")
|
||||
try:
|
||||
create_erasure_profile(service='admin',
|
||||
erasure_plugin_name=plugin,
|
||||
profile_name=name,
|
||||
data_chunks=k,
|
||||
coding_chunks=m,
|
||||
locality=l,
|
||||
failure_domain=failure_domain)
|
||||
except CalledProcessError as e:
|
||||
log(e)
|
||||
action_fail("Create erasure profile failed with "
|
||||
"message: {}".format(e.message))
|
||||
elif plugin == "shec":
|
||||
k = action_get("data-chunks")
|
||||
m = action_get("coding-chunks")
|
||||
c = action_get("durability-estimator")
|
||||
try:
|
||||
create_erasure_profile(service='admin',
|
||||
erasure_plugin_name=plugin,
|
||||
profile_name=name,
|
||||
data_chunks=k,
|
||||
coding_chunks=m,
|
||||
durability_estimator=c,
|
||||
failure_domain=failure_domain)
|
||||
except CalledProcessError as e:
|
||||
log(e)
|
||||
action_fail("Create erasure profile failed with "
|
||||
"message: {}".format(e.message))
|
||||
else:
|
||||
# Unknown erasure plugin
|
||||
action_fail("Unknown erasure-plugin type of {}. "
|
||||
"Only jerasure, isa, local or shec is "
|
||||
"allowed".format(plugin))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
make_erasure_profile()
|
@ -1,38 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
import sys
|
||||
|
||||
sys.path.append('hooks')
|
||||
from subprocess import CalledProcessError
|
||||
from charmhelpers.core.hookenv import action_get, log, action_fail
|
||||
from charmhelpers.contrib.storage.linux.ceph import ErasurePool, ReplicatedPool
|
||||
|
||||
|
||||
def create_pool():
|
||||
pool_name = action_get("name")
|
||||
pool_type = action_get("pool-type")
|
||||
try:
|
||||
if pool_type == "replicated":
|
||||
replicas = action_get("replicas")
|
||||
replicated_pool = ReplicatedPool(name=pool_name,
|
||||
service='admin',
|
||||
replicas=replicas)
|
||||
replicated_pool.create()
|
||||
|
||||
elif pool_type == "erasure":
|
||||
crush_profile_name = action_get("erasure-profile-name")
|
||||
erasure_pool = ErasurePool(name=pool_name,
|
||||
erasure_code_profile=crush_profile_name,
|
||||
service='admin')
|
||||
erasure_pool.create()
|
||||
else:
|
||||
log("Unknown pool type of {}. Only erasure or replicated is "
|
||||
"allowed".format(pool_type))
|
||||
action_fail("Unknown pool type of {}. Only erasure or replicated "
|
||||
"is allowed".format(pool_type))
|
||||
except CalledProcessError as e:
|
||||
action_fail("Pool creation failed because of a failed process. "
|
||||
"Ret Code: {} Message: {}".format(e.returncode, e.message))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
create_pool()
|
1
actions/create-pool
Symbolic link
1
actions/create-pool
Symbolic link
@ -0,0 +1 @@
|
||||
./create-pool.py
|
38
actions/create-pool.py
Executable file
38
actions/create-pool.py
Executable file
@ -0,0 +1,38 @@
|
||||
#!/usr/bin/python
|
||||
import sys
|
||||
|
||||
sys.path.append('hooks')
|
||||
from subprocess import CalledProcessError
|
||||
from charmhelpers.core.hookenv import action_get, log, action_fail
|
||||
from charmhelpers.contrib.storage.linux.ceph import ErasurePool, ReplicatedPool
|
||||
|
||||
|
||||
def create_pool():
|
||||
pool_name = action_get("name")
|
||||
pool_type = action_get("pool-type")
|
||||
try:
|
||||
if pool_type == "replicated":
|
||||
replicas = action_get("replicas")
|
||||
replicated_pool = ReplicatedPool(name=pool_name,
|
||||
service='admin',
|
||||
replicas=replicas)
|
||||
replicated_pool.create()
|
||||
|
||||
elif pool_type == "erasure":
|
||||
crush_profile_name = action_get("erasure-profile-name")
|
||||
erasure_pool = ErasurePool(name=pool_name,
|
||||
erasure_code_profile=crush_profile_name,
|
||||
service='admin')
|
||||
erasure_pool.create()
|
||||
else:
|
||||
log("Unknown pool type of {}. Only erasure or replicated is "
|
||||
"allowed".format(pool_type))
|
||||
action_fail("Unknown pool type of {}. Only erasure or replicated "
|
||||
"is allowed".format(pool_type))
|
||||
except CalledProcessError as e:
|
||||
action_fail("Pool creation failed because of a failed process. "
|
||||
"Ret Code: {} Message: {}".format(e.returncode, e.message))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
create_pool()
|
@ -1,24 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
from subprocess import CalledProcessError
|
||||
|
||||
__author__ = 'chris'
|
||||
import sys
|
||||
|
||||
sys.path.append('hooks')
|
||||
|
||||
from charmhelpers.contrib.storage.linux.ceph import remove_erasure_profile
|
||||
from charmhelpers.core.hookenv import action_get, log, action_fail
|
||||
|
||||
|
||||
def delete_erasure_profile():
|
||||
name = action_get("name")
|
||||
|
||||
try:
|
||||
remove_erasure_profile(service='admin', profile_name=name)
|
||||
except CalledProcessError as e:
|
||||
action_fail("Remove erasure profile failed with error: {}".format(
|
||||
e.message))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
delete_erasure_profile()
|
1
actions/delete-erasure-profile
Symbolic link
1
actions/delete-erasure-profile
Symbolic link
@ -0,0 +1 @@
|
||||
./delete-erasure-profile.py
|
26
actions/delete-erasure-profile.py
Executable file
26
actions/delete-erasure-profile.py
Executable file
@ -0,0 +1,26 @@
|
||||
#!/usr/bin/python
|
||||
from subprocess import CalledProcessError
|
||||
|
||||
__author__ = 'chris'
|
||||
import sys
|
||||
|
||||
sys.path.append('hooks')
|
||||
|
||||
from charmhelpers.contrib.storage.linux.ceph import remove_erasure_profile
|
||||
from charmhelpers.core.hookenv import action_get, log, action_fail
|
||||
|
||||
|
||||
def delete_erasure_profile():
|
||||
name = action_get("name")
|
||||
|
||||
try:
|
||||
remove_erasure_profile(service='admin', profile_name=name)
|
||||
except CalledProcessError as e:
|
||||
log("Remove erasure profile failed with error {}".format(e.message),
|
||||
level="ERROR")
|
||||
action_fail("Remove erasure profile failed with error: {}".format(
|
||||
e.message))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
delete_erasure_profile()
|
@ -1,28 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
import sys
|
||||
|
||||
sys.path.append('hooks')
|
||||
|
||||
import rados
|
||||
from ceph_ops import connect
|
||||
from charmhelpers.core.hookenv import action_get, log, action_fail
|
||||
|
||||
|
||||
def remove_pool():
|
||||
try:
|
||||
pool_name = action_get("name")
|
||||
cluster = connect()
|
||||
log("Deleting pool: {}".format(pool_name))
|
||||
cluster.delete_pool(str(pool_name)) # Convert from unicode
|
||||
cluster.shutdown()
|
||||
except (rados.IOError,
|
||||
rados.ObjectNotFound,
|
||||
rados.NoData,
|
||||
rados.NoSpace,
|
||||
rados.PermissionError) as e:
|
||||
log(e)
|
||||
action_fail(e)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
remove_pool()
|
1
actions/delete-pool
Symbolic link
1
actions/delete-pool
Symbolic link
@ -0,0 +1 @@
|
||||
./delete-pool.py
|
28
actions/delete-pool.py
Executable file
28
actions/delete-pool.py
Executable file
@ -0,0 +1,28 @@
|
||||
#!/usr/bin/python
|
||||
import sys
|
||||
|
||||
sys.path.append('hooks')
|
||||
|
||||
import rados
|
||||
from ceph_ops import connect
|
||||
from charmhelpers.core.hookenv import action_get, log, action_fail
|
||||
|
||||
|
||||
def remove_pool():
|
||||
try:
|
||||
pool_name = action_get("name")
|
||||
cluster = connect()
|
||||
log("Deleting pool: {}".format(pool_name))
|
||||
cluster.delete_pool(str(pool_name)) # Convert from unicode
|
||||
cluster.shutdown()
|
||||
except (rados.IOError,
|
||||
rados.ObjectNotFound,
|
||||
rados.NoData,
|
||||
rados.NoSpace,
|
||||
rados.PermissionError) as e:
|
||||
log(e)
|
||||
action_fail(e)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
remove_pool()
|
@ -1,18 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
__author__ = 'chris'
|
||||
import sys
|
||||
|
||||
sys.path.append('hooks')
|
||||
|
||||
from charmhelpers.contrib.storage.linux.ceph import get_erasure_profile
|
||||
from charmhelpers.core.hookenv import action_get, action_set
|
||||
|
||||
|
||||
def make_erasure_profile():
|
||||
name = action_get("name")
|
||||
out = get_erasure_profile(service='admin', name=name)
|
||||
action_set({'message': out})
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
make_erasure_profile()
|
1
actions/get-erasure-profile
Symbolic link
1
actions/get-erasure-profile
Symbolic link
@ -0,0 +1 @@
|
||||
./get-erasure-profile.py
|
18
actions/get-erasure-profile.py
Executable file
18
actions/get-erasure-profile.py
Executable file
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/python
|
||||
__author__ = 'chris'
|
||||
import sys
|
||||
|
||||
sys.path.append('hooks')
|
||||
|
||||
from charmhelpers.contrib.storage.linux.ceph import get_erasure_profile
|
||||
from charmhelpers.core.hookenv import action_get, action_set
|
||||
|
||||
|
||||
def make_erasure_profile():
|
||||
name = action_get("name")
|
||||
out = get_erasure_profile(service='admin', name=name)
|
||||
action_set({'message': out})
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
make_erasure_profile()
|
@ -1,22 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
__author__ = 'chris'
|
||||
import sys
|
||||
from subprocess import check_output, CalledProcessError
|
||||
|
||||
sys.path.append('hooks')
|
||||
|
||||
from charmhelpers.core.hookenv import action_get, log, action_set, action_fail
|
||||
|
||||
if __name__ == '__main__':
|
||||
name = action_get("name")
|
||||
try:
|
||||
out = check_output(['ceph',
|
||||
'--id', 'admin',
|
||||
'osd',
|
||||
'erasure-code-profile',
|
||||
'ls']).decode('UTF-8')
|
||||
action_set({'message': out})
|
||||
except CalledProcessError as e:
|
||||
log(e)
|
||||
action_fail("Listing erasure profiles failed with error: {}".format(
|
||||
e.message))
|
1
actions/list-erasure-profiles
Symbolic link
1
actions/list-erasure-profiles
Symbolic link
@ -0,0 +1 @@
|
||||
./list-erasure-profiles.py
|
22
actions/list-erasure-profiles.py
Executable file
22
actions/list-erasure-profiles.py
Executable file
@ -0,0 +1,22 @@
|
||||
#!/usr/bin/python
|
||||
__author__ = 'chris'
|
||||
import sys
|
||||
from subprocess import check_output, CalledProcessError
|
||||
|
||||
sys.path.append('hooks')
|
||||
|
||||
from charmhelpers.core.hookenv import action_get, log, action_set, action_fail
|
||||
|
||||
if __name__ == '__main__':
|
||||
name = action_get("name")
|
||||
try:
|
||||
out = check_output(['ceph',
|
||||
'--id', 'admin',
|
||||
'osd',
|
||||
'erasure-code-profile',
|
||||
'ls']).decode('UTF-8')
|
||||
action_set({'message': out})
|
||||
except CalledProcessError as e:
|
||||
log(e)
|
||||
action_fail("Listing erasure profiles failed with error: {}".format(
|
||||
e.message))
|
@ -1,17 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
__author__ = 'chris'
|
||||
import sys
|
||||
from subprocess import check_output, CalledProcessError
|
||||
|
||||
sys.path.append('hooks')
|
||||
|
||||
from charmhelpers.core.hookenv import log, action_set, action_fail
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
out = check_output(['ceph', '--id', 'admin',
|
||||
'osd', 'lspools']).decode('UTF-8')
|
||||
action_set({'message': out})
|
||||
except CalledProcessError as e:
|
||||
log(e)
|
||||
action_fail("List pools failed with error: {}".format(e.message))
|
1
actions/list-pools
Symbolic link
1
actions/list-pools
Symbolic link
@ -0,0 +1 @@
|
||||
./list-pools.py
|
17
actions/list-pools.py
Executable file
17
actions/list-pools.py
Executable file
@ -0,0 +1,17 @@
|
||||
#!/usr/bin/python
|
||||
__author__ = 'chris'
|
||||
import sys
|
||||
from subprocess import check_output, CalledProcessError
|
||||
|
||||
sys.path.append('hooks')
|
||||
|
||||
from charmhelpers.core.hookenv import log, action_set, action_fail
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
out = check_output(['ceph', '--id', 'admin',
|
||||
'osd', 'lspools']).decode('UTF-8')
|
||||
action_set({'message': out})
|
||||
except CalledProcessError as e:
|
||||
log(e)
|
||||
action_fail("List pools failed with error: {}".format(e.message))
|
@ -1,19 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
__author__ = 'chris'
|
||||
import sys
|
||||
from subprocess import check_output, CalledProcessError
|
||||
|
||||
sys.path.append('hooks')
|
||||
|
||||
from charmhelpers.core.hookenv import log, action_set, action_get, action_fail
|
||||
|
||||
if __name__ == '__main__':
|
||||
name = action_get('pool-name')
|
||||
key = action_get('key')
|
||||
try:
|
||||
out = check_output(['ceph', '--id', 'admin',
|
||||
'osd', 'pool', 'get', name, key]).decode('UTF-8')
|
||||
action_set({'message': out})
|
||||
except CalledProcessError as e:
|
||||
log(e)
|
||||
action_fail("Pool get failed with message: {}".format(e.message))
|
1
actions/pool-get
Symbolic link
1
actions/pool-get
Symbolic link
@ -0,0 +1 @@
|
||||
./pool-get.py
|
19
actions/pool-get.py
Executable file
19
actions/pool-get.py
Executable file
@ -0,0 +1,19 @@
|
||||
#!/usr/bin/python
|
||||
__author__ = 'chris'
|
||||
import sys
|
||||
from subprocess import check_output, CalledProcessError
|
||||
|
||||
sys.path.append('hooks')
|
||||
|
||||
from charmhelpers.core.hookenv import log, action_set, action_get, action_fail
|
||||
|
||||
if __name__ == '__main__':
|
||||
name = action_get('pool-name')
|
||||
key = action_get('key')
|
||||
try:
|
||||
out = check_output(['ceph', '--id', 'admin',
|
||||
'osd', 'pool', 'get', name, key]).decode('UTF-8')
|
||||
action_set({'message': out})
|
||||
except CalledProcessError as e:
|
||||
log(e)
|
||||
action_fail("Pool get failed with message: {}".format(e.message))
|
@ -1,23 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
from subprocess import CalledProcessError
|
||||
import sys
|
||||
|
||||
sys.path.append('hooks')
|
||||
|
||||
from charmhelpers.core.hookenv import action_get, log, action_fail
|
||||
from ceph_broker import handle_set_pool_value
|
||||
|
||||
if __name__ == '__main__':
|
||||
name = action_get("pool-name")
|
||||
key = action_get("key")
|
||||
value = action_get("value")
|
||||
request = {'name': name,
|
||||
'key': key,
|
||||
'value': value}
|
||||
|
||||
try:
|
||||
handle_set_pool_value(service='admin', request=request)
|
||||
except CalledProcessError as e:
|
||||
log(e.message)
|
||||
action_fail("Setting pool key: {} and value: {} failed with "
|
||||
"message: {}".format(key, value, e.message))
|
1
actions/pool-set
Symbolic link
1
actions/pool-set
Symbolic link
@ -0,0 +1 @@
|
||||
./pool-set.py
|
23
actions/pool-set.py
Executable file
23
actions/pool-set.py
Executable file
@ -0,0 +1,23 @@
|
||||
#!/usr/bin/python
|
||||
from subprocess import CalledProcessError
|
||||
import sys
|
||||
|
||||
sys.path.append('hooks')
|
||||
|
||||
from charmhelpers.core.hookenv import action_get, log, action_fail
|
||||
from ceph_broker import handle_set_pool_value
|
||||
|
||||
if __name__ == '__main__':
|
||||
name = action_get("pool-name")
|
||||
key = action_get("key")
|
||||
value = action_get("value")
|
||||
request = {'name': name,
|
||||
'key': key,
|
||||
'value': value}
|
||||
|
||||
try:
|
||||
handle_set_pool_value(service='admin', request=request)
|
||||
except CalledProcessError as e:
|
||||
log(e.message)
|
||||
action_fail("Setting pool key: {} and value: {} failed with "
|
||||
"message: {}".format(key, value, e.message))
|
@ -1,15 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
import sys
|
||||
|
||||
sys.path.append('hooks')
|
||||
from subprocess import check_output, CalledProcessError
|
||||
from charmhelpers.core.hookenv import log, action_set, action_fail
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
out = check_output(['ceph', '--id', 'admin',
|
||||
'df']).decode('UTF-8')
|
||||
action_set({'message': out})
|
||||
except CalledProcessError as e:
|
||||
log(e)
|
||||
action_fail("ceph df failed with message: {}".format(e.message))
|
1
actions/pool-statistics
Symbolic link
1
actions/pool-statistics
Symbolic link
@ -0,0 +1 @@
|
||||
./pool-statistics.py
|
15
actions/pool-statistics.py
Executable file
15
actions/pool-statistics.py
Executable file
@ -0,0 +1,15 @@
|
||||
#!/usr/bin/python
|
||||
import sys
|
||||
|
||||
sys.path.append('hooks')
|
||||
from subprocess import check_output, CalledProcessError
|
||||
from charmhelpers.core.hookenv import log, action_set, action_fail
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
out = check_output(['ceph', '--id', 'admin',
|
||||
'df']).decode('UTF-8')
|
||||
action_set({'message': out})
|
||||
except CalledProcessError as e:
|
||||
log(e)
|
||||
action_fail("ceph df failed with message: {}".format(e.message))
|
@ -1 +1 @@
|
||||
remove-cache-tier.py
|
||||
./remove-cache-tier.py
|
@ -1,19 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
import sys
|
||||
|
||||
sys.path.append('hooks')
|
||||
from subprocess import CalledProcessError
|
||||
from charmhelpers.core.hookenv import action_get, log, action_fail
|
||||
from charmhelpers.contrib.storage.linux.ceph import remove_pool_snapshot
|
||||
|
||||
if __name__ == '__main__':
|
||||
name = action_get("pool-name")
|
||||
snapname = action_get("snapshot-name")
|
||||
try:
|
||||
remove_pool_snapshot(service='admin',
|
||||
pool_name=name,
|
||||
snapshot_name=snapname)
|
||||
except CalledProcessError as e:
|
||||
log(e)
|
||||
action_fail("Remove pool snapshot failed with message: {}".format(
|
||||
e.message))
|
1
actions/remove-pool-snapshot
Symbolic link
1
actions/remove-pool-snapshot
Symbolic link
@ -0,0 +1 @@
|
||||
./remove-pool-snapshot.py
|
19
actions/remove-pool-snapshot.py
Executable file
19
actions/remove-pool-snapshot.py
Executable file
@ -0,0 +1,19 @@
|
||||
#!/usr/bin/python
|
||||
import sys
|
||||
|
||||
sys.path.append('hooks')
|
||||
from subprocess import CalledProcessError
|
||||
from charmhelpers.core.hookenv import action_get, log, action_fail
|
||||
from charmhelpers.contrib.storage.linux.ceph import remove_pool_snapshot
|
||||
|
||||
if __name__ == '__main__':
|
||||
name = action_get("pool-name")
|
||||
snapname = action_get("snapshot-name")
|
||||
try:
|
||||
remove_pool_snapshot(service='admin',
|
||||
pool_name=name,
|
||||
snapshot_name=snapname)
|
||||
except CalledProcessError as e:
|
||||
log(e)
|
||||
action_fail("Remove pool snapshot failed with message: {}".format(
|
||||
e.message))
|
@ -1,16 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
import sys
|
||||
|
||||
sys.path.append('hooks')
|
||||
from subprocess import CalledProcessError
|
||||
from charmhelpers.core.hookenv import action_get, log, action_fail
|
||||
from charmhelpers.contrib.storage.linux.ceph import rename_pool
|
||||
|
||||
if __name__ == '__main__':
|
||||
name = action_get("pool-name")
|
||||
new_name = action_get("new-name")
|
||||
try:
|
||||
rename_pool(service='admin', old_name=name, new_name=new_name)
|
||||
except CalledProcessError as e:
|
||||
log(e)
|
||||
action_fail("Renaming pool failed with message: {}".format(e.message))
|
1
actions/rename-pool
Symbolic link
1
actions/rename-pool
Symbolic link
@ -0,0 +1 @@
|
||||
./rename-pool.py
|
16
actions/rename-pool.py
Executable file
16
actions/rename-pool.py
Executable file
@ -0,0 +1,16 @@
|
||||
#!/usr/bin/python
|
||||
import sys
|
||||
|
||||
sys.path.append('hooks')
|
||||
from subprocess import CalledProcessError
|
||||
from charmhelpers.core.hookenv import action_get, log, action_fail
|
||||
from charmhelpers.contrib.storage.linux.ceph import rename_pool
|
||||
|
||||
if __name__ == '__main__':
|
||||
name = action_get("pool-name")
|
||||
new_name = action_get("new-name")
|
||||
try:
|
||||
rename_pool(service='admin', old_name=name, new_name=new_name)
|
||||
except CalledProcessError as e:
|
||||
log(e)
|
||||
action_fail("Renaming pool failed with message: {}".format(e.message))
|
@ -1,16 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
import sys
|
||||
|
||||
sys.path.append('hooks')
|
||||
from subprocess import CalledProcessError
|
||||
from charmhelpers.core.hookenv import action_get, log, action_fail
|
||||
from charmhelpers.contrib.storage.linux.ceph import set_pool_quota
|
||||
|
||||
if __name__ == '__main__':
|
||||
max_bytes = action_get("max")
|
||||
name = action_get("pool-name")
|
||||
try:
|
||||
set_pool_quota(service='admin', pool_name=name, max_bytes=max_bytes)
|
||||
except CalledProcessError as e:
|
||||
log(e)
|
||||
action_fail("Set pool quota failed with message: {}".format(e.message))
|
1
actions/set-pool-max-bytes
Symbolic link
1
actions/set-pool-max-bytes
Symbolic link
@ -0,0 +1 @@
|
||||
./set-pool-max-bytes.py
|
16
actions/set-pool-max-bytes.py
Executable file
16
actions/set-pool-max-bytes.py
Executable file
@ -0,0 +1,16 @@
|
||||
#!/usr/bin/python
|
||||
import sys
|
||||
|
||||
sys.path.append('hooks')
|
||||
from subprocess import CalledProcessError
|
||||
from charmhelpers.core.hookenv import action_get, log, action_fail
|
||||
from charmhelpers.contrib.storage.linux.ceph import set_pool_quota
|
||||
|
||||
if __name__ == '__main__':
|
||||
max_bytes = action_get("max")
|
||||
name = action_get("pool-name")
|
||||
try:
|
||||
set_pool_quota(service='admin', pool_name=name, max_bytes=max_bytes)
|
||||
except CalledProcessError as e:
|
||||
log(e)
|
||||
action_fail("Set pool quota failed with message: {}".format(e.message))
|
@ -1,18 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
import sys
|
||||
|
||||
sys.path.append('hooks')
|
||||
from subprocess import CalledProcessError
|
||||
from charmhelpers.core.hookenv import action_get, log, action_fail
|
||||
from charmhelpers.contrib.storage.linux.ceph import snapshot_pool
|
||||
|
||||
if __name__ == '__main__':
|
||||
name = action_get("pool-name")
|
||||
snapname = action_get("snapshot-name")
|
||||
try:
|
||||
snapshot_pool(service='admin',
|
||||
pool_name=name,
|
||||
snapshot_name=snapname)
|
||||
except CalledProcessError as e:
|
||||
log(e)
|
||||
action_fail("Snapshot pool failed with message: {}".format(e.message))
|
1
actions/snapshot-pool
Symbolic link
1
actions/snapshot-pool
Symbolic link
@ -0,0 +1 @@
|
||||
./snapshot-pool.py
|
18
actions/snapshot-pool.py
Executable file
18
actions/snapshot-pool.py
Executable file
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/python
|
||||
import sys
|
||||
|
||||
sys.path.append('hooks')
|
||||
from subprocess import CalledProcessError
|
||||
from charmhelpers.core.hookenv import action_get, log, action_fail
|
||||
from charmhelpers.contrib.storage.linux.ceph import snapshot_pool
|
||||
|
||||
if __name__ == '__main__':
|
||||
name = action_get("pool-name")
|
||||
snapname = action_get("snapshot-name")
|
||||
try:
|
||||
snapshot_pool(service='admin',
|
||||
pool_name=name,
|
||||
snapshot_name=snapname)
|
||||
except CalledProcessError as e:
|
||||
log(e)
|
||||
action_fail("Snapshot pool failed with message: {}".format(e.message))
|
Loading…
Reference in New Issue
Block a user