From 363a256e58ee0f3e9f059352c2de968e3dc398e3 Mon Sep 17 00:00:00 2001 From: Falk Reimann Date: Wed, 24 Jun 2015 16:54:02 +0200 Subject: [PATCH] Support keystone v3 domains in swift-dispersion This provides the capability to specify a project_name, project_domain_name and user_domain_name in /etc/swift/dispersion.conf. If this values are set in dispersion.conf they get populated to the swift-client. With this it is possible to have a specific dispersion project specified, which is not the keystone default domain. Changes were applied to swift-dispersion-populate and swift-dispersion-report. Relevant man pages, the example dispersion.conf and the admin guide were updated accordingly. DocImpact Closes-Bug: #1468374 Change-Id: I0e716f8d281b4d0f510bc568bcee4a13fc480ff7 --- bin/swift-dispersion-populate | 9 +++++++++ bin/swift-dispersion-report | 9 +++++++++ doc/manpages/dispersion.conf.5 | 11 ++++++++++- doc/manpages/swift-dispersion-populate.1 | 3 +++ doc/manpages/swift-dispersion-report.1 | 3 +++ doc/source/admin_guide.rst | 3 ++- etc/dispersion.conf-sample | 10 ++++++++++ 7 files changed, 46 insertions(+), 2 deletions(-) diff --git a/bin/swift-dispersion-populate b/bin/swift-dispersion-populate index 93ca6ee2cc..df3f310ca5 100755 --- a/bin/swift-dispersion-populate +++ b/bin/swift-dispersion-populate @@ -119,6 +119,9 @@ Usage: %%prog [options] [conf_file] retries = int(conf.get('retries', 5)) concurrency = int(conf.get('concurrency', 25)) endpoint_type = str(conf.get('endpoint_type', 'publicURL')) + user_domain_name = str(conf.get('user_domain_name', '')) + project_domain_name = str(conf.get('project_domain_name', '')) + project_name = str(conf.get('project_name', '')) insecure = options.insecure \ or config_true_value(conf.get('keystone_api_insecure', 'no')) container_populate = config_true_value( @@ -133,6 +136,12 @@ Usage: %%prog [options] [conf_file] retries_done = 0 os_options = {'endpoint_type': endpoint_type} + if user_domain_name: + os_options['user_domain_name'] = user_domain_name + if project_domain_name: + os_options['project_domain_name'] = project_domain_name + if project_name: + os_options['project_name'] = project_name url, token = get_auth(conf['auth_url'], conf['auth_user'], conf['auth_key'], diff --git a/bin/swift-dispersion-report b/bin/swift-dispersion-report index 34f239c876..37800cb95b 100755 --- a/bin/swift-dispersion-report +++ b/bin/swift-dispersion-report @@ -344,6 +344,9 @@ Usage: %%prog [options] [conf_file] and not options.container_only if not (object_report or container_report): exit("Neither container or object report is set to run") + user_domain_name = str(conf.get('user_domain_name', '')) + project_domain_name = str(conf.get('project_domain_name', '')) + project_name = str(conf.get('project_name', '')) insecure = options.insecure \ or config_true_value(conf.get('keystone_api_insecure', 'no')) if options.debug: @@ -352,6 +355,12 @@ Usage: %%prog [options] [conf_file] coropool = GreenPool(size=concurrency) os_options = {'endpoint_type': endpoint_type} + if user_domain_name: + os_options['user_domain_name'] = user_domain_name + if project_domain_name: + os_options['project_domain_name'] = project_domain_name + if project_name: + os_options['project_name'] = project_name url, token = get_auth(conf['auth_url'], conf['auth_user'], conf['auth_key'], diff --git a/doc/manpages/dispersion.conf.5 b/doc/manpages/dispersion.conf.5 index 162846a501..04099a9374 100644 --- a/doc/manpages/dispersion.conf.5 +++ b/doc/manpages/dispersion.conf.5 @@ -43,7 +43,13 @@ Authentication system URL .IP "\fBauth_user\fR" Authentication system account/user name .IP "\fBauth_key\fR" -Authentication system account/user password +Authentication system account/user password +.IP "\fBproject_name\fR" +Project name in case of keystone auth version 3 +.IP "\fBproject_domain_name\fR" +Project domain name in case of keystone auth version 3 +.IP "\fBuser_domain_name\fR" +User domain name in case of keystone auth version 3 .IP "\fBswift_dir\fR" Location of openstack-swift configuration and ring files .IP "\fBdispersion_coverage\fR" @@ -70,6 +76,9 @@ Whether to run the object report. The default is yes. .IP "auth_key = dpstats" .IP "swift_dir = /etc/swift" .IP "# keystone_api_insecure = no" +.IP "# project_name = dpstats" +.IP "# project_domain_name = default" +.IP "# user_domain_name = default" .IP "# dispersion_coverage = 1.0" .IP "# retries = 5" .IP "# concurrency = 25" diff --git a/doc/manpages/swift-dispersion-populate.1 b/doc/manpages/swift-dispersion-populate.1 index dd45e4e8eb..5ce1404569 100644 --- a/doc/manpages/swift-dispersion-populate.1 +++ b/doc/manpages/swift-dispersion-populate.1 @@ -85,6 +85,9 @@ Example \fI/etc/swift/dispersion.conf\fR: .IP "auth_user = dpstats:dpstats" .IP "auth_key = dpstats" .IP "swift_dir = /etc/swift" +.IP "# project_name = dpstats" +.IP "# project_domain_name = default" +.IP "# user_domain_name = default" .IP "# dispersion_coverage = 1.0" .IP "# retries = 5" .IP "# concurrency = 25" diff --git a/doc/manpages/swift-dispersion-report.1 b/doc/manpages/swift-dispersion-report.1 index 357c177dc1..c66eba1af6 100644 --- a/doc/manpages/swift-dispersion-report.1 +++ b/doc/manpages/swift-dispersion-report.1 @@ -101,6 +101,9 @@ Example \fI/etc/swift/dispersion.conf\fR: .IP "auth_user = dpstats:dpstats" .IP "auth_key = dpstats" .IP "swift_dir = /etc/swift" +.IP "# project_name = dpstats" +.IP "# project_domain_name = default" +.IP "# user_domain_name = default" .IP "# dispersion_coverage = 1.0" .IP "# retries = 5" .IP "# concurrency = 25" diff --git a/doc/source/admin_guide.rst b/doc/source/admin_guide.rst index 50eb9bd5e6..da1706bdc9 100644 --- a/doc/source/admin_guide.rst +++ b/doc/source/admin_guide.rst @@ -270,7 +270,8 @@ configuration file, /etc/swift/dispersion.conf. Example conf file:: There are also options for the conf file for specifying the dispersion coverage (defaults to 1%), retries, concurrency, etc. though usually the defaults are -fine. +fine. If you want to use keystone v3 for authentication there are options like +auth_version, user_domain_name, project_domain_name and project_name. Once the configuration is in place, run `swift-dispersion-populate` to populate the containers and objects throughout the cluster. diff --git a/etc/dispersion.conf-sample b/etc/dispersion.conf-sample index 7ce920e87d..865e80fecf 100644 --- a/etc/dispersion.conf-sample +++ b/etc/dispersion.conf-sample @@ -13,6 +13,16 @@ auth_key = testing # auth_key = password # auth_version = 2.0 # +# NOTE: If you want to use keystone (auth version 3.0), then its configuration +# would look something like: +# auth_url = http://localhost:5000/v3/ +# auth_user = user +# auth_key = password +# auth_version = 3.0 +# project_name = project +# project_domain_name = project_domain +# user_domain_name = user_domain +# # endpoint_type = publicURL # keystone_api_insecure = no #