1 from __future__ import print_function
2 from textwrap import dedent
3 from ceph_volume.util import system
4 from ceph_volume import decorators
5 from .common import create_parser
6 from .prepare import Prepare
7 from .activate import Activate
12 help = 'Create a new OSD from an LVM device'
14 def __init__(self, argv):
17 @decorators.needs_root
18 def create(self, args):
20 args.osd_fsid = system.generate_uuid()
21 Prepare([]).prepare(args)
22 Activate([]).activate(args)
25 sub_command_help = dedent("""
26 Create an OSD by assigning an ID and FSID, registering them with the
27 cluster with an ID and FSID, formatting and mounting the volume, adding
28 all the metadata to the logical volumes using LVM tags, and starting
31 Example calls for supported scenarios:
36 Existing logical volume (lv) or device:
38 ceph-volume lvm create --filestore --data {vg name/lv name} --journal /path/to/device
42 ceph-volume lvm create --filestore --data {vg name/lv name} --journal {vg name/lv name}
45 parser = create_parser(
46 prog='ceph-volume lvm create',
47 description=sub_command_help,
49 if len(self.argv) == 0:
50 print(sub_command_help)
52 args = parser.parse_args(self.argv)
53 # Default to bluestore here since defaulting it in add_argument may
54 # cause both to be True
55 if args.bluestore is None and args.filestore is None: