VStorage: fixed permissions on shares config file
* Shares config file may contain cluster password, thus we need to set correct permissions on that. * manage_package option is introduced. * Don't ensure, that log directory exists. Log directory is created when vstorage-client rpm is installed. Change-Id: I1a84f106ab2fb40615f447021adc991349b86adf Signed-off-by: Pavel Glushchak <pglushchak@virtuozzo.com>
This commit is contained in:
parent
541ecbed32
commit
2795dca86a
|
@ -52,6 +52,10 @@
|
|||
# (optional) Mount permissions.
|
||||
# Defaults to: 0770
|
||||
#
|
||||
# [*manage_package*]
|
||||
# (optional) Ensures VStorage client package is installed if true.
|
||||
# Defaults to: true
|
||||
#
|
||||
define cinder::backend::vstorage (
|
||||
$cluster_name,
|
||||
$cluster_password,
|
||||
|
@ -65,6 +69,7 @@ define cinder::backend::vstorage (
|
|||
$mount_user = 'cinder',
|
||||
$mount_group = 'root',
|
||||
$mount_permissions = '0770',
|
||||
$manage_package = true,
|
||||
) {
|
||||
|
||||
include ::cinder::deps
|
||||
|
@ -86,21 +91,20 @@ define cinder::backend::vstorage (
|
|||
}
|
||||
}
|
||||
|
||||
package { 'vstorage-client':
|
||||
ensure => present,
|
||||
tag => 'cinder-support-package',
|
||||
if $manage_package {
|
||||
package { 'vstorage-client':
|
||||
ensure => present,
|
||||
tag => 'cinder-support-package',
|
||||
}
|
||||
}
|
||||
|
||||
$mount_opts = ['-u', $mount_user, '-g', $mount_group, '-m', $mount_permissions]
|
||||
|
||||
file { $shares_config_path:
|
||||
content => inline_template("${cluster_name}:${cluster_password} <%= @mount_opts %>"),
|
||||
require => Anchor['cinder::install::end'],
|
||||
notify => Anchor['cinder::service::begin'],
|
||||
}
|
||||
|
||||
file { '/var/log/pstorage':
|
||||
ensure => 'directory',
|
||||
owner => 'root',
|
||||
group => 'cinder',
|
||||
mode => '0640',
|
||||
require => Anchor['cinder::install::end'],
|
||||
notify => Anchor['cinder::service::begin'],
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ describe 'cinder::backend::vstorage' do
|
|||
|
||||
let :params do
|
||||
{
|
||||
:cluster_name => 'vstorage',
|
||||
:cluster_name => 'stor1',
|
||||
:cluster_password => 'passw0rd',
|
||||
:shares_config_path => '/etc/cinder/vstorage_shares.conf',
|
||||
:use_sparsed_volumes => true,
|
||||
|
@ -16,6 +16,7 @@ describe 'cinder::backend::vstorage' do
|
|||
:mount_user => 'cinder',
|
||||
:mount_group => 'root',
|
||||
:mount_permissions => '0770',
|
||||
:manage_package => true,
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -43,15 +44,10 @@ describe 'cinder::backend::vstorage' do
|
|||
|
||||
it 'creates shares config file' do
|
||||
is_expected.to contain_file('/etc/cinder/vstorage_shares.conf').with_content(
|
||||
"vstorage:passw0rd [\"-u\", \"cinder\", \"-g\", \"root\", \"-m\", \"0770\"]"
|
||||
"stor1:passw0rd [\"-u\", \"cinder\", \"-g\", \"root\", \"-m\", \"0770\"]"
|
||||
)
|
||||
end
|
||||
|
||||
it 'creates log directory' do
|
||||
is_expected.to contain_file('/var/log/pstorage').with(
|
||||
:ensure => 'directory')
|
||||
end
|
||||
|
||||
context 'vstorage backend with cinder type' do
|
||||
before do
|
||||
params.merge!({:manage_volume_type => true})
|
||||
|
|
Loading…
Reference in New Issue