Ensure swift-container-sync service is enabled

* The ubuntu cloud packages are missing an upstart config
and /etc/init.d wrapper for the swift-container-sync service.
This adds them if missing on the ubuntu platform so that we can
start this service successfully.
* Ensure the swift-container-sync is enabled and running
when allowed_sync_hosts is defined
* Swauth requires its own separate declaration of
allowed_sync_hosts in the proxy configuration as well

Change-Id: I638d43445edfd1f9519911212942ac8d69d4fff2
This commit is contained in:
Alan Meadows
2013-11-11 10:20:17 -08:00
parent 2a522aedfb
commit 2945ea4a1f
6 changed files with 64 additions and 2 deletions

View File

@@ -2,6 +2,10 @@
This file is used to list changes made in each version of cookbook-openstack-object-storage. This file is used to list changes made in each version of cookbook-openstack-object-storage.
## 7.0.11:
* Add missing swift-container-sync upstart service which is
not setup by default in ubuntu 12.04 packages
## 7.0.10: ## 7.0.10:
* Do not role restrict super_admin_key in proxy config * Do not role restrict super_admin_key in proxy config
* Case correct swauth_version attribute in proxy recipe * Case correct swauth_version attribute in proxy recipe

View File

@@ -0,0 +1,19 @@
# swift-container-sync - SWIFT Container Sync
#
# The swift container sync.
description "SWIFT Container Sync"
author "Sergio Rubio <rubiojr@bvox.net>"
start on runlevel [2345]
stop on runlevel [016]
pre-start script
if [ -f "/etc/swift/container-server.conf" ]; then
exec /usr/bin/swift-init container-sync start
else
exit 1
fi
end script
post-stop exec /usr/bin/swift-init container-sync stop

View File

@@ -3,7 +3,7 @@ maintainer "ATT, Inc."
license "Apache 2.0" license "Apache 2.0"
description "Installs and configures Openstack Swift" description "Installs and configures Openstack Swift"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "7.0.10" version "7.0.11"
recipe "openstack-object-storage::setup", "Does initial setup of a swift cluster" recipe "openstack-object-storage::setup", "Does initial setup of a swift cluster"
recipe "openstack-object-storage::account-server", "Installs the swift account server" recipe "openstack-object-storage::account-server", "Installs the swift account server"
recipe "openstack-object-storage::object-server", "Installs the swift object server" recipe "openstack-object-storage::object-server", "Installs the swift object server"

View File

@@ -91,3 +91,31 @@ template "/etc/swift/container-server.conf" do
notifies :restart, "service[swift-container-updater]", :immediately notifies :restart, "service[swift-container-updater]", :immediately
notifies :restart, "service[swift-container-auditor]", :immediately notifies :restart, "service[swift-container-auditor]", :immediately
end end
# Ubuntu 12.04 packages are missing the swift-container-sync service scripts
# See https://bugs.launchpad.net/cloud-archive/+bug/1250171
if platform?("ubuntu")
cookbook_file "/etc/init/swift-container-sync.conf" do
owner "root"
group "root"
mode "0755"
source "swift-container-sync.conf.upstart"
action :create
not_if "[ -e /etc/init/swift-container-sync.conf ]"
end
link "/etc/init.d/swift-container-sync" do
to "/lib/init/upstart-job"
not_if "[ -e /etc/init.d/swift-container-sync ]"
end
end
service_name=platform_options["service_prefix"] + 'swift-container-sync' + platform_options["service_suffix"]
unless node["swift"]["container-server"]["allowed_sync_hosts"] == []
service "swift-container-sync" do
service_name service_name
provider platform_options["service_provider"]
supports :status => false, :restart => true
action [:enable, :start]
only_if "[ -e /etc/swift/container-server.conf ] && [ -e /etc/swift/container.ring.gz ]"
end
end

View File

@@ -35,7 +35,7 @@ describe 'openstack-object-storage::container-server' do
end end
it "starts swift container services on boot" do it "starts swift container services on boot" do
%w{swift-container swift-container-auditor swift-container-replicator swift-container-updater}.each do |svc| %w{swift-container swift-container-auditor swift-container-replicator swift-container-updater swift-container-sync}.each do |svc|
expect(@chef_run).to set_service_to_start_on_boot svc expect(@chef_run).to set_service_to_start_on_boot svc
end end
end end
@@ -61,6 +61,14 @@ describe 'openstack-object-storage::container-server' do
end end
it "should create container sync upstart conf for ubuntu" do
expect(@chef_run).to create_cookbook_file "/etc/init/swift-container-sync.conf"
end
it "should create container sync init script for ubuntu" do
expect(@chef_run).to create_link "/etc/init.d/swift-container-sync"
end
describe "/etc/swift/container-server.conf" do describe "/etc/swift/container-server.conf" do
before do before do

View File

@@ -112,6 +112,9 @@ default_swift_cluster = local#<%= node[:swift][:swift_url] %>
allow_overrides = true allow_overrides = true
<% end %> <% end %>
<% end %> <% end %>
<% if node["swift"]["container-server"]["allowed_sync_hosts"] -%>
allowed_sync_hosts = <%= node["swift"]["container-server"]["allowed_sync_hosts"].join(",") %>
<% end %>
[filter:healthcheck] [filter:healthcheck]
use = egg:swift#healthcheck use = egg:swift#healthcheck