]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/orchestrator: include container_image in 'service ls' output
authorSage Weil <sage@redhat.com>
Tue, 5 Nov 2019 18:08:55 +0000 (12:08 -0600)
committerSage Weil <sage@redhat.com>
Mon, 25 Nov 2019 16:01:01 +0000 (10:01 -0600)
Rearrange the columns a bit too.

Signed-off-by: Sage Weil <sage@redhat.com>
src/pybind/mgr/orchestrator.py
src/pybind/mgr/orchestrator_cli/module.py
src/pybind/mgr/ssh/module.py

index 1bdc7fec178064652b33058883b742625589d902..bd32fad32a2d26becb9c709d92616db270c09cf1 100644 (file)
@@ -723,15 +723,21 @@ class ServiceDescription(object):
     has decided the service should run.
     """
 
-    def __init__(self, nodename=None, container_id=None, service=None, service_instance=None,
+    def __init__(self, nodename=None,
+                 container_id=None, container_image_id=None,
+                 container_image_name=None,
+                 service=None, service_instance=None,
                  service_type=None, version=None, rados_config_location=None,
                  service_url=None, status=None, status_desc=None):
         # Node is at the same granularity as InventoryNode
         self.nodename = nodename
 
         # Not everyone runs in containers, but enough people do to
-        # justify having this field here.
-        self.container_id = container_id
+        # justify having the container_id (runtime id) and container_image
+        # (image name)
+        self.container_id = container_id                  # runtime id
+        self.container_image_id = container_image_id      # image hash
+        self.container_image_name = container_image_name  # image friendly name
 
         # Some services can be deployed in groups. For example, mds's can
         # have an active and standby daemons, and nfs-ganesha can run daemons
index cf4734118c3b4a7d4792892764acdb81d33615e5..f11c870a496e3d6d5f3431081af723d381a8849c 100644 (file)
@@ -251,8 +251,8 @@ class OrchestratorCli(orchestrator.OrchestratorClientMixin, MgrModule):
             return HandleCommandResult(stdout=json.dumps(data))
         else:
             table = PrettyTable(
-                ['NAME', 'HOST', 'CONTAINER', 'VERSION', 'STATUS',
-                 'DESCRIPTION'],
+                ['NAME', 'HOST', 'STATUS',
+                 'VERSION', 'IMAGE NAME', 'IMAGE ID', 'CONTAINER ID'],
                 border=False)
             table.align = 'l'
             table.left_padding_width = 0
@@ -268,10 +268,11 @@ class OrchestratorCli(orchestrator.OrchestratorClientMixin, MgrModule):
                 table.add_row((
                     s.name(),
                     ukn(s.nodename),
-                    ukn(s.container_id),
-                    ukn(s.version),
                     status,
-                    ukn(s.status_desc)))
+                    ukn(s.version),
+                    ukn(s.container_image_name),
+                    ukn(s.container_image_id)[0:12],
+                    ukn(s.container_id)[0:12]))
 
             return HandleCommandResult(stdout=table.get_string())
 
index c04742e62631790ab38f268e47d5e57fa621389c..ea3842f9dc98935c98a91339c6817bc519d5cd9c 100644 (file)
@@ -617,8 +617,10 @@ class SSHOrchestrator(MgrModule, orchestrator.OrchestratorClientMixin):
                 if service_name and not sd.service_instance.startswith(service_name + '.'):
                     continue
                 sd.nodename = host
-                sd.container_id = d['container_id']
-                sd.version = d['version']
+                sd.container_id = d.get('container_id')
+                sd.container_image_name = d.get('container_image_name')
+                sd.container_image_id = d.get('container_image_id')
+                sd.version = d.get('version')
                 sd.status_desc = d['state']
                 sd.status = {
                     'running': 1,