From: Alfredo Deza Date: Mon, 24 Jul 2017 18:18:32 +0000 (-0400) Subject: ceph-volume: devices.lvm add create module for the sub-command support X-Git-Tag: ses5-milestone10~3^2~5^2~24 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=055e16836bfb1f78ea2322dcca336d7d32802ce0;p=ceph.git ceph-volume: devices.lvm add create module for the sub-command support Signed-off-by: Alfredo Deza --- 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 index 000000000000..e37d869a73c1 --- /dev/null +++ b/src/ceph-volume/ceph_volume/devices/lvm/create.py @@ -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)