puppet-cinder/spec/classes/cinder_setup_test_volume_spec.rb
Alan Bishop b8f15088b5 Restore iscsi loopback LVM volume group on startup
This change restores the loopback device and LVM volume group used
by the iscsi driver each time the system restarts. This essentially
allows the volume group to survive a reboot.

Closes-Bug: #1581092
Change-Id: Ifcd74b41d9d14b1c2a176fe9994a3927ae2a552a
2017-05-17 16:16:03 -04:00

28 lines
965 B
Ruby

require 'spec_helper'
describe 'cinder::setup_test_volume' do
it { is_expected.to contain_package('lvm2').with(
:ensure => 'present',
) }
it 'should contain volume creation execs' do
is_expected.to contain_exec('create_/var/lib/cinder/cinder-volumes').with(
:command => 'dd if=/dev/zero of="/var/lib/cinder/cinder-volumes" bs=1 count=0 seek=4G'
)
is_expected.to contain_exec('losetup /dev/loop2 /var/lib/cinder/cinder-volumes')
is_expected.to contain_exec('pvcreate /dev/loop2')
is_expected.to contain_exec('vgcreate cinder-volumes /dev/loop2')
end
it 'should set 0640 permissions for cinder-volumes' do
is_expected.to contain_file('/var/lib/cinder/cinder-volumes').with(
:mode => '0640'
)
end
it 'should restore loopback device and volume group' do
is_expected.to contain_exec('losetup -f /var/lib/cinder/cinder-volumes && udevadm settle && vgchange -a y cinder-volumes')
end
end