4bf861c76c
A while back I added an lvm.conf file with a device filter setting
to try and clean up the LVM hangs in the gate:
(commit 0b9e76f280
)
It turns out this wasn't the real problem, the real problem
is that on an LVS/VGS command LVM will attempt to open and read
all potential block devices in /dev to see if they have LVM data
on them. I initially thought the local filter would keep that
from happening, as it turns out the local filter only limits what's
returned AFTER the actual scan process. In order to keep the scan
from happening at all, either a global_filter needs to be used or
lvmetad needs to be running and enabled.
There are situations in gate tests where /dev/sdX devices are created and
deleted and the result is that we hit situations where LVM tries
to open up devices to check them even if they've been removed. The
result is we have a blocking open call from LVM that takes approx
60 seconds to time out and fail.
Ubuntu won't have a version of lvmetad until Vivid, so for now
that just leaves the global_filter as an option.
This patch adds the filter routine to the end of stack.sh. We don't
want to put the routine in lib/cinder_backend/lvm like we had it because
now we have to set the global filter for all LVM commands on the system.
So we put this as one of the last steps in stack.sh and run it if Cinder
is enabled. This way we can query PV's on the system regardless of what
other services may be running and using LVM and make sure that all of
their devices are added to the filter as well.
Also, make sure we only set this for Ubuntu as Fedora/RHEL variants
utilize lvmetad.
This patch also removes the old change that set the local filter.
DocImpact
Should add this to recommended config for Cinder on systems
that don't have lvmetad, and recommend lvmetad for those that do.
Change-Id: I5d5c48e188cbb9b4208096736807f082bce524e8
Closes-Bug: #1373513
73 lines
1.8 KiB
Bash
73 lines
1.8 KiB
Bash
#!/bin/bash
|
|
#
|
|
# lib/cinder_backends/lvm
|
|
# Configure the LVM backend
|
|
|
|
# Enable with:
|
|
#
|
|
# CINDER_ENABLED_BACKENDS+=,lvm:lvmname
|
|
|
|
# Dependencies:
|
|
#
|
|
# - ``functions`` file
|
|
# - ``cinder`` configurations
|
|
|
|
# CINDER_CONF
|
|
# DATA_DIR
|
|
# VOLUME_GROUP_NAME
|
|
|
|
# clean_cinder_backend_lvm - called from clean_cinder()
|
|
# configure_cinder_backend_lvm - called from configure_cinder()
|
|
# init_cinder_backend_lvm - called from init_cinder()
|
|
|
|
|
|
# Save trace setting
|
|
MY_XTRACE=$(set +o | grep xtrace)
|
|
set +o xtrace
|
|
|
|
|
|
# TODO: resurrect backing device...need to know how to set values
|
|
#VOLUME_BACKING_DEVICE=${VOLUME_BACKING_DEVICE:-}
|
|
|
|
# Entry Points
|
|
# ------------
|
|
|
|
# cleanup_cinder_backend_lvm - Delete volume group and remove backing file
|
|
# cleanup_cinder_backend_lvm $be_name
|
|
function cleanup_cinder_backend_lvm {
|
|
local be_name=$1
|
|
|
|
# Campsite rule: leave behind a volume group at least as clean as we found it
|
|
clean_lvm_volume_group $VOLUME_GROUP_NAME-$be_name
|
|
}
|
|
|
|
# configure_cinder_backend_lvm - Set config files, create data dirs, etc
|
|
# configure_cinder_backend_lvm $be_name
|
|
function configure_cinder_backend_lvm {
|
|
local be_name=$1
|
|
|
|
iniset $CINDER_CONF $be_name volume_backend_name $be_name
|
|
iniset $CINDER_CONF $be_name volume_driver "cinder.volume.drivers.lvm.LVMVolumeDriver"
|
|
iniset $CINDER_CONF $be_name volume_group $VOLUME_GROUP_NAME-$be_name
|
|
iniset $CINDER_CONF $be_name iscsi_helper "tgtadm"
|
|
|
|
if [[ "$CINDER_SECURE_DELETE" == "False" ]]; then
|
|
iniset $CINDER_CONF $be_name volume_clear none
|
|
fi
|
|
}
|
|
|
|
# init_cinder_backend_lvm - Initialize volume group
|
|
# init_cinder_backend_lvm $be_name
|
|
function init_cinder_backend_lvm {
|
|
local be_name=$1
|
|
|
|
# Start with a clean volume group
|
|
init_lvm_volume_group $VOLUME_GROUP_NAME-$be_name $VOLUME_BACKING_FILE_SIZE
|
|
}
|
|
|
|
# Restore xtrace
|
|
$MY_XTRACE
|
|
|
|
# mode: shell-script
|
|
# End:
|