Beispiel #1
0
    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.

        Existing logical volume (lv) or device:

            ceph-volume lvm create --data {vg name/lv name} --journal /path/to/device

        Or:

            ceph-volume lvm create --data {vg name/lv name} --journal {vg name/lv name}

        """)
        parser = create_parser(
            prog='ceph-volume lvm create',
            description=sub_command_help,
        )
        if len(self.argv) == 0:
            print(sub_command_help)
            return
        exclude_group_options(parser, groups=['filestore', 'bluestore'], argv=self.argv)
        args = parser.parse_args(self.argv)
        # Default to bluestore here since defaulting it in add_argument may
        # cause both to be True
        if not args.bluestore and not args.filestore:
            args.bluestore = True
        self.create(args)
Beispiel #2
0
    def main(self):
        sub_command_help = dedent("""
        Prepare an OSD by assigning an ID and FSID, registering them with the
        cluster with an ID and FSID, formatting and mounting the volume, and
        finally by adding all the metadata to the logical volumes using LVM
        tags, so that it can later be discovered.

        Once the OSD is ready, an ad-hoc systemd unit will be enabled so that
        it can later get activated and the OSD daemon can get started.

        Encryption is supported via dmcrypt and the --dmcrypt flag.

        Example calls for supported scenarios:

        Filestore
        ---------

          Existing logical volume (lv) or device:

              ceph-volume lvm prepare --filestore --data {vg/lv} --journal /path/to/device

          Or:

              ceph-volume lvm prepare --filestore --data {vg/lv} --journal {vg/lv}

          Existing block device, that will be made a group and logical volume:

              ceph-volume lvm prepare --filestore --data /path/to/device --journal {vg/lv}

        Bluestore
        ---------

          Existing logical volume (lv):

              ceph-volume lvm prepare --bluestore --data {vg/lv}

          Existing block device, that will be made a group and logical volume:

              ceph-volume lvm prepare --bluestore --data /path/to/device

          Optionally, can consume db and wal devices or logical volumes:

              ceph-volume lvm prepare --bluestore --data {vg/lv} --block.wal {device} --block-db {vg/lv}
        """)
        parser = prepare_parser(
            prog='ceph-volume lvm prepare',
            description=sub_command_help,
        )
        if len(self.argv) == 0:
            print(sub_command_help)
            return
        exclude_group_options(parser,
                              argv=self.argv,
                              groups=['filestore', 'bluestore'])
        args = parser.parse_args(self.argv)
        # Default to bluestore here since defaulting it in add_argument may
        # cause both to be True
        if not args.bluestore and not args.filestore:
            args.bluestore = True
        self.safe_prepare(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.

        Existing logical volume (lv) or device:

            ceph-volume lvm create --data {vg name/lv name} --journal /path/to/device

        Or:

            ceph-volume lvm create --data {vg name/lv name} --journal {vg name/lv name}

        """)
        parser = create_parser(
            prog='ceph-volume lvm create',
            description=sub_command_help,
        )
        if len(self.argv) == 0:
            print(sub_command_help)
            return
        exclude_group_options(parser,
                              groups=['filestore', 'bluestore'],
                              argv=self.argv)
        args = parser.parse_args(self.argv)
        # Default to bluestore here since defaulting it in add_argument may
        # cause both to be True
        if not args.bluestore and not args.filestore:
            args.bluestore = True
        self.create(args)
Beispiel #4
0
    def main(self):
        sub_command_help = dedent("""
        Prepare an OSD by assigning an ID and FSID, registering them with the
        cluster with an ID and FSID, formatting and mounting the volume, and
        finally by adding all the metadata to the logical volumes using LVM
        tags, so that it can later be discovered.

        Once the OSD is ready, an ad-hoc systemd unit will be enabled so that
        it can later get activated and the OSD daemon can get started.

        Encryption is supported via dmcrypt and the --dmcrypt flag.

        Example calls for supported scenarios:

        Filestore
        ---------

          Existing logical volume (lv) or device:

              ceph-volume lvm prepare --filestore --data {vg/lv} --journal /path/to/device

          Or:

              ceph-volume lvm prepare --filestore --data {vg/lv} --journal {vg/lv}

          Existing block device, that will be made a group and logical volume:

              ceph-volume lvm prepare --filestore --data /path/to/device --journal {vg/lv}

        Bluestore
        ---------

          Existing logical volume (lv):

              ceph-volume lvm prepare --bluestore --data {vg/lv}

          Existing block device, that will be made a group and logical volume:

              ceph-volume lvm prepare --bluestore --data /path/to/device

          Optionally, can consume db and wal devices or logical volumes:

              ceph-volume lvm prepare --bluestore --data {vg/lv} --block.wal {device} --block-db {vg/lv}
        """)
        parser = prepare_parser(
            prog='ceph-volume lvm prepare',
            description=sub_command_help,
        )
        if len(self.argv) == 0:
            print(sub_command_help)
            return
        exclude_group_options(parser, argv=self.argv, groups=['filestore', 'bluestore'])
        args = parser.parse_args(self.argv)
        # Default to bluestore here since defaulting it in add_argument may
        # cause both to be True
        if not args.bluestore and not args.filestore:
            args.bluestore = True
        self.safe_prepare(args)
Beispiel #5
0
    def test_flags_conflict(self, capsys):
        argv = ['<prog>', '--filestore', '--bluestore']
        filestore_group = self.parser.add_argument_group('filestore')
        bluestore_group = self.parser.add_argument_group('bluestore')
        filestore_group.add_argument('--filestore')
        bluestore_group.add_argument('--bluestore')

        arg_validators.exclude_group_options(
            self.parser, ['filestore', 'bluestore'], argv=argv
        )
        stdout, stderr = capsys.readouterr()
        assert 'Cannot use --filestore (filestore) with --bluestore (bluestore)' in stdout
