]> git.proxmox.com Git - ceph.git/blame - ceph/src/ceph-volume/ceph_volume/devices/lvm/create.py
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / ceph-volume / ceph_volume / devices / lvm / create.py
CommitLineData
d2e6a577
FG
1from __future__ import print_function
2from textwrap import dedent
3from ceph_volume.util import system
4from ceph_volume import decorators
5from .common import create_parser
6from .prepare import Prepare
7from .activate import Activate
8
9
10class Create(object):
11
12 help = 'Create a new OSD from an LVM device'
13
14 def __init__(self, argv):
15 self.argv = argv
16
17 @decorators.needs_root
18 def create(self, args):
19 if not args.osd_fsid:
20 args.osd_fsid = system.generate_uuid()
21 Prepare([]).prepare(args)
22 Activate([]).activate(args)
23
24 def main(self):
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
29 the OSD daemon.
30
d2e6a577
FG
31 Example calls for supported scenarios:
32
b5b8bbf5
FG
33 Filestore
34 ---------
d2e6a577
FG
35
36 Existing logical volume (lv) or device:
37
b5b8bbf5 38 ceph-volume lvm create --filestore --data {vg name/lv name} --journal /path/to/device
d2e6a577
FG
39
40 Or:
41
b5b8bbf5 42 ceph-volume lvm create --filestore --data {vg name/lv name} --journal {vg name/lv name}
d2e6a577
FG
43
44 """)
45 parser = create_parser(
46 prog='ceph-volume lvm create',
47 description=sub_command_help,
48 )
49 if len(self.argv) == 0:
50 print(sub_command_help)
51 return
52 args = parser.parse_args(self.argv)
3efd9988
FG
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:
56 args.bluestore = True
d2e6a577 57 self.create(args)