From 451feec4b269e2a5816687136adc74082ec8f2f3 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 5 Aug 2021 12:02:22 -0400 Subject: [PATCH] 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 --- .../ceph_volume/devices/lvm/activate.py | 18 ++++++++++-------- .../tests/devices/lvm/test_activate.py | 2 +- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/ceph-volume/ceph_volume/devices/lvm/activate.py b/src/ceph-volume/ceph_volume/devices/lvm/activate.py index 1069839c04e..e4b23b62cad 100644 --- a/src/ceph-volume/ceph_volume/devices/lvm/activate.py +++ b/src/ceph-volume/ceph_volume/devices/lvm/activate.py @@ -291,9 +291,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): @@ -338,12 +344,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', @@ -361,10 +367,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 9b8fcbebeae..feafea71be0 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 @@ -315,7 +315,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'] -- 2.39.5