Add a configurable delay to Nova Evacuate calls

Add a configurable delay to Nova Evacuate calls

In case /var/lib/nova/instances resides on NFS we have seen migrations
failing with 'Failed to get "write" lock - Is another process using the
image' errors.

This has been tracked down to grace/lease timeouts not having expired
before attempting the migration/evacuate, so in this cases it might be
desirable to delay the nova evacuate call to give the storage time to
release the locks.

Related resource-agents change: https://review.opendev.org/#/c/684777/

NB: cherry-pick not 100% clean due to missing I00d4f97cd24f7c36eeb0a29f9c91422cf7ded3ee
    (Add region support for instance HA). As there are no current plans
    to backport that, we chose to adapt this review instead

Change-Id: I5ec6a5b0c66579e068e811f49aae10a5f406158a
Resolves: rhbz#1740069
(cherry picked from commit 72487d804e)
This commit is contained in:
Luca Miccini 2019-09-25 17:28:39 +02:00
parent 4b48d5a856
commit e5d3d2269b
1 changed files with 11 additions and 1 deletions

View File

@ -56,6 +56,10 @@
# Variable that defines the no_shared_storage for the nova evacuate resource
# Defaults to hiera('tripleo::instanceha::no_shared_storage', true)
#
# [*evacuate_delay*]
# (Optional) Integer, seconds to wait before starting the nova evacuate
# Defaults to hiera('tripleo::instanceha::evacuate_delay', 0)
#
class tripleo::profile::base::pacemaker::instance_ha (
$step = Integer(hiera('step')),
$pcs_tries = hiera('pcs_tries', 20),
@ -66,6 +70,7 @@ class tripleo::profile::base::pacemaker::instance_ha (
$user_domain = hiera('nova::keystone::authtoken::user_domain_name', 'Default'),
$project_domain = hiera('nova::keystone::authtoken::project_domain_name', 'Default'),
$no_shared_storage = hiera('tripleo::instanceha::no_shared_storage', true),
$evacuate_delay = hiera('tripleo::instanceha::evacuate_delay', 0),
) {
if $step >= 2 {
class { '::pacemaker::resource_defaults':
@ -111,10 +116,15 @@ class tripleo::profile::base::pacemaker::instance_ha (
} else {
$iha_no_shared_storage = 'no_shared_storage=false'
}
if $evacuate_delay > 0 {
$evacuate_param = " evacuate_delay=${evacuate_delay}"
} else {
$evacuate_param = ''
}
pacemaker::resource::ocf { 'nova-evacuate':
ocf_agent_name => 'openstack:NovaEvacuate',
# lint:ignore:140chars
resource_params => "auth_url=${keystone_endpoint_url} username=${keystone_admin} password=${keystone_password} user_domain=${user_domain} project_domain=${project_domain} tenant_name=${keystone_admin} ${iha_no_shared_storage}",
resource_params => "auth_url=${keystone_endpoint_url} username=${keystone_admin} password=${keystone_password} user_domain=${user_domain} project_domain=${project_domain} tenant_name=${keystone_admin} ${iha_no_shared_storage}${evacuate_param}",
# lint:endignore
tries => $pcs_tries,
location_rule => {