]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.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>
Wed, 17 Mar 2021 21:24:43 +0000 (16:24 -0500)
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>
(cherry picked from commit 1bf8a2dacf0b38c8a12c84390b5b7be9f301eff2)

src/pybind/mgr/cephadm/services/cephadmservice.py

index 46c5f8ef895dacd7ff9169f5502da90cf4f29d4b..006bcfe1555f11616a602dfec859a82282eb6c69 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({