Force cinder properties to be set on ly on nodes with pcmk on it

When using the BlockStorage role there is one cinder volume per node and
those are not managed by pcmk. So when we force the property for all
nodes that have cinder_volume we will fail because pcmk is not running
on those nodes. Let's not set properties for nodes that are not running
pacemaker.

While we're at it let's remove *_nodes_count which are not used anyway.

Closes-Bug: #1786412

Change-Id: I42e9f3244bad60b5df2dfa940f132f72c606620e
This commit is contained in:
Michele Baldessari 2018-08-02 08:36:52 +02:00
parent 451e76b5f8
commit 81d4dfa7e0
5 changed files with 14 additions and 14 deletions

View File

@ -62,7 +62,9 @@ class tripleo::profile::pacemaker::cinder::backup_bundle (
if $step >= 2 and $pacemaker_master {
$cinder_backup_short_node_names = hiera('cinder_backup_short_node_names')
$cinder_backup_short_node_names.each |String $node_name| {
$pacemaker_short_node_names = hiera('pacemaker_short_node_names')
$pcmk_cinder_backup_nodes = intersection($cinder_backup_short_node_names, $pacemaker_short_node_names)
$pcmk_cinder_backup_nodes.each |String $node_name| {
pacemaker::property { "cinder-backup-role-${node_name}":
property => 'cinder-backup-role',
value => true,
@ -75,8 +77,6 @@ class tripleo::profile::pacemaker::cinder::backup_bundle (
if $step >= 5 {
if $pacemaker_master {
$cinder_backup_nodes_count = count(hiera('cinder_backup_short_node_names', []))
$docker_vol_arr = delete(any2array($docker_volumes), '').flatten()
unless empty($docker_vol_arr) {

View File

@ -62,7 +62,9 @@ class tripleo::profile::pacemaker::cinder::volume_bundle (
if $step >= 2 and $pacemaker_master {
$cinder_volume_short_node_names = hiera('cinder_volume_short_node_names')
$cinder_volume_short_node_names.each |String $node_name| {
$pacemaker_short_node_names = hiera('pacemaker_short_node_names')
$pcmk_cinder_volume_nodes = intersection($cinder_volume_short_node_names, $pacemaker_short_node_names)
$pcmk_cinder_volume_nodes.each |String $node_name| {
pacemaker::property { "cinder-volume-role-${node_name}":
property => 'cinder-volume-role',
value => true,
@ -75,8 +77,6 @@ class tripleo::profile::pacemaker::cinder::volume_bundle (
if $step >= 5 {
if $pacemaker_master {
$cinder_volume_nodes_count = count(hiera('cinder_volume_short_node_names', []))
$docker_vol_arr = delete(any2array($docker_volumes), '').flatten()
unless empty($docker_vol_arr) {

View File

@ -36,8 +36,8 @@ describe 'tripleo::profile::pacemaker::cinder::backup_bundle' do
} }
it 'should create pacemaker properties' do
is_expected.to contain_pacemaker__property('cinder-backup-role-c-bak-1')
is_expected.to contain_pacemaker__property('cinder-backup-role-c-bak-2')
is_expected.to contain_pacemaker__property('cinder-backup-role-node.example.com')
is_expected.to_not contain_pacemaker__property('cinder-backup-role-c-bak-2')
end
end
@ -48,7 +48,7 @@ describe 'tripleo::profile::pacemaker::cinder::backup_bundle' do
} }
it 'should not create pacemaker properties' do
is_expected.to_not contain_pacemaker__property('cinder-backup-role-c-bak-1')
is_expected.to_not contain_pacemaker__property('cinder-backup-role-node.example.com')
is_expected.to_not contain_pacemaker__property('cinder-backup-role-c-bak-2')
end
end

View File

@ -41,8 +41,8 @@ describe 'tripleo::profile::pacemaker::cinder::volume_bundle' do
} }
it 'should create pacemaker properties' do
is_expected.to contain_pacemaker__property('cinder-volume-role-c-vol-1')
is_expected.to contain_pacemaker__property('cinder-volume-role-c-vol-2')
is_expected.to contain_pacemaker__property('cinder-volume-role-node.example.com')
is_expected.to_not contain_pacemaker__property('cinder-volume-role-c-vol-2')
end
end
@ -53,7 +53,7 @@ describe 'tripleo::profile::pacemaker::cinder::volume_bundle' do
} }
it 'should not create pacemaker properties' do
is_expected.to_not contain_pacemaker__property('cinder-volume-role-c-vol-1')
is_expected.to_not contain_pacemaker__property('cinder-volume-role-node.example.com')
is_expected.to_not contain_pacemaker__property('cinder-volume-role-c-vol-2')
end
end

View File

@ -28,11 +28,11 @@ ceph::profile::params::rgw_keystone_admin_password: 'keystone_admin_password'
# cinder related items
cinder_backup_short_bootstrap_node_name: 'node.example.com'
cinder_backup_short_node_names:
- 'c-bak-1'
- 'node.example.com'
- 'c-bak-2'
cinder_volume_short_bootstrap_node_name: 'node.example.com'
cinder_volume_short_node_names:
- 'c-vol-1'
- 'node.example.com'
- 'c-vol-2'
cinder::backup::nfs::backup_share: '/mnt/backup'
cinder::rabbit_password: 'password'