]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume: devices.lvm add create module for the sub-command support
authorAlfredo Deza <adeza@redhat.com>
Mon, 24 Jul 2017 18:18:32 +0000 (14:18 -0400)
committerAlfredo Deza <adeza@redhat.com>
Fri, 4 Aug 2017 14:25:58 +0000 (10:25 -0400)
Signed-off-by: Alfredo Deza <adeza@redhat.com>
src/ceph-volume/ceph_volume/devices/lvm/create.py [new file with mode: 0644]

diff --git a/src/ceph-volume/ceph_volume/devices/lvm/create.py b/src/ceph-volume/ceph_volume/devices/lvm/create.py
new file mode 100644 (file)
index 0000000..e37d869
--- /dev/null
@@ -0,0 +1,63 @@
+from __future__ import print_function
+from textwrap import dedent
+from ceph_volume.util import system
+from .common import create_parser
+from .prepare import Prepare
+from .activate import Activate
+
+
+class Create(object):
+
+    help = 'Create a new OSD from  an LVM device'
+
+    def __init__(self, argv):
+        self.argv = argv
+
+    def create(self, args):
+        if not args.osd_fsid:
+            args.osd_fsid = system.generate_uuid()
+        if not args.osd_id:
+            args.osd_id = prepare_utils.create_id(args.osd_fsid)
+        Prepare([]).prepare(args)
+        Activate([]).activate(args)
+
+    def main(self):
+        sub_command_help = dedent("""
+        Create an OSD by assigning an ID and FSID, registering them with the
+        cluster with an ID and FSID, formatting and mounting the volume, adding
+        all the metadata to the logical volumes using LVM tags, and starting
+        the OSD daemon.
+
+        Most basic Usage looks like (journal will be collocated from the same volume group):
+
+            ceph-volume lvm create --data {volume group name}
+
+
+        Example calls for supported scenarios:
+
+        Dedicated volume group for Journal(s)
+        -------------------------------------
+
+          Existing logical volume (lv) or device:
+
+              ceph-volume lvm create --data {logical volume} --journal /path/to/{lv}|{device}
+
+          Or:
+
+              ceph-volume lvm create --data {data volume group} --journal {journal volume group}
+
+        Collocated (same group) for data and journal
+        --------------------------------------------
+
+              ceph-volume lvm create --data {volume group}
+
+        """)
+        parser = create_parser(
+            prog='ceph-volume lvm create',
+            description=sub_command_help,
+        )
+        if len(self.argv) == 0:
+            print(sub_command_help)
+            return
+        args = parser.parse_args(self.argv)
+        self.create(args)