Set swift_partition to /var/lib/glance/node by default

We had an ability to set swift partition in modular
script, but it was removed in this commit:
Ia2428b49a7192a2d7d56ffdc61a75de9ebc816c9

We should use /var/lib/glance/node as swift partition
by default as it was before and provide access
to this folder for swift user.
Also noop tests were added to cover this parameter.

Change-Id: Ic38c726d5ae9fff1815e6a8b4158549c09cec84c
Closes-bug: #1508482
This commit is contained in:
iberezovskiy 2015-10-28 16:07:13 +03:00
parent 39ae65b082
commit 77316ef284
2 changed files with 34 additions and 0 deletions

View File

@ -43,8 +43,24 @@ if !($storage_hash['images_ceph'] and $storage_hash['objects_ceph']) and !$stora
$master_swift_proxy_nodes_list = values($master_swift_proxy_nodes)
$master_swift_proxy_ip = regsubst($master_swift_proxy_nodes_list[0]['network_roles']['swift/api'], '\/\d+$', '')
$master_swift_replication_ip = regsubst($master_swift_proxy_nodes_list[0]['network_roles']['swift/replication'], '\/\d+$', '')
$swift_partition = hiera('swift_partition', '/var/lib/glance/node')
if ($deploy_swift_storage){
if !defined(File['/var/lib/glance']) {
file {'/var/lib/glance':
ensure => 'directory',
group => 'swift',
require => Package['swift'],
} -> Service <| tag == 'swift-service' |>
} else {
File['/var/lib/glance'] {
ensure => 'directory',
group => 'swift',
require +> Package['swift'],
}
File['/var/lib/glance'] -> Service <| tag == 'swift-service' |>
}
class { 'openstack::swift::storage_node':
storage_type => false,
loopback_size => '5243780',

View File

@ -27,6 +27,16 @@ describe manifest do
# Swift
if !(storage_hash['images_ceph'] and storage_hash['objects_ceph']) and !storage_hash['images_vcenter']
swift_partition = Noop.hiera 'swift_partition'
if !swift_partition
swift_partition = '/var/lib/glance/node'
it 'should allow swift user to write into /var/lib/glance directory' do
should contain_file('/var/lib/glance').with(
'ensure' => 'directory',
'group' => 'swift',
).that_requires('Package[swift]')
end
end
if role == 'primary-controller'
['account', 'object', 'container'].each do | ring |
it "should run rebalancing swift #{ring} ring" do
@ -84,6 +94,14 @@ describe manifest do
'only_from' => "127.0.0.1 240.0.0.2 #{sto_nets} #{man_nets}",
).that_requires('Class[openstack::swift::proxy]')
}
it 'should configure swift on separate partition' do
should contain_file(swift_partition).with(
'ensure' => 'directory',
'owner' => 'swift',
'group' => 'swift',
)
end
end
end
test_ubuntu_and_centos manifest