Add Quota middlewares support

Two middlewares exist for managing quotas:
- account_quotas
- container_quotas

Change-Id: Ic6d539db480d8749769279b44e1f38302ac0fa62
Signed-off-by: Emilien Macchi <emilien.macchi@enovance.com>
This commit is contained in:
Emilien Macchi 2013-10-29 16:02:20 +01:00
parent 9e110e8c8e
commit 4157cb9a41
7 changed files with 152 additions and 0 deletions

View File

@ -0,0 +1,27 @@
#
# Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
#
# Author: Emilien Macchi <emilien.macchi@enovance.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Configure Swift Account Quotas
#
class swift::proxy::account_quotas() {
concat::fragment { 'swift_proxy_account_quotas':
target => '/etc/swift/proxy-server.conf',
content => template('swift/proxy/account_quotas.conf.erb'),
order => '80',
}
}

View File

@ -0,0 +1,27 @@
#
# Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
#
# Author: Emilien Macchi <emilien.macchi@enovance.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Configure Swift Container Quotas
#
class swift::proxy::container_quotas() {
concat::fragment { 'swift_proxy_container_quotas':
target => '/etc/swift/proxy-server.conf',
content => template('swift/proxy/container_quotas.conf.erb'),
order => '81',
}
}

View File

@ -0,0 +1,43 @@
#
# Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
#
# Author: Emilien Macchi <emilien.macchi@enovance.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Tests for swift::proxy::account_quotas
#
require 'spec_helper'
describe 'swift::proxy::account_quotas' do
let :facts do
{
:concat_basedir => '/var/lib/puppet/concat'
}
end
let :pre_condition do
'class { "concat::setup": }
concat { "/etc/swift/proxy-server.conf": }'
end
let :fragment_file do
"/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/80_swift_proxy_account_quotas"
end
it { should contain_file(fragment_file).with_content(/\[filter:account-quotas\]/) }
it { should contain_file(fragment_file).with_content(/use = egg:swift#account_quotas/) }
end

View File

@ -0,0 +1,43 @@
#
# Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
#
# Author: Emilien Macchi <emilien.macchi@enovance.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Tests for swift::proxy::container_quotas
#
require 'spec_helper'
describe 'swift::proxy::container_quotas' do
let :facts do
{
:concat_basedir => '/var/lib/puppet/concat'
}
end
let :pre_condition do
'class { "concat::setup": }
concat { "/etc/swift/proxy-server.conf": }'
end
let :fragment_file do
"/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/81_swift_proxy_container_quotas"
end
it { should contain_file(fragment_file).with_content(/\[filter:container-quotas\]/) }
it { should contain_file(fragment_file).with_content(/use = egg:swift#container_quotas/) }
end

View File

@ -0,0 +1,4 @@
[filter:account-quotas]
use = egg:swift#account_quotas

View File

@ -0,0 +1,4 @@
[filter:container-quotas]
use = egg:swift#container_quotas

View File

@ -191,6 +191,8 @@ node /swift-proxy/ inherits swift_base {
's3token', 's3token',
'authtoken', 'authtoken',
'keystone', 'keystone',
'account_quotas',
'container_quotas',
'proxy-server' 'proxy-server'
], ],
account_autocreate => true, account_autocreate => true,
@ -200,7 +202,9 @@ node /swift-proxy/ inherits swift_base {
# configure all of the middlewares # configure all of the middlewares
class { [ class { [
'swift::proxy::account_quotas',
'swift::proxy::catch_errors', 'swift::proxy::catch_errors',
'swift::proxy::container_quotas',
'swift::proxy::healthcheck', 'swift::proxy::healthcheck',
'swift::proxy::cache', 'swift::proxy::cache',
'swift::proxy::swift3', 'swift::proxy::swift3',