]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/orch: Add `ceph orch ls --export` 34061/head
authorSebastian Wagner <sebastian.wagner@suse.com>
Wed, 25 Mar 2020 12:12:46 +0000 (13:12 +0100)
committerSebastian Wagner <sebastian.wagner@suse.com>
Thu, 26 Mar 2020 11:02:56 +0000 (12:02 +0100)
* defaults to `--format yaml`
* don't include `status`

```
$  ceph orch ls --export
placement:
  host_pattern: '*'
service_name: crash
service_type: crash
```

Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
doc/mgr/orchestrator.rst
src/pybind/mgr/orchestrator/module.py

index 2f66d0484e27002e23c4150de200d7c5cd3c8177..5741808bf423400251b17f7ad109acd0ee34a4cf 100644 (file)
@@ -206,18 +206,29 @@ services of a particular type via optional --type parameter
 
 ::
 
-    ceph orch ps
-    ceph orch service ls [--host host] [--svc_type type] [--refresh]
+    ceph orch ls [--service_type type] [--service_name name] [--export] [--format f] [--refresh]
 
 Discover the status of a particular service or daemons::
 
-    ceph orch service ls --svc_type type --svc_id <name> [--refresh]
+    ceph orch ls --service_type type --service_name <name> [--refresh]
+    
+Export the service specs known to the orchestrator as yaml in format
+that is compatible to ``ceph orch apply -i``::
+
+    ceph orch ls --export
+
 
+Daemon Status
+=============
 
+Print a list of all daemons known to the orchestrator::
+
+    ceph orch ps [--hostname host] [--daemon_type type] [--service_name name] [--daemon_id id] [--format f] [--refresh]
+    
 Query the status of a particular service instance (mon, osd, mds, rgw).  For OSDs
 the id is the numeric OSD ID, for MDS services it is the file system name::
 
-    ceph orch daemon status <type> <instance-name> [--refresh]
+    ceph orch ps --daemon_type osd --daemon_id 0
 
 
 .. _orchestrator-cli-cephfs:
index b023f3d6d3be70e36451451b9dc5d27b9b3cff8c..60d84386d1316661512058c5e1a20dd3356a517c 100644 (file)
@@ -327,10 +327,15 @@ class OrchestratorCli(OrchestratorClientMixin, MgrModule):
         'orch ls',
         "name=service_type,type=CephString,req=false "
         "name=service_name,type=CephString,req=false "
+        "name=export,type=CephBool,req=false "
         "name=format,type=CephChoices,strings=plain|json|json-pretty|yaml,req=false "
         "name=refresh,type=CephBool,req=false",
         'List services known to orchestrator')
-    def _list_services(self, host=None, service_type=None, service_name=None, format='plain', refresh=False):
+    def _list_services(self, host=None, service_type=None, service_name=None, export=False, format='plain', refresh=False):
+
+        if export and format == 'plain':
+            format = 'yaml'
+
         completion = self.describe_service(service_type,
                                            service_name,
                                            refresh=refresh)
@@ -347,7 +352,10 @@ class OrchestratorCli(OrchestratorClientMixin, MgrModule):
         if len(services) == 0:
             return HandleCommandResult(stdout="No services reported")
         elif format != 'plain':
-            data = [s.to_json() for s in services]
+            if export:
+                data = [s.spec.to_json() for s in services]
+            else:
+                data = [s.to_json() for s in services]
             return HandleCommandResult(stdout=to_format(data, format))
         else:
             now = datetime.datetime.utcnow()