]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: add version to `command_ls` output 33064/head
authorMichael Fritch <mfritch@suse.com>
Thu, 5 Mar 2020 23:00:43 +0000 (16:00 -0700)
committerMichael Fritch <mfritch@suse.com>
Thu, 12 Mar 2020 14:09:00 +0000 (08:09 -0600)
Signed-off-by: Michael Fritch <mfritch@suse.com>
src/cephadm/cephadm

index ce27ae77a7e29629330094efbba3f4b5a3c49435..f65aacd6a01d213ee0d589cda2806b11c467029b 100755 (executable)
@@ -225,6 +225,19 @@ class NFSGanesha(object):
         ]
         return envs
 
+    @staticmethod
+    def get_version(container_id):
+        # type(str) -> Optional[str]
+        version = None
+        out, err, code = call(
+            [container_path, 'exec', container_id,
+             NFSGanesha.entrypoint, '-v'])
+        if code == 0:
+            match = re.search(r'NFS-Ganesha Release\s*=\s*[V]*([\d.]+)', out)
+            if match:
+                version = match.group(1)
+        return version
+
     def validate(self):
         # type () -> None
         if not is_fsid(self.fsid):
@@ -2676,7 +2689,9 @@ def list_daemons(detail=True, legacy_dir=None):
                             start_stamp = try_convert_datetime(start)
                             if not version or '.' not in version:
                                 version = seen_versions.get(image_id, None)
-                            if not version:
+                            if daemon_type == NFSGanesha.daemon_type:
+                                version = NFSGanesha.get_version(container_id)
+                            elif not version:
                                 if daemon_type in Ceph.daemons:
                                     out, err, code = call(
                                         [container_path, 'exec', container_id,
@@ -2705,8 +2720,7 @@ def list_daemons(detail=True, legacy_dir=None):
                                         version = err.split(' ')[2]
                                         seen_versions[image_id] = version
                                 else:
-                                    logging.warning('not fetching version for unknown daemon type %s' % daemon_type)
-                                    pass
+                                    logging.warning('version for unknown daemon type %s' % daemon_type)
                         else:
                             vfile = os.path.join(data_dir, fsid, j, 'unit.image') # type: ignore
                             try: