diff --git a/manifests/logical_volume.pp b/manifests/logical_volume.pp index 8ece160e..5df17b41 100644 --- a/manifests/logical_volume.pp +++ b/manifests/logical_volume.pp @@ -28,9 +28,14 @@ $no_sync = undef, $region_size = undef, $alloc = undef, + Boolean $use_mapper_device = true, ) { - $lvm_device_path = "/dev/${volume_group}/${name}" + if $use_mapper_device { + $lvm_device_path = "/dev/mapper/${volume_group}-${name}" + } else { + $lvm_device_path = "/dev/${volume_group}/${name}" + } if $mountpath_require and $fs_type != 'swap' { Mount { diff --git a/spec/unit/classes/lvm_spec.rb b/spec/unit/classes/lvm_spec.rb index c091c109..02cbf8e2 100644 --- a/spec/unit/classes/lvm_spec.rb +++ b/spec/unit/classes/lvm_spec.rb @@ -40,14 +40,14 @@ :volume_group => 'myvg', :size => '20G' }) } - it { should contain_filesystem('/dev/myvg/opt') } + it { should contain_filesystem('/dev/mapper/myvg-opt') } it { should contain_mount('/opt') } it { should contain_logical_volume('backup').with({ :volume_group => 'myvg', :size => '5G' }) } - it { should contain_filesystem('/dev/myvg/backup') } + it { should contain_filesystem('/dev/mapper/myvg-backup') } it { should contain_mount('/var/backups') } end @@ -101,11 +101,11 @@ :volume_group => 'myvg', :size => '20G' }) } - it { should contain_filesystem('/dev/myvg/swap').with({ + it { should contain_filesystem('/dev/mapper/myvg-swap').with({ :fs_type => 'swap' }) } - it { should contain_mount('/dev/myvg/swap').with({ - :name => 'swap_/dev/myvg/swap', + it { should contain_mount('/dev/mapper/myvg-swap').with({ + :name => 'swap_/dev/mapper/myvg-swap', :ensure => 'present', :fstype => 'swap', :pass => 0,