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
This commit is contained in:
Alan Bishop 2017-05-17 15:53:49 -04:00
parent 02e29ba67d
commit b8f15088b5
2 changed files with 12 additions and 0 deletions

View File

@ -58,4 +58,12 @@ class cinder::setup_test_volume(
unless => "vgdisplay | grep ${volume_name}",
refreshonly => true,
}
# Ensure the loopback device and volume group are restored if the system
# were to reboot.
exec { "losetup -f ${volume_path}/${volume_name} && udevadm settle && vgchange -a y ${volume_name}":
path => ['/bin','/usr/bin','/sbin','/usr/sbin'],
unless => "losetup -l | grep ${volume_path}/${volume_name}",
before => Anchor['cinder::service::begin'],
}
}

View File

@ -20,4 +20,8 @@ describe 'cinder::setup_test_volume' do
: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