Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / ceph-volume / ceph_volume / devices / lvm / common.py
1 from ceph_volume.util import arg_validators
2 import argparse
3
4
5 def common_parser(prog, description):
6     """
7     Both prepare and create share the same parser, those are defined here to
8     avoid duplication
9     """
10     parser = argparse.ArgumentParser(
11         prog=prog,
12         formatter_class=argparse.RawDescriptionHelpFormatter,
13         description=description,
14     )
15     required_args = parser.add_argument_group('required arguments')
16     parser.add_argument(
17         '--journal',
18         help='(filestore) A logical volume (vg_name/lv_name), or path to a device',
19     )
20     required_args.add_argument(
21         '--data',
22         required=True,
23         type=arg_validators.LVPath(),
24         help='OSD data path. A physical device or logical volume',
25     )
26     parser.add_argument(
27         '--journal-size',
28         default=5,
29         metavar='GB',
30         type=int,
31         help='(filestore) Size (in GB) for the journal',
32     )
33     parser.add_argument(
34         '--bluestore',
35         action='store_true',
36         help='Use the bluestore objectstore',
37     )
38     parser.add_argument(
39         '--filestore',
40         action='store_true',
41         help='Use the filestore objectstore',
42     )
43     parser.add_argument(
44         '--osd-id',
45         help='Reuse an existing OSD id',
46     )
47     parser.add_argument(
48         '--osd-fsid',
49         help='Reuse an existing OSD fsid',
50     )
51     parser.add_argument(
52         '--block.db',
53         dest='block_db',
54         help='(bluestore) Path to bluestore block.db logical volume or device',
55     )
56     parser.add_argument(
57         '--block.wal',
58         dest='block_wal',
59         help='(bluestore) Path to bluestore block.wal logical volume or device',
60     )
61     # Do not parse args, so that consumers can do something before the args get
62     # parsed triggering argparse behavior
63     return parser
64
65
66 create_parser = common_parser  # noqa
67 prepare_parser = common_parser  # noqa