]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/cephadm: fall back to service spec port if none on DaemonDescription
authorSage Weil <sage@newdream.net>
Mon, 15 Mar 2021 22:58:15 +0000 (18:58 -0400)
committerSage Weil <sage@newdream.net>
Mon, 15 Mar 2021 22:58:15 +0000 (18:58 -0400)
For an RGW instance that is deployed in an older version, we won't have
IP or port metadata in the DaemonDescription.  In that case, fall back
to the port in the ServiceSpec.  This should be safe since any such
instance will only have 1 daemon per host.

Signed-off-by: Sage Weil <sage@newdream.net>
src/pybind/mgr/cephadm/services/cephadmservice.py

index e646bee6b3414da455a0b7593716cbd890a204cf..4923db7dca318dad75dae1c27c7fc6e5525e50ed 100644 (file)
@@ -744,21 +744,29 @@ class RgwService(CephService):
 
         keyring = self.get_keyring(rgw_id)
 
+        if daemon_spec.ports:
+            port = daemon_spec.ports[0]
+        else:
+            # this is a redeploy of older instance that doesn't have an explicitly
+            # assigned port, in which case we can assume there is only 1 per host
+            # and it matches the spec.
+            port = spec.get_port()
+
         # configure frontend
         args = []
         ftype = spec.rgw_frontend_type or "beast"
         if ftype == 'beast':
             if spec.ssl:
-                args.append(f"ssl_port={daemon_spec.ports[0]}")
+                args.append(f"ssl_port={port}")
                 args.append(f"ssl_certificate=config://rgw/cert/{spec.service_name()}.crt")
             else:
-                args.append(f"port={daemon_spec.ports[0]}")
+                args.append(f"port={port}")
         elif ftype == 'civetweb':
             if spec.ssl:
-                args.append(f"port={daemon_spec.ports[0]}s")  # note the 's' suffix on port
+                args.append(f"port={port}s")  # note the 's' suffix on port
                 args.append(f"ssl_certificate=config://rgw/cert/{spec.service_name()}.crt")
             else:
-                args.append(f"port={daemon_spec.ports[0]}")
+                args.append(f"port={port}")
         frontend = f'{ftype} {" ".join(args)}'
 
         ret, out, err = self.mgr.check_mon_command({