From f658a1491f5e3b6d09f6ffd4c3f9503c8771c38e Mon Sep 17 00:00:00 2001 From: Javier Pena Date: Tue, 10 May 2016 16:36:14 +0200 Subject: [PATCH] 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 --- packstack/puppet/templates/cinder_lvm.pp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packstack/puppet/templates/cinder_lvm.pp b/packstack/puppet/templates/cinder_lvm.pp index 726ed6622..f42b77c38 100644 --- a/packstack/puppet/templates/cinder_lvm.pp +++ b/packstack/puppet/templates/cinder_lvm.pp @@ -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', } ->