mirror of
https://github.com/ceph/ceph
synced 2025-02-21 01:47:25 +00:00
Add rbd modprobe method.
This commit is contained in:
parent
bd46d753e3
commit
dfc3a85154
@ -72,6 +72,42 @@ def create_image(ctx, config):
|
||||
],
|
||||
)
|
||||
|
||||
@contextlib.contextmanager
|
||||
def modprobe(ctx, config):
|
||||
"""
|
||||
Load the rbd kernel module..
|
||||
|
||||
For example::
|
||||
|
||||
tasks:
|
||||
- ceph:
|
||||
- rbd.create_image: [client.0]
|
||||
- rbd.modprobe: [client.0]
|
||||
"""
|
||||
for role in config:
|
||||
(remote,) = ctx.cluster.only(role).remotes.keys()
|
||||
remote.run(
|
||||
args=[
|
||||
'sudo',
|
||||
'modprobe',
|
||||
'rbd',
|
||||
],
|
||||
)
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
log.info('Unloading rbd kernel module...')
|
||||
for role in config:
|
||||
(remote,) = ctx.cluster.only(role).remotes.keys()
|
||||
remote.run(
|
||||
args=[
|
||||
'sudo',
|
||||
'modprobe',
|
||||
'-r',
|
||||
'rbd',
|
||||
],
|
||||
)
|
||||
|
||||
@contextlib.contextmanager
|
||||
def task(ctx, config):
|
||||
create_image(ctx, config)
|
||||
|
Loading…
Reference in New Issue
Block a user