From: Alfredo Deza Date: Wed, 18 Oct 2017 19:06:01 +0000 (-0400) Subject: ceph-volume lvm.activate auto detect objectstore type X-Git-Tag: v13.0.1~463^2~28 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=472aa0b1997a0b1301b699b7ce30dce728aaea0c;p=ceph.git ceph-volume lvm.activate auto detect objectstore type Signed-off-by: Alfredo Deza --- diff --git a/src/ceph-volume/ceph_volume/devices/lvm/activate.py b/src/ceph-volume/ceph_volume/devices/lvm/activate.py index 3ed624e7f143..8f8fb92261e6 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',