]> git.proxmox.com Git - ceph.git/blob - ceph/src/ceph-volume/ceph_volume/devices/lvm/create.py
update sources to v12.1.3
[ceph.git] / ceph / src / ceph-volume / ceph_volume / devices / lvm / create.py
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
8
9
10 class 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
31 Most basic Usage looks like (journal will be collocated from the same volume group):
32
33 ceph-volume lvm create --data {volume group name}
34
35
36 Example calls for supported scenarios:
37
38 Dedicated volume group for Journal(s)
39 -------------------------------------
40
41 Existing logical volume (lv) or device:
42
43 ceph-volume lvm create --data {logical volume} --journal /path/to/{lv}|{device}
44
45 Or:
46
47 ceph-volume lvm create --data {data volume group} --journal {journal volume group}
48
49 Collocated (same group) for data and journal
50 --------------------------------------------
51
52 ceph-volume lvm create --data {volume group}
53
54 """)
55 parser = create_parser(
56 prog='ceph-volume lvm create',
57 description=sub_command_help,
58 )
59 if len(self.argv) == 0:
60 print(sub_command_help)
61 return
62 args = parser.parse_args(self.argv)
63 self.create(args)