]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/rgw: rgw task can override --rgw-dns-name on the command line
authorCasey Bodley <cbodley@redhat.com>
Tue, 20 Feb 2018 17:28:24 +0000 (12:28 -0500)
committerNathan Cutler <ncutler@suse.com>
Tue, 8 Oct 2019 20:47:45 +0000 (22:47 +0200)
the value for rgw_dns_name isn't known until a machine is assigned, so
it can't be set via 'override: conf:'. add a per-client config option
to the rgw task so it can add the endpoint's hostname and/or s3website
hostname on the radosgw command line

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 658e5932fb79e2d33b73363b6ce76ff299809e16)

qa/tasks/rgw.py

index d5b9603d69120b15e9289010444bf7a406b273e9..28e35593f405c1080caefef0e0d00d0f4ce4b907 100644 (file)
@@ -22,10 +22,12 @@ from util.rados import (rados, create_ec_pool,
 log = logging.getLogger(__name__)
 
 class RGWEndpoint:
-    def __init__(self, hostname=None, port=None, cert=None):
+    def __init__(self, hostname=None, port=None, cert=None, dns_name=None, website_dns_name=None):
         self.hostname = hostname
         self.port = port
         self.cert = cert
+        self.dns_name = dns_name
+        self.website_dns_name = website_dns_name
 
     def url(self):
         proto = 'https' if self.cert else 'http'
@@ -105,6 +107,11 @@ def start_rgw(ctx, config, clients):
                                                 kport=keystone_port),
                 ])
 
+        if client_config.get('dns-name'):
+            rgw_cmd.extend(['--rgw-dns-name', endpoint.dns_name])
+        if client_config.get('dns-s3website-name'):
+            rgw_cmd.extend(['--rgw-dns-s3website-name', endpoint.website_dns_name])
+
         rgw_cmd.extend([
             '--foreground',
             run.Raw('|'),
@@ -186,7 +193,17 @@ def assign_endpoints(ctx, config, default_cert):
             port = next_port
             next_port += 1
 
-        role_endpoints[role] = RGWEndpoint(remote.hostname, port, ssl_certificate)
+        # if dns-name is given, use it as the hostname (or as a prefix)
+        dns_name = client_config.get('dns-name', '')
+        if len(dns_name) == 0 or dns_name.endswith('.'):
+            dns_name += remote.hostname
+
+        website_dns_name = client_config.get('dns-s3website-name')
+        if website_dns_name:
+            if len(website_dns_name) == 0 or website_dns_name.endswith('.'):
+                website_dns_name += remote.hostname
+
+        role_endpoints[role] = RGWEndpoint(remote.hostname, port, ssl_certificate, dns_name, website_dns_name)
 
     return role_endpoints