After bootstraping the cluster you can go inside the seed box in which you'll be
able to run Cephadm commands::
- ./box.py -v cluster sh
+ ./box.py -v cluster bash
[root@8d52a7860245] cephadm --help
+ [root@8d52a7860245] cephadm shell
...
ENV CEPHADM_PATH=/usr/local/sbin/cephadm
RUN ln -s /ceph/src/cephadm/cephadm.py $CEPHADM_PATH # NOTE: assume path of ceph volume
+
# Don't include container-selinux and remove
# directories used by yum that are just taking
# up space.
def cleanup_box() -> None:
- osd.cleanup()
+ osd.cleanup_osds()
remove_ceph_image_tar()
class Cluster(Target):
_help = 'Manage docker cephadm boxes'
- actions = ['bootstrap', 'start', 'down', 'list', 'sh', 'setup', 'cleanup']
+ actions = ['bootstrap', 'start', 'down', 'list', 'bash', 'setup', 'cleanup']
def set_args(self):
self.parser.add_argument(
print(f'{name} \t{ip} \t{hostname}')
@ensure_outside_container
- def sh(self):
+ def bash(self):
# we need verbose to see the prompt after running shell command
Config.set('verbose', True)
print('Seed bash')
- run_shell_command(f'{engine_compose()} -f {Config.get("docker_yaml")} exec {get_seed_name()} bash')
+ engine = get_container_engine()
+ engine.run(f'exec -it {engine.seed_name} bash')
targets = {
import json
import os
import time
+import re
from typing import Dict
from util import (
if os.path.exists(loop_image):
os.remove(loop_image)
-def create_loopback_devices(osds: int) -> None:
-
+def create_loopback_devices(osds: int) -> Dict[int, Dict[str, str]]:
assert osds
- cleanup()
+ cleanup_osds()
osd_devs = dict()
for i in range(osds):
return 'Created osd(s)' in out
-def cleanup() -> None:
+def cleanup_osds() -> None:
loop_img_dir = Config.get('loop_img_dir')
osd_devs = load_osd_devices()
for osd in osd_devs.values():
- deploy: Deploy an osd given a block device
- create_loop: Create needed loopback devices and block devices in logical volumes
for a number of osds.
+ - destroy: Remove all osds and the underlying loopback devices.
"""
- actions = ['deploy', 'create_loop']
+ actions = ['deploy', 'create_loop', 'destroy']
def set_args(self):
self.parser.add_argument('action', choices=Osd.actions)
osds = Config.get('osds')
create_loopback_devices(int(osds))
print('Successfully created loopback devices')
+
+ @ensure_outside_container
+ def destroy(self):
+ cleanup_osds()