Support deploy of Swift with internal S3 support

Swift support is in-tree for Swift since OpenStack Rocky, and
the swift-plugin-s3 package has been removed from the archive at
Cosmic so drop installation at Rocky.

Add new template for Rocky to use the in-tree s3api and s3token
middleware.

Enable cosmic test to validate changes.

Change-Id: Ie5447dc44203c1ea2ad27e6d71248ba59d7549d0
Closes-Bug: 1805597
This commit is contained in:
James Page 2018-11-28 10:10:52 +00:00
parent 45c57883a7
commit 8cf9dd4e1a
6 changed files with 208 additions and 12 deletions

View File

@ -125,9 +125,9 @@ BASE_PACKAGES = [
'python-keystone',
]
# > Folsom specific packages
FOLSOM_PACKAGES = BASE_PACKAGES + ['swift-plugin-s3', 'swauth']
FOLSOM_PACKAGES = ['swift-plugin-s3', 'swauth']
# > Mitaka specific packages
MITAKA_PACKAGES = FOLSOM_PACKAGES + ['python-ceilometermiddleware']
MITAKA_PACKAGES = ['python-ceilometermiddleware']
SWIFT_HA_RES = 'grp_swift_vips'
TEMPLATES = 'templates/'
@ -454,12 +454,14 @@ def ensure_swift_dir(conf_dir=os.path.dirname(SWIFT_CONF)):
def determine_packages(release):
"""Determine what packages are needed for a given OpenStack release."""
cmp_openstack = CompareOpenStackReleases(release)
pkgs = BASE_PACKAGES[:]
if cmp_openstack >= 'folsom':
pkgs += FOLSOM_PACKAGES
if cmp_openstack >= 'mitaka':
return MITAKA_PACKAGES
elif cmp_openstack >= 'folsom':
return FOLSOM_PACKAGES
else:
return BASE_PACKAGES
pkgs += MITAKA_PACKAGES
if cmp_openstack >= 'rocky':
pkgs.remove('swift-plugin-s3')
return pkgs
def initialize_ring(path, part_power, replicas, min_hours):

View File

@ -1,3 +1,4 @@
# queens
[DEFAULT]
bind_port = {{ bind_port }}
workers = {{ workers }}

View File

