From 63cd2582ca03da565953e4592fce8f6cab28723f Mon Sep 17 00:00:00 2001 From: Alfredo Deza Date: Mon, 24 Jul 2017 14:04:33 -0400 Subject: [PATCH] ceph-volume: devices.lvm create a common module for sharing parsers Signed-off-by: Alfredo Deza --- .../ceph_volume/devices/lvm/common.py | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/ceph-volume/ceph_volume/devices/lvm/common.py diff --git a/src/ceph-volume/ceph_volume/devices/lvm/common.py b/src/ceph-volume/ceph_volume/devices/lvm/common.py new file mode 100644 index 00000000000..599bbe6e0e2 --- /dev/null +++ b/src/ceph-volume/ceph_volume/devices/lvm/common.py @@ -0,0 +1,55 @@ +import argparse + + +def common_parser(prog, description): + """ + Both prepare and create share the same parser, those are defined here to + avoid duplication + """ + parser = argparse.ArgumentParser( + prog=prog, + formatter_class=argparse.RawDescriptionHelpFormatter, + description=description, + ) + required_args = parser.add_argument_group('required arguments') + parser.add_argument( + '--journal', + help='A logical group name, path to a logical volume, or path to a device', + ) + required_args.add_argument( + '--data', + required=True, + help='A logical group name or a path to a logical volume', + ) + parser.add_argument( + '--journal-size', + default=5, + metavar='GB', + type=int, + help='Size (in GB) A logical group name or a path to a logical volume', + ) + parser.add_argument( + '--bluestore', + action='store_true', default=False, + help='Use the bluestore objectstore (not currently supported)', + ) + parser.add_argument( + '--filestore', + action='store_true', default=True, + help='Use the filestore objectstore (currently the only supported object store)', + ) + parser.add_argument( + '--osd-id', + help='Reuse an existing OSD id', + ) + parser.add_argument( + '--osd-fsid', + help='Reuse an existing OSD fsid', + ) + # Do not parse args, so that consumers can do something before the args get + # parsed triggering argparse behavior + return parser + + +create_parser = common_parser # noqa +prepare_parser = common_parser # noqa