From bd3498f3eabf07637cb936e6c036d1d8d75415b0 Mon Sep 17 00:00:00 2001 From: Alfredo Deza Date: Wed, 8 Nov 2017 14:28:12 -0500 Subject: [PATCH] ceph-volume simple.activate allow to pass a file to activate Signed-off-by: Alfredo Deza --- src/ceph-volume/ceph_volume/devices/simple/activate.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ceph-volume/ceph_volume/devices/simple/activate.py b/src/ceph-volume/ceph_volume/devices/simple/activate.py index 35cfbf14485..1a15718e2ee 100644 --- a/src/ceph-volume/ceph_volume/devices/simple/activate.py +++ b/src/ceph-volume/ceph_volume/devices/simple/activate.py @@ -104,7 +104,6 @@ class Activate(object): formatter_class=argparse.RawDescriptionHelpFormatter, description=sub_command_help, ) - parser.add_argument( 'osd_id', metavar='ID', @@ -117,6 +116,10 @@ class Activate(object): nargs='?', help='The FSID of the OSD, similar to a SHA1' ) + parser.add_argument( + '--file', + help='The path to a JSON file, from a scanned OSD' + ) if len(self.argv) == 0: print(sub_command_help) return @@ -130,7 +133,10 @@ class Activate(object): # at a non-default location which would not work at boot time if the # custom location is not exposed through an ENV var json_dir = os.environ.get('CEPH_VOLUME_SIMPLE_JSON_DIR', '/etc/ceph/osd/') - json_config = os.path.join(json_dir, '%s-%s.json' % (args.osd_id, args.osd_fsid)) + if args.file: + json_config = args.file + else: + json_config = os.path.join(json_dir, '%s-%s.json' % (args.osd_id, args.osd_fsid)) if not os.path.exists(json_config): raise RuntimeError('Expected JSON config path not found: %s' % json_config) args.json_config = json_config -- 2.39.5