]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume lvm.activate auto detect objectstore type
authorAlfredo Deza <adeza@redhat.com>
Wed, 18 Oct 2017 19:06:01 +0000 (15:06 -0400)
committerAlfredo Deza <adeza@redhat.com>
Fri, 27 Oct 2017 14:44:17 +0000 (10:44 -0400)
Signed-off-by: Alfredo Deza <adeza@redhat.com>
(cherry picked from commit 472aa0b1997a0b1301b699b7ce30dce728aaea0c)

src/ceph-volume/ceph_volume/devices/lvm/activate.py

index 3ed624e7f14345d807226d8dd447e0e6d1fb1a48..8f8fb92261e65ffb6fca49519e5a3cfe296e6d23 100644 (file)
@@ -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',