Example #1
0
    def _service_add(self, cmd):
        svc_type = cmd['svc_type']
        if svc_type == "osd":
            device_spec = cmd['svc_arg']
            try:
                node_name, block_device = device_spec.split(":")
            except TypeError:
                return -errno.EINVAL, "", "Invalid device spec, should be <node>:<device>"

            spec = orchestrator.OsdCreationSpec()
            spec.node = node_name
            spec.format = "bluestore"
            spec.drive_group = orchestrator.DriveGroupSpec([block_device])

            completion = self._oremote("create_osds", spec)
            self._wait([completion])

            return 0, "", "Success."

        elif svc_type == "mds":
            fs_name = cmd['svc_arg']

            spec = orchestrator.StatelessServiceSpec()
            spec.name = fs_name

            completion = self._oremote("add_stateless_service", svc_type, spec)
            self._wait([completion])

            return 0, "", "Success."
        else:
            raise NotImplementedError(svc_type)
Example #2
0
    def _osd_add(self, cmd):
        device_spec = cmd['svc_arg']
        try:
            node_name, block_device = device_spec.split(":")
        except TypeError:
            return HandleCommandResult(-errno.EINVAL,
                                       stderr="Invalid device spec, should be <node>:<device>")

        spec = orchestrator.OsdCreationSpec()
        spec.node = node_name
        spec.format = "bluestore"
        spec.drive_group = orchestrator.DriveGroupSpec([block_device])

        completion = self.create_osds(spec)
        self._orchestrator_wait([completion])

        return HandleCommandResult()