Only include LVM loop device in LVM global_filter

The following tempest test is failing regularly in the gate:
tempest.api.compute.volumes.test_attach_volume.AttachVolumeTestJSON.test_list_get_volume_attachments

The theory behind this fix is that tests are creating/deleting /dev/sdX
devices and LVM ends up attempting to open an already removed device which
causes LVM to temporarily block. Setting the global_filter will limit the
block devices that are used by LVM system components.

This adds a new config option config.cinder.loop-device. In not set the
loop device will be generated.

Closes-Bug: #1918306
Change-Id: I8cccf7a1b1af2e15106b11023652af23c7715e6f
This commit is contained in:
Corey Bryant 2021-03-10 13:35:59 -05:00
parent 717f78ffd7
commit 4558b60864
5 changed files with 2142 additions and 2 deletions

View File

@ -42,6 +42,7 @@ def _get_default_config():
'config.network.physnet-name': 'physnet1',
'config.cinder.setup-loop-based-cinder-lvm-backend': False,
'config.cinder.loop-device-file-size': '32G',
'config.cinder.loop-device': 'null',
'config.cinder.lvm-backend-volume-group': 'cinder-volumes',
'config.host.ip-forwarding': False,
'config.host.check-qemu': True,

View File

@ -77,6 +77,7 @@ setup:
neutron_ovn_metadata_agent.ini.j2: "{snap_common}/etc/neutron/neutron_ovn_metadata_agent.ini"
rabbitmq.conf.j2: "{snap_common}/etc/rabbitmq/rabbitmq.config"
iscsid.conf.j2: "{snap_common}/etc/iscsi/iscsid.conf"
lvm.conf.j2: "{snap_common}/etc/lvm/lvm.conf"
# LMA stack templates
telegraf.conf.j2: "{snap_common}/etc/telegraf/telegraf-microstack.conf"
@ -119,6 +120,7 @@ setup:
ovn_metadata_proxy_shared_secret: 'config.credentials.ovn-metadata-proxy-shared-secret'
setup_loop_based_cinder_lvm_backend: 'config.cinder.setup-loop-based-cinder-lvm-backend'
lvm_backend_volume_group: 'config.cinder.lvm-backend-volume-group'
lvm_loop_device: 'config.cinder.loop-device'
virt_type: 'config.nova.virt-type'
cpu_mode: 'config.nova.cpu-mode'
cpu_models: 'config.nova.cpu-models'

File diff suppressed because it is too large Load Diff

View File

@ -59,6 +59,8 @@ layout:
# to /etc/rtslib-fb-target.
/etc/rtslib-fb-target:
bind: $SNAP_COMMON/etc/target
/etc/lvm:
bind: $SNAP_COMMON/etc/lvm
apps:
# Openstack
openstack:

View File

@ -19,9 +19,20 @@ then
done
fi
allocated_loop_dev=`losetup -j $loop_file | cut -d':' -f 1`
allocated_loop_dev=`snapctl get config.cinder.loop-device`
if [ "$allocated_loop_dev" == "null" ]
then
allocated_loop_dev=`losetup -j $loop_file | cut -d':' -f 1`
fi
# Create a PV on the allocated loop device unless there is already one on it.
lvmdiskscan -l --config 'devices { filter = [ "a|'$allocated_loop_dev'|", "r|.*|" ] }' | grep -q '1 LVM' || (pvcreate $allocated_loop_dev && vgcreate $cinder_volumes_vg $allocated_loop_dev && exit 0)
config='devices { filter = [ "a|'$allocated_loop_dev'|", "r|.*|" ] }'
if [ `lvmdiskscan -l --config '$config' | grep -q '1 LVM'` -eq 1 ]
then
pvcreate $allocated_loop_dev
vgcreate $cinder_volumes_vg $allocated_loop_dev
snapctl set config.cinder.loop-device=$allocated_loop_dev
exit 0
fi
fi
# Activate the logical volumes (relevant on node reboot).