From 472aa0b1997a0b1301b699b7ce30dce728aaea0c Mon Sep 17 00:00:00 2001 From: Alfredo Deza Date: Wed, 18 Oct 2017 15:06:01 -0400 Subject: [PATCH] ceph-volume lvm.activate auto detect objectstore type Signed-off-by: Alfredo Deza --- .../ceph_volume/devices/lvm/activate.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/ceph-volume/ceph_volume/devices/lvm/activate.py b/src/ceph-volume/ceph_volume/devices/lvm/activate.py index 3ed624e7f14..8f8fb92261e 100644 --- a/src/ceph-volume/ceph_volume/devices/lvm/activate.py +++ b/src/ceph-volume/ceph_volume/devices/lvm/activate.py @@ -1,5 +1,6 @@ from __future__ import print_function import argparse +import logging import os from textwrap import dedent from ceph_volume import process, conf, decorators @@ -9,6 +10,9 @@ from ceph_volume.systemd import systemctl from ceph_volume.api import lvm as api +logger = logging.getLogger(__name__) + + def activate_filestore(lvs): # find the osd osd_lv = lvs.get(lv_tags={'ceph.type': 'data'}) @@ -128,6 +132,16 @@ class Activate(object): lvs.filter(lv_tags={'ceph.osd_fsid': args.osd_fsid}) if not lvs: raise RuntimeError('could not find osd.%s with fsid %s' % (args.osd_id, args.osd_fsid)) + if args.auto_detect_objecstore: + logger.info('auto detecting objectstore') + # may get multiple lvs, so can't do lvs.get() calls here + for lv in lvs: + has_journal = lv.tags.get('ceph.journal_uuid') + if has_journal: + logger.info('found a journal associated with the OSD, assuming filestore') + return activate_filestore(lvs) + logger.info('unable to find a journal associated with the OSD, assuming bluestore') + return activate_bluestore(lvs) if args.bluestore: activate_bluestore(lvs) elif args.filestore: @@ -162,6 +176,11 @@ class Activate(object): nargs='?', help='The FSID of the OSD, similar to a SHA1' ) + parser.add_argument( + '--auto-detect-objectstore', + action='store_true', + help='Autodetect the objectstore by inspecting the OSD', + ) parser.add_argument( '--bluestore', action='store_true', -- 2.39.5