]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: check port in use
authorMichael Fritch <mfritch@suse.com>
Mon, 3 Feb 2020 16:30:45 +0000 (09:30 -0700)
committerMichael Fritch <mfritch@suse.com>
Thu, 12 Mar 2020 14:08:58 +0000 (08:08 -0600)
Signed-off-by: Michael Fritch <mfritch@suse.com>
src/cephadm/cephadm

index e7fbb2d486bed88ade02c2a4fb8e51ce29bcd4c8..6c1393832b75ed8f37640187676e5258a3b9f1ef 100755 (executable)
@@ -168,6 +168,10 @@ class NFSGanesha(object):
 
     required_files = ['ganesha.conf']
 
+    port_map = {
+        "nfs" : 2049,
+    }
+
     def __init__(self,
                  fsid,
                  daemon_id,
@@ -196,6 +200,14 @@ class NFSGanesha(object):
         # type: (str, Union[int, str]) -> NFSGanesha
         return cls(fsid, daemon_id, get_parm(args.config_json), args.image)
 
+    @staticmethod
+    def port_in_use():
+        # type () -> None
+        for (srv, port) in NFSGanesha.port_map.items():
+            if port_in_use(port):
+                msg = 'TCP port {} required for {} is already in use'.format(port, srv)
+                raise Error(msg)
+
     @staticmethod
     def get_container_mounts(data_dir):
         # type: (str) -> Dict[str, str]
@@ -2353,6 +2365,7 @@ def command_deploy():
                       reconfig=args.reconfig)
 
     elif daemon_type == NFSGanesha.daemon_type:
+        NFSGanesha.port_in_use()
         (config, keyring) = get_config_and_keyring()
         # TODO: extract ganesha uid/gid (997, 994) ?
         (uid, gid) = extract_uid_gid()