@ -0,0 +1,151 @@
# rocky
[DEFAULT]
bind_port = {{ bind_port }}
workers = {{ workers }}
user = swift
bind_ip = {{ bind_host }}
log_name = swift
log_facility = LOG_LOCAL0
log_level = {{ log_level }}
log_address = /dev/log
log_headers = {{ log_headers }}
{% if statsd_host %}
log_statsd_host = {{ statsd_host }}
log_statsd_port = {{ statsd_port }}
log_statsd_default_sample_rate = {{ statsd_sample_rate }}
{% endif %}
{% if ssl %}
cert_file = {{ ssl_cert }}
key_file = {{ ssl_key }}
{% endif %}
{% if auth_type == 'keystone' %}
[pipeline:main]
{% if transport_url %}
pipeline = ceilometer catch_errors gatekeeper healthcheck proxy-logging cache container_sync bulk tempurl ratelimit formpost authtoken keystoneauth s3api s3token staticweb copy container-quotas account-quotas slo dlo versioned_writes symlink proxy-logging proxy-server
{% else %}
pipeline = catch_errors gatekeeper healthcheck proxy-logging cache container_sync bulk tempurl ratelimit formpost authtoken keystoneauth s3api s3token staticweb copy container-quotas account-quotas slo dlo versioned_writes symlink proxy-logging proxy-server
{% endif %}
{% else %}
[pipeline:main]
pipeline = catch_errors gatekeeper healthcheck proxy-logging cache container_sync bulk tempurl slo dlo formpost {{ auth_type }} staticweb versioned_writes container-quotas account-quotas proxy-logging proxy-server
{% endif %}
[app:proxy-server]
use = egg:swift#proxy
allow_account_management = true
{% if auth_type == 'keystone' %}account_autocreate = true{% endif %}
node_timeout = {{ node_timeout }}
recoverable_node_timeout = {{ recoverable_node_timeout }}
[filter:tempauth]
use = egg:swift#tempauth
user_system_root = testpass .admin https://{{ proxy_ip }}:8080/v1/AUTH_system
[filter:healthcheck]
use = egg:swift#healthcheck
[filter:cache]
use = egg:swift#memcache
memcache_servers = {{ memcached_ip }}:11211
[filter:account-quotas]
use = egg:swift#account_quotas
[filter:container-quotas]
use = egg:swift#container_quotas
[filter:proxy-logging]
use = egg:swift#proxy_logging
[filter:staticweb]
use = egg:swift#staticweb
[filter:bulk]
use = egg:swift#bulk
[filter:slo]
use = egg:swift#slo
{% if static_large_object_segments and static_large_object_segments > 0 %}
max_manifest_size = 536870912
max_manifest_segments = {{ static_large_object_segments }}
{% endif %}
[filter:dlo]
use = egg:swift#dlo
[filter:formpost]
use = egg:swift#formpost
[filter:tempurl]
use = egg:swift#tempurl
[filter:catch_errors]
use = egg:swift#catch_errors
[filter:versioned_writes]
use = egg:swift#versioned_writes
[filter:container_sync]
use = egg:swift#container_sync
[filter:gatekeeper]
use = egg:swift#gatekeeper
[filter:ratelimit]
use = egg:swift#ratelimit
[filter:copy]
use = egg:swift#copy
[filter:symlink]
use = egg:swift#symlink
{% if auth_type == 'keystone' %}
[filter:keystoneauth]
use = egg:swift#keystoneauth
operator_roles = {{ operator_roles }}
[filter:authtoken]
paste.filter_factory = keystonemiddleware.auth_token:filter_factory
identity_uri = {{ auth_protocol }}://{{ keystone_host }}:{{ auth_port }}
auth_uri = {{ service_protocol }}://{{ service_host }}:{{ service_port }}
auth_plugin = password
auth_url = {{ auth_protocol }}://{{ keystone_host }}:{{ auth_port }}
auth_version = 3
username = {{ service_user }}
password = {{ service_password }}
project_domain_name = {{ admin_domain_name }}
user_domain_name = {{ admin_domain_name }}
project_name = {{ admin_tenant_name }}
delay_auth_decision = {{ delay_auth_decision|lower }}
signing_dir = {{ signing_dir }}
cache = swift.cache
[filter:s3token]
use = egg:swift#s3token
auth_uri = {{ auth_protocol }}://{{ keystone_host }}:{{ auth_port }}
auth_version = 3
[filter:s3api]
use = egg:swift#s3api
{% endif %}
{% if auth_type == 'swauth' %}
[filter:swauth]
use = egg:swauth#swauth
set log_name = swauth
super_admin_key = {{ swauth_admin_key }}
default_swift_cluster = local#https://{{ proxy_ip }}:8080/v1
{% endif %}
{% if transport_url -%}
[filter:ceilometer]
paste.filter_factory = ceilometermiddleware.swift:filter_factory
url = {{ transport_url }}
driver = messagingv2
topic = notifications
log_level = WARN
{% endif -%}

View File

@ -65,7 +65,8 @@ class SwiftProxyBasicDeployment(OpenStackAmuletDeployment):
{'name': 'percona-cluster'},
{'name': 'keystone'},
{'name': 'glance'},
{'name': 'swift-storage'}
{'name': 'swift-storage',
'storage': {'block-devices': 'cinder,10G'}},
]
super(SwiftProxyBasicDeployment, self)._add_services(this_service,
other_services)
@ -95,9 +96,6 @@ class SwiftProxyBasicDeployment(OpenStackAmuletDeployment):
}
swift_storage_config = {
'zone': '1',
'block-device': 'vdb',
'overwrite': 'true',
'ephemeral-unmount': '/mnt'
}
pxc_config = {
'innodb-buffer-pool-size': '256M',
@ -366,7 +364,7 @@ class SwiftProxyBasicDeployment(OpenStackAmuletDeployment):
'object_port': '6000',
'container_port': '6001',
'private-address': u.valid_ip,
'device': 'vdb'
'device': 'vdd'
}
ret = u.validate_relation_data(unit, relation, expected)

View File

@ -552,3 +552,47 @@ class SwiftUtilsTestCase(unittest.TestCase):
swift_utils.clear_storage_rings_available()
mock_relation_set.assert_called_once_with(
relation_id='storage:0', rings_url=None)
def test_determine_packages(self):
self.assertEqual(
['swift',
'swift-proxy',
'memcached',
'apache2',
'python-keystone'],
swift_utils.determine_packages('essex')
)
self.assertEqual(
['swift',
'swift-proxy',
'memcached',
'apache2',
'python-keystone',
'swift-plugin-s3',
'swauth'],
swift_utils.determine_packages('folsom')
)
self.assertEqual(
['swift',
'swift-proxy',
'memcached',
'apache2',
'python-keystone',
'swift-plugin-s3',
'swauth',
'python-ceilometermiddleware'],
swift_utils.determine_packages('mitaka')
)
self.assertEqual(
['swift',
'swift-proxy',
'memcached',
'apache2',
'python-keystone',
'swauth',
'python-ceilometermiddleware'],
swift_utils.determine_packages('rocky')
)