Find available loop device for cinder-volumes

Previously, Packstack used a fixed loop device (/dev/loop2) to create
the cinder-volumes test volume. This could create a conflict if the
loop device was already in use.

Using 'losetup -f' to find an available loop device should fix this.

Change-Id: Ie175e9f6127cfcdce6eda95a67051dda9c64104f
Closes-Bug: #1555454
This commit is contained in:
Javier Pena
2016-05-10 16:36:14 +02:00
parent 4c37e48998
commit f658a1491f

View File

@@ -1,9 +1,12 @@
$create_cinder_volume = hiera('CONFIG_CINDER_VOLUMES_CREATE')
if $create_cinder_volume == 'y' {
# Find an available loop device
$loop_dev = chomp(generate('/usr/sbin/losetup', '-f'))
class { '::cinder::setup_test_volume':
size => hiera('CONFIG_CINDER_VOLUMES_SIZE'),
loopback_device => '/dev/loop2',
loopback_device => $loop_dev,
volume_path => '/var/lib/cinder',
volume_name => 'cinder-volumes',
} ->