From 19e2786ddd25db998f31e367f8ea86bf5ecb2c71 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=A9bastien=20Han?= Date: Fri, 24 Jan 2020 16:23:10 +0100 Subject: [PATCH] ceph-volume: remove "create" call from raw mode MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This mode is intented to work when the cluster is running on Kubernetes and OSDs are running on PVC. So we always have a "prepare" pod and an "activate" pod. Signed-off-by: Sébastien Han (cherry picked from commit c7a2ecc59394a9eb323a19ff233a2e3dfe04a018) --- .../ceph_volume/devices/raw/create.py | 81 ------------------- .../ceph_volume/devices/raw/main.py | 2 - 2 files changed, 83 deletions(-) delete mode 100644 src/ceph-volume/ceph_volume/devices/raw/create.py diff --git a/src/ceph-volume/ceph_volume/devices/raw/create.py b/src/ceph-volume/ceph_volume/devices/raw/create.py deleted file mode 100644 index fb633c7ffca15..0000000000000 --- a/src/ceph-volume/ceph_volume/devices/raw/create.py +++ /dev/null @@ -1,81 +0,0 @@ -from __future__ import print_function -from textwrap import dedent -import logging -from ceph_volume.util import system -from ceph_volume import decorators, terminal -from .prepare import Prepare -from .activate import Activate -from .common import create_parser -from ceph_volume.devices.lvm.common import rollback_osd - -logger = logging.getLogger(__name__) - - -class Create(object): - - help = 'Create a new (BlueStore) OSD on a raw device' - - def __init__(self, argv): - self.argv = argv - self.args = None - - @decorators.needs_root - def create(self, args): - if not args.osd_fsid: - args.osd_fsid = system.generate_uuid() - prepare_step = Prepare([]) - prepare_step.safe_prepare(args) - osd_id = prepare_step.osd_id - try: - # we try this for activate only when 'creating' an OSD, - # because a rollback should not happen when doing normal - # activation. For example when starting an OSD, systemd - # will call activate, which would never need to be rolled - # back. - a = Activate([]) - a.args = self.args - a.activate([args.data], - tmpfs=not args.no_tmpfs, - systemd=not args.no_systemd) - except Exception: - logger.exception('raw activate was unable to complete, while creating the OSD') - logger.info('will rollback OSD ID creation') - rollback_osd(args, osd_id) - raise - terminal.success("ceph-volume raw create successful for: %s" % args.data) - - def main(self): - sub_command_help = dedent(""" - Create an OSD by assigning an ID and FSID, registering them with the - cluster with an ID and FSID, formatting and mounting the volume, and - starting the OSD daemon. This is a convinience command that combines - the prepare and activate steps. - - Encryption is not supported. - - Separate DB and WAL devices are not supported. - - ceph-volume raw create --data /dev/sdb - - """) - parser = create_parser( - prog='ceph-volume raw create', - description=sub_command_help, - ) - parser.add_argument( - '--no-systemd', - dest='no_systemd', - action='store_true', - help='Skip creating and enabling systemd units and starting OSD services', - ) - if len(self.argv) == 0: - print(sub_command_help) - return - self.args = parser.parse_args(self.argv) - if not self.args.bluestore: - terminal.error('must specify --bluestore (currently the only supported backend)') - raise SystemExit(1) - if not self.args.no_systemd: - terminal.error('systemd support not yet implemented') - raise SystemExit(1) - self.create(self.args) diff --git a/src/ceph-volume/ceph_volume/devices/raw/main.py b/src/ceph-volume/ceph_volume/devices/raw/main.py index 61286acad1e5c..efa2510909614 100644 --- a/src/ceph-volume/ceph_volume/devices/raw/main.py +++ b/src/ceph-volume/ceph_volume/devices/raw/main.py @@ -2,7 +2,6 @@ import argparse from textwrap import dedent from ceph_volume import terminal from . import list -from . import create from . import prepare from . import activate @@ -19,7 +18,6 @@ class Raw(object): mapper = { 'list': list.List, - 'create': create.Create, 'prepare': prepare.Prepare, 'activate': activate.Activate, } -- 2.39.5