Beispiel #6
0
    def main(self):
        sub_command_help = dedent("""
        Prepare an OSD by assigning an ID and FSID, registering them with the
        cluster with an ID and FSID, formatting and mounting the volume, and
        finally by adding all the metadata to the logical volumes using LVM
        tags, so that it can later be discovered.

        Once the OSD is ready, an ad-hoc systemd unit will be enabled so that
        it can later get activated and the OSD daemon can get started.

        Encryption is supported via dmcrypt and the --dmcrypt flag.

        Existing logical volume (lv):

            ceph-volume lvm prepare --data {vg/lv}

        Existing block device (a logical volume will be created):

            ceph-volume lvm prepare --data /path/to/device

        Optionally, can consume db and wal devices, partitions or logical
        volumes. A device will get a logical volume, partitions and existing
        logical volumes will be used as is:

            ceph-volume lvm prepare --data {vg/lv} --block.wal {partition} --block.db {/path/to/device}
        """)
        parser = prepare_parser(
            prog='ceph-volume lvm prepare',
            description=sub_command_help,
        )
        if len(self.argv) == 0:
            print(sub_command_help)
            return
        exclude_group_options(parser,
                              argv=self.argv,
                              groups=['filestore', 'bluestore'])
        self.args = parser.parse_args(self.argv)
        # the unfortunate mix of one superset for both filestore and bluestore
        # makes this validation cumbersome
        if self.args.filestore:
            if not self.args.journal:
                raise SystemExit(
                    '--journal is required when using --filestore')
        # Default to bluestore here since defaulting it in add_argument may
        # cause both to be True
        if not self.args.bluestore and not self.args.filestore:
            self.args.bluestore = True
        self.safe_prepare()
Beispiel #7
0
 def test_flags_in_no_group(self):
     argv = ['<prog>', '--foo', '--bar']
     filestore_group = self.parser.add_argument_group('filestore')
     bluestore_group = self.parser.add_argument_group('bluestore')
     filestore_group.add_argument('--filestore')
     bluestore_group.add_argument('--bluestore')
     result = arg_validators.exclude_group_options(
         self.parser, ['filestore', 'bluestore'], argv=argv)
     assert result is None
Beispiel #8
0
    def main(self):
        sub_command_help = dedent("""
        Prepare an OSD by assigning an ID and FSID, registering them with the
        cluster with an ID and FSID, formatting and mounting the volume, and
        finally by adding all the metadata to the logical volumes using LVM
        tags, so that it can later be discovered.

        Once the OSD is ready, an ad-hoc systemd unit will be enabled so that
        it can later get activated and the OSD daemon can get started.

        Encryption is supported via dmcrypt and the --dmcrypt flag.

        Existing logical volume (lv):

            ceph-volume lvm prepare --data {vg/lv}

        Existing block device, that will be made a group and logical volume:

            ceph-volume lvm prepare --data /path/to/device

        Optionally, can consume db and wal partitions or logical volumes:

            ceph-volume lvm prepare --data {vg/lv} --block.wal {partition} --block.db {vg/lv}
        """)
        parser = prepare_parser(
            prog='ceph-volume lvm prepare',
            description=sub_command_help,
        )
        if len(self.argv) == 0:
            print(sub_command_help)
            return
        exclude_group_options(parser, argv=self.argv, groups=['filestore', 'bluestore'])
        self.args = parser.parse_args(self.argv)
        # the unfortunate mix of one superset for both filestore and bluestore
        # makes this validation cumbersome
        if self.args.filestore:
            if not self.args.journal:
                raise SystemExit('--journal is required when using --filestore')
        # Default to bluestore here since defaulting it in add_argument may
        # cause both to be True
        if not self.args.bluestore and not self.args.filestore:
            self.args.bluestore = True
        self.safe_prepare(self.args)
Beispiel #9
0
 def test_flags_in_no_group(self):
     argv = ['<prog>', '--foo', '--bar']
     filestore_group = self.parser.add_argument_group('filestore')
     bluestore_group = self.parser.add_argument_group('bluestore')
     filestore_group.add_argument('--filestore')
     bluestore_group.add_argument('--bluestore')
     result = arg_validators.exclude_group_options(
         self.parser,
         ['filestore', 'bluestore'],
         argv=argv
     )
     assert result is None
Beispiel #10
0
    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. This is a convenience command that combines the prepare
        and activate steps.

        Encryption is supported via dmcrypt and the --dmcrypt flag.

        Existing logical volume (lv):

            ceph-volume lvm create --data {vg/lv}

        Existing block device (a logical volume will be created):

            ceph-volume lvm create --data /path/to/device

        Optionally, can consume db and wal block devices, partitions or logical
        volumes. A device will get a logical volume, partitions and existing
        logical volumes will be used as is:

            ceph-volume lvm create --data {vg/lv} --block.wal {partition} --block.db {/path/to/device}
        """)
        parser = create_parser(
            prog='ceph-volume lvm create',
            description=sub_command_help,
        )
        if len(self.argv) == 0:
            print(sub_command_help)
            return
        exclude_group_options(parser, groups=['filestore', 'bluestore'], argv=self.argv)
        args = parser.parse_args(self.argv)
        # Default to bluestore here since defaulting it in add_argument may
        # cause both to be True
        if not args.bluestore and not args.filestore:
            args.bluestore = True
        self.create(args)