Merge "Support cinder-volume running active-active"
This commit is contained in:
commit
e5fa5f7133
@ -86,6 +86,26 @@
|
||||
# (Optional) Name of RBD client
|
||||
# Defaults to hiera('tripleo::profile::base::cinder::volume::rbd::cinder_rbd_user_name')
|
||||
#
|
||||
# [*cinder_volume_cluster*]
|
||||
# (Optional) Name of the cluster when running in active-active mode
|
||||
# Defaults to hiera('tripleo::profile::base::cinder::volume::cinder_volume_cluster')
|
||||
#
|
||||
# [*enable_internal_tls*]
|
||||
# (Optional) Whether TLS in the internal network is enabled or not
|
||||
# Defaults to hiera('enable_internal_tls', false)
|
||||
#
|
||||
# [*etcd_enabled*]
|
||||
# (optional) Whether the etcd service is enabled or not
|
||||
# Defaults to hiera('etcd_enabled', false)
|
||||
#
|
||||
# [*etcd_host*]
|
||||
# (optional) IP address (VIP) of the etcd service
|
||||
# Defaults to hiera('etcd_vip', undef)
|
||||
#
|
||||
# [*etcd_port*]
|
||||
# (optional) Port used by the etcd service
|
||||
# Defaults to hiera('tripleo::profile::base::etcd::client_port', '2379')
|
||||
#
|
||||
# [*step*]
|
||||
# (Optional) The current step in deployment. See tripleo-heat-templates
|
||||
# for more details.
|
||||
@ -109,12 +129,43 @@ class tripleo::profile::base::cinder::volume (
|
||||
$cinder_enable_nvmeof_backend = false,
|
||||
$cinder_user_enabled_backends = hiera('cinder_user_enabled_backends', undef),
|
||||
$cinder_rbd_client_name = hiera('tripleo::profile::base::cinder::volume::rbd::cinder_rbd_user_name','openstack'),
|
||||
$cinder_volume_cluster = hiera('tripleo::profile::base::cinder::volume::cinder_volume_cluster', ''),
|
||||
$enable_internal_tls = hiera('enable_internal_tls', false),
|
||||
$etcd_enabled = hiera('etcd_enabled', false),
|
||||
$etcd_host = hiera('etcd_vip', undef),
|
||||
$etcd_port = hiera('tripleo::profile::base::etcd::client_port', '2379'),
|
||||
$step = Integer(hiera('step')),
|
||||
) {
|
||||
include ::tripleo::profile::base::cinder
|
||||
|
||||
if $step >= 4 {
|
||||
include ::cinder::volume
|
||||
if $cinder_volume_cluster == '' {
|
||||
$cinder_volume_cluster_real = undef
|
||||
} else {
|
||||
$cinder_volume_cluster_real = $cinder_volume_cluster
|
||||
}
|
||||
|
||||
if $cinder_volume_cluster_real {
|
||||
unless $etcd_enabled {
|
||||
fail('Running cinder-volume in active-active mode with a cluster name requires the etcd service.')
|
||||
}
|
||||
if empty($etcd_host) {
|
||||
fail('etcd_vip not set in hieradata')
|
||||
}
|
||||
if $enable_internal_tls {
|
||||
$protocol = 'https'
|
||||
} else {
|
||||
$protocol = 'http'
|
||||
}
|
||||
$backend_url = sprintf('etcd3+%s://%s:%s', $protocol, $etcd_host, $etcd_port)
|
||||
class { '::cinder::coordination' :
|
||||
backend_url => $backend_url,
|
||||
}
|
||||
}
|
||||
|
||||
class { '::cinder::volume' :
|
||||
cluster => $cinder_volume_cluster_real,
|
||||
}
|
||||
|
||||
if $cinder_enable_pure_backend {
|
||||
include ::tripleo::profile::base::cinder::volume::pure
|
||||
|
@ -0,0 +1,7 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
Add the ability to configure the cinder-volume service to run in
|
||||
active-active mode using the specified cluster name. Note that
|
||||
active-active mode requires the etcd service be enabled, as it's used by
|
||||
the cinder-volume service for its Distributed Lock Manager (DLM).
|
@ -51,11 +51,16 @@ describe 'tripleo::profile::base::cinder::volume' do
|
||||
is_expected.to contain_class('tripleo::profile::base::cinder::volume::iscsi')
|
||||
is_expected.to contain_class('tripleo::profile::base::cinder::volume')
|
||||
is_expected.to contain_class('tripleo::profile::base::cinder')
|
||||
is_expected.to contain_class('cinder::volume')
|
||||
is_expected.to contain_class('cinder::backends').with(
|
||||
:enabled_backends => ['tripleo_iscsi']
|
||||
)
|
||||
end
|
||||
it 'should not configure cinder-volume for A/A mode' do
|
||||
is_expected.to contain_class('cinder::volume').with(
|
||||
:cluster => '<SERVICE DEFAULT>',
|
||||
)
|
||||
is_expected.to_not contain_class('cinder::coordination')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with only pure' do
|
||||
@ -262,10 +267,53 @@ describe 'tripleo::profile::base::cinder::volume' do
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with a cluster name' do
|
||||
before :each do
|
||||
params.merge!({
|
||||
:cinder_volume_cluster => 'tripleo-cluster',
|
||||
:etcd_enabled => true,
|
||||
:etcd_host => '127.0.0.1',
|
||||
})
|
||||
end
|
||||
it 'should configure cinder-volume for A/A mode' do
|
||||
is_expected.to contain_class('cinder::volume').with(
|
||||
:cluster => 'tripleo-cluster',
|
||||
)
|
||||
is_expected.to contain_class('cinder::coordination').with(
|
||||
:backend_url => 'etcd3+http://127.0.0.1:2379',
|
||||
)
|
||||
end
|
||||
|
||||
context 'with internal tls enabled' do
|
||||
before :each do
|
||||
params.merge!({
|
||||
:enable_internal_tls => true,
|
||||
})
|
||||
end
|
||||
it 'should configure coordination backend_url with https' do
|
||||
is_expected.to contain_class('cinder::coordination').with(
|
||||
:backend_url => 'etcd3+https://127.0.0.1:2379',
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with etcd service not enabled' do
|
||||
before :each do
|
||||
params.merge!({
|
||||
:etcd_enabled => false,
|
||||
})
|
||||
end
|
||||
it 'should fail to deploy' do
|
||||
is_expected.to compile.and_raise_error(
|
||||
/Running cinder-volume in active-active mode with a cluster name requires the etcd service./
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
on_supported_os.each do |os, facts|
|
||||
context 'on #{os}' do
|
||||
let(:facts) do
|
||||
|
Loading…
Reference in New Issue
Block a user