Skip to content

Commit c594947

Browse files
author
Kjetil Nygård
committed
Added support for volumes not mounted by lvm.
1 parent d1fce60 commit c594947

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ resources out yourself.
164164
- `:core`
165165
- `:disk`
166166
- `:mirrored`
167+
* mounted - If puppet should mount the volume. This only affects what puppet will do, and not what will be mounted at boot-time.
167168
* no_sync (Parameter) - An optimization in lvcreate, at least on Linux.
168169
* persistent (Parameter) - Set to true to make the block device persistent
169170
* readahead (Parameter) - The readahead count to use for the new logical volume.

manifests/logical_volume.pp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
$mkfs_options = undef,
1313
$mountpath = "/${name}",
1414
$mountpath_require = false,
15+
$mounted = true,
1516
$createfs = true,
1617
$extents = undef,
1718
$stripes = undef,
@@ -52,7 +53,10 @@
5253
$fixed_dump = $dump
5354
$mount_ensure = $ensure ? {
5455
'absent' => absent,
55-
default => mounted,
56+
default => $mounted ? {
57+
true => mounted,
58+
false => present,
59+
}
5660
}
5761
}
5862

spec/unit/classes/lvm_spec.rb

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,30 @@
5151
it { should contain_mount('/var/backups') }
5252
end
5353

54+
describe 'without mount' do
55+
let(:params) do
56+
{
57+
:volume_groups => {
58+
'myvg' => {
59+
'physical_volumes' => [ '/dev/sda2', ],
60+
'logical_volumes' => {
61+
'not_mounted' => {
62+
'size' => '5G',
63+
'mounted' => false,
64+
'mountpath' => '/mnt/not_mounted',
65+
'mountpath_require' => true
66+
}
67+
}
68+
}
69+
}
70+
}
71+
end
72+
73+
it { should contain_mount('/mnt/not_mounted').with({
74+
:ensure => 'present'
75+
}) }
76+
end
77+
5478
describe 'with a swap volume' do
5579
let(:params) do
5680
{

0 commit comments

Comments
 (0)