Add swift to glance group

* Add swift to glance group for proper upgrade process
* Change swift rsync group
* Revert Iea6ce51d6ed9fe42bba1b26b58ba43268a7f880c

Change-Id: I57b4dbaf9838c15612d60846ae27b0fdd01409cc
Closes-Bug: 1619282
Closes-Bug: 1647480
(cherry picked from commit 6611159b3d)
This commit is contained in:
Oleksiy Molchanov 2016-10-05 17:46:04 +03:00 committed by Stanislaw Bogatkin
parent eb9d3be713
commit 7bb9fd2c24
4 changed files with 10 additions and 37 deletions

View File

@ -49,6 +49,7 @@ class openstack_tasks::swift::parts::storage_node (
$qpid_user = 'nova',
$qpid_nodes = ['127.0.0.1'],
$log_facility = 'LOG_LOCAL2',
$rsync_group = 'glance',
) {
if !defined(Class['swift']) {
class { 'swift':
@ -86,16 +87,18 @@ class openstack_tasks::swift::parts::storage_node (
# override log_name defaults for Swift::Storage::Server
# TODO (adidenko) move this into Hiera when it's ready
Swift::Storage::Server <| title == '6000' |> {
group => $rsync_group,
log_name => 'swift-object-server',
}
Swift::Storage::Server <| title == '6001' |> {
group => $rsync_group,
log_name => 'swift-container-server',
allow_versions => true,
}
Swift::Storage::Server <| title == '6002' |> {
group => $rsync_group,
log_name => 'swift-account-server',
}
Swift::Storage::Server <| |> {
incoming_chmod => $incoming_chmod,
outgoing_chmod => $outgoing_chmod,

View File

@ -148,13 +148,13 @@ class openstack_tasks::swift::proxy_storage {
if !defined(File['/var/lib/glance']) {
file {'/var/lib/glance':
ensure => 'directory',
group => 'swift',
group => 'glance',
require => Package['swift'],
} -> Service <| tag == 'swift-service' |>
} else {
File['/var/lib/glance'] {
ensure => 'directory',
group => 'swift',
group => 'glance',
require +> Package['swift'],
}
File['/var/lib/glance'] -> Service <| tag == 'swift-service' |>
@ -193,6 +193,9 @@ class openstack_tasks::swift::proxy_storage {
}
}
# We need this line for proper upgrade process LP#1619282
User <| title == swift |> { groups +> ['glance'] }
# swift_container_sync_realms file specifying
# the allowable clusters and their information.
# Changes in this file don't require restart services.

View File

@ -30,37 +30,4 @@ class osnailyfacter::upgrade::pkg_upgrade {
Exec['remove_policy'] ->
Service['pacemaker']
}
if roles_include(['controller', 'primary-controller']) {
$storage_hash = hiera_hash('storage', {})
if (!$storage_hash['images_ceph'] and !$storage_hash['objects_ceph'] and !$storage_hash['images_vcenter']) {
# Glance package update changes permissions for /var/lib/glance and makes
# it and its subdirectories owned by glance:glance (it executes in postinst stage).
# We use /var/lib/glance/node as swift storage, and we need to allow
# swift user to write into this directory. We should update all subdirectories
# in /var/lib/glance/node to be owned by swift:swift. This should be applied right
# after glance package update to decrease swift service downtime to minimum.
# Swift services restart isn't required.
$swift_partition = hiera('swift_partition', '/var/lib/glance/node')
if $swift_partition =~ /\/var\/lib\/glance\// {
# We can't use 'file' resource because we need to be sure that swift user and
# group exist. They could be absent in case of adding new controller node
# for already upgraded environment.
exec { '/var/lib/glance/':
command => 'chgrp swift /var/lib/glance/',
onlyif => 'getent group swift && test -d /var/lib/glance/',
path => ['/bin/', '/usr/bin/'],
logoutput => 'on_failure',
} ->
exec { $swift_partition:
command => "chown -R swift:swift ${swift_partition}",
onlyif => "getent passwd swift && test -d ${swift_partition}",
path => ['/bin/', '/usr/bin/'],
logoutput => 'on_failure',
}
}
}
}
}

View File

@ -135,7 +135,7 @@ describe manifest do
it 'should allow swift user to write into /var/lib/glance directory' do
should contain_file('/var/lib/glance').with(
'ensure' => 'directory',
'group' => 'swift',
'group' => 'glance',
).that_requires('Package[swift]')
end
end