]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/orchestrator: remove traces of ceph orch osd spec
authorJoshua Schmid <jschmid@suse.de>
Tue, 11 Aug 2020 14:47:15 +0000 (16:47 +0200)
committerJoshua Schmid <jschmid@suse.de>
Tue, 11 Aug 2020 14:47:15 +0000 (16:47 +0200)
Signed-off-by: Joshua Schmid <jschmid@suse.de>
src/pybind/mgr/orchestrator/module.py

index 4735afffcea9c2b4862dc2ea250c8b6fa90702d5..4d6b21e1b084c6ca286032e04ccf23ba7117184f 100644 (file)
@@ -562,147 +562,6 @@ class OrchestratorCli(OrchestratorClientMixin, MgrModule,
 
             return HandleCommandResult(stdout=table.get_string())
 
-    def set_unmanaged_flag(self,
-                           unmanaged_flag: bool,
-                           service_type: str = 'osd',
-                           service_name=None
-                           ) -> HandleCommandResult:
-        # setting unmanaged for $service_name
-        completion = self.describe_service(service_name=service_name, service_type=service_type)
-        self._orchestrator_wait([completion])
-        raise_if_exception(completion)
-        services: List[ServiceDescription] = completion.result
-        specs = list()
-        for service in services:
-            spec = service.spec
-            spec.unmanaged = unmanaged_flag
-            specs.append(spec)
-        apply_completion = self.apply(cast(List[GenericSpec], specs))
-        self._orchestrator_wait([apply_completion])
-        raise_if_exception(apply_completion)
-        if specs:
-            return HandleCommandResult(stdout=f"Changed <unmanaged> flag to <{unmanaged_flag}> for "
-                                              f"{[spec.service_name() for spec in specs]}")
-        else:
-            return HandleCommandResult(stdout=f"No specs found with the <service_name> -> {service_name}")
-
-    @_cli_write_command(
-        'orch osd spec',
-        'name=service_name,type=CephString,req=false '
-        'name=preview,type=CephBool,req=false '
-        'name=unmanaged,type=CephBool,req=false '
-        "name=format,type=CephChoices,strings=plain|json|json-pretty|yaml,req=false",
-        'Common operations on an OSDSpec. Allows previewing and changing the unmanaged flag.')
-    def _misc_osd(self,
-                  preview: bool = False,
-                  service_name: Optional[str] = None,
-                  unmanaged=None,
-                  format: Optional[str] = 'plain',
-                  ) -> HandleCommandResult:
-        usage = """
-usage:
-  ceph orch osd spec --preview
-  ceph orch osd spec --unmanaged=true|false 
-  ceph orch osd spec --service-name <service_name> --preview
-  ceph orch osd spec --service-name <service_name> --unmanaged=true|false (defaults to false)
-  
-Restrictions:
-
-    Mutexes:
-    * --preview ,--unmanaged 
-
-    Although it it's possible to set these at the same time, we will lack a proper response to each
-    action, possibly shadowing any failures.
-
-Description:
-
-    * --service-name
-        If flag is omitted, assume to target all existing OSDSpecs.
-        Needs either --unamanged or --preview.
-
-    * --unmanaged
-        Applies <unamanged> flag to targeted --service-name.
-        If --service-name is omitted, target all OSDSpecs
-        
-Examples:
-
-    # ceph orch osd spec --preview
-    
-    Queries all available OSDSpecs for previews
-    
-    # ceph orch osd spec --service-name my-osdspec-name --preview
-    
-    Queries only the specified <my-osdspec-name> for previews
-    
-    # ceph orch osd spec --unmanaged=true
-    
-    # Changes flags of all available OSDSpecs to true
-    
-    # ceph orch osd spec --service-name my-osdspec-name --unmanaged=true
-    
-    Changes the unmanaged flag of <my-osdspec-name> to true
-"""
-
-        def print_preview(previews, format_to):
-            if format != 'plain':
-                return to_format(previews, format_to, many=False, cls=None)
-            else:
-                table = PrettyTable(
-                    ['NAME', 'HOST', 'DATA', 'DB', 'WAL'],
-                    border=False)
-                table.align = 'l'
-                table.left_padding_width = 0
-                table.right_padding_width = 1
-                for host, data in previews.items():
-                    for spec in data:
-                        if spec.get('error'):
-                            return spec.get('message')
-                        dg_name = spec.get('osdspec')
-                        for osd in spec.get('data', {}).get('osds', []):
-                            db_path = '-'
-                            wal_path = '-'
-                            block_db = osd.get('block.db', {}).get('path')
-                            block_wal = osd.get('block.wal', {}).get('path')
-                            block_data = osd.get('data', {}).get('path', '')
-                            if not block_data:
-                                continue
-                            if block_db:
-                                db_path = spec.get('data', {}).get('vg', {}).get('devices', [])
-                            if block_wal:
-                                wal_path = spec.get('data', {}).get('wal_vg', {}).get('devices', [])
-                            table.add_row((dg_name, host, block_data, db_path, wal_path))
-                ret = table.get_string()
-                if not ret:
-                    ret = "No preview available"
-                return ret
-
-        if preview and (unmanaged is not None):
-            return HandleCommandResult(-errno.EINVAL, stderr=usage)
-
-        if service_name:
-            if preview:
-                completion = self.preview_osdspecs(osdspec_name=service_name)
-                self._orchestrator_wait([completion])
-                raise_if_exception(completion)
-                out = completion.result_str()
-                return HandleCommandResult(stdout=print_preview(ast.literal_eval(out), format))
-            if unmanaged is not None:
-                return self.set_unmanaged_flag(service_name=service_name, unmanaged_flag=unmanaged)
-
-            return HandleCommandResult(-errno.EINVAL, stderr=usage)
-
-        if preview:
-            completion = self.preview_osdspecs()
-            self._orchestrator_wait([completion])
-            raise_if_exception(completion)
-            out = completion.result_str()
-            return HandleCommandResult(stdout=print_preview(ast.literal_eval(out), format))
-
-        if unmanaged is not None:
-            return self.set_unmanaged_flag(unmanaged_flag=unmanaged)
-
-        return HandleCommandResult(-errno.EINVAL, stderr=usage)
-
     @_cli_write_command(
         'orch apply osd',
         'name=all_available_devices,type=CephBool,req=false '