From: Sage Weil Date: Thu, 5 Aug 2021 16:02:22 +0000 (-0400) Subject: ceph-volume: lvm activate: infer bluestore or filestore X-Git-Tag: v16.2.11~576^2~15 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=236e5a7ac90d540eecaf0b034a6e8509d58096a4;p=ceph.git ceph-volume: lvm activate: infer bluestore or filestore No need to require --filestore and/or --bluestore args since we can tell from the LV tags which one it is. We can't drop the arguments without breaking existing users, though, so redefine them to mean *force* bluesetore or filestore activation (even though this will error out if the tags don't match). Signed-off-by: Sage Weil (cherry picked from commit 451feec4b269e2a5816687136adc74082ec8f2f3) --- diff --git a/src/ceph-volume/ceph_volume/devices/lvm/activate.py b/src/ceph-volume/ceph_volume/devices/lvm/activate.py index cdd60ed62000..82988853a144 100644 --- a/src/ceph-volume/ceph_volume/devices/lvm/activate.py +++ b/src/ceph-volume/ceph_volume/devices/lvm/activate.py @@ -297,9 +297,15 @@ class Activate(object): 'assuming bluestore') return activate_bluestore(lvs, args.no_systemd) - if args.bluestore: + + # explicit filestore/bluestore flags take precedence + if getattr(args, 'bluestore', False): + activate_bluestore(lvs, args.no_systemd) + elif getattr(args, 'filestore', False): + activate_filestore(lvs, args.no_systemd) + elif any('ceph.block_device' in lv.tags for lv in lvs): activate_bluestore(lvs, args.no_systemd) - elif args.filestore: + elif any('ceph.data_device' in lv.tags for lv in lvs): activate_filestore(lvs, args.no_systemd) def main(self): @@ -344,12 +350,12 @@ class Activate(object): parser.add_argument( '--bluestore', action='store_true', - help='bluestore objectstore (default)', + help='force bluestore objectstore activation', ) parser.add_argument( '--filestore', action='store_true', - help='filestore objectstore', + help='force filestore objectstore activation', ) parser.add_argument( '--all', @@ -367,10 +373,6 @@ class Activate(object): print(sub_command_help) return args = parser.parse_args(self.argv) - # Default to bluestore here since defaulting it in add_argument may - # cause both to be True - if not args.bluestore and not args.filestore: - args.bluestore = True if args.activate_all: self.activate_all(args) else: diff --git a/src/ceph-volume/ceph_volume/tests/devices/lvm/test_activate.py b/src/ceph-volume/ceph_volume/tests/devices/lvm/test_activate.py index 2f1bb9396c21..2237f259eb20 100644 --- a/src/ceph-volume/ceph_volume/tests/devices/lvm/test_activate.py +++ b/src/ceph-volume/ceph_volume/tests/devices/lvm/test_activate.py @@ -319,7 +319,7 @@ class TestActivateFlags(object): activation.main() parsed_args = capture.calls[0]['args'][0] assert parsed_args.filestore is False - assert parsed_args.bluestore is True + assert parsed_args.bluestore is False def test_uses_filestore(self, capture): args = ['--filestore', '0', 'asdf-ljh-asdf']