Defined Type: lvm::logical_volume
- Defined in:
- vendor_modules/lvm/manifests/logical_volume.pp
Summary
Manage a logical volume.Overview
This will automatically set this volume group as a dependency, but it must be defined elsewhere using the volume_group resource type.
the partition size.
(if the LV found is larger then the size requests this is just logged not causing a FAIL)
are in sync. Cannot be changed on already mirrored volume. Take your mirror size in terabytes and round up that number to the next power of 2, using that number as the -R argument
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'vendor_modules/lvm/manifests/logical_volume.pp', line 65
define lvm::logical_volume (
String[1] $volume_group,
Optional[String[1]] $size = undef,
Optional[String[1]] $initial_size = undef,
Enum['absent', 'present'] $ensure = present,
String[1] $options = 'defaults',
Variant[String[1], Integer] $pass = '2',
Variant[String[1], Integer] $dump = '0',
String[1] $fs_type = 'ext4',
Optional[String[1]] $mkfs_options = undef,
Stdlib::Absolutepath $mountpath = "/${name}",
Boolean $mountpath_require = false,
Boolean $mounted = true,
Boolean $createfs = true,
Optional[String[1]] $extents = undef,
Optional[Variant[String[1], Integer]] $stripes = undef,
Optional[Variant[String[1], Integer]] $stripesize = undef,
Optional[Variant[String[1], Integer]] $readahead = undef,
Optional[Enum['maximum', 'minimum']] $range = undef,
Optional[Boolean] $size_is_minsize = undef,
Optional[String[1]] $type = undef,
Variant[Boolean, String] $thinpool = false,
Optional[Integer[0, 4]] $poolmetadatasize = undef,
Optional[String[1]] $mirror = undef,
Optional[Enum['core', 'disk', 'mirrored']] $mirrorlog = undef,
Optional[Boolean] $no_sync = undef,
Optional[Variant[String[1], Integer]] $region_size = undef,
Optional[Enum['anywhere', 'contiguous', 'cling', 'inherit', 'normal']] $alloc = undef,
Boolean $yes_flag = false,
) {
$lvm_device_path = "/dev/${volume_group}/${name}"
if $mountpath_require and $fs_type != 'swap' {
Mount {
require => File[$mountpath],
}
}
if $fs_type == 'swap' {
$mount_title = $lvm_device_path
$fixed_mountpath = "swap_${lvm_device_path}"
$fixed_pass = 0
$fixed_dump = 0
$mount_ensure = $ensure ? {
'absent' => absent,
default => present,
}
} else {
$mount_title = $mountpath
$fixed_mountpath = $mountpath
$fixed_pass = $pass
$fixed_dump = $dump
$mount_ensure = $ensure ? {
'absent' => absent,
default => $mounted ? {
true => mounted,
false => present,
}
}
}
if $ensure == 'present' and $createfs {
Logical_volume[$name]
-> Filesystem[$lvm_device_path]
-> Mount[$mount_title]
} elsif $ensure != 'present' and $createfs {
Mount[$mount_title]
-> Filesystem[$lvm_device_path]
-> Logical_volume[$name]
}
logical_volume { $name:
ensure => $ensure,
volume_group => $volume_group,
size => $size,
initial_size => $initial_size,
stripes => $stripes,
stripesize => $stripesize,
readahead => $readahead,
extents => $extents,
range => $range,
size_is_minsize => $size_is_minsize,
type => $type,
thinpool => $thinpool,
poolmetadatasize => $poolmetadatasize,
mirror => $mirror,
mirrorlog => $mirrorlog,
no_sync => $no_sync,
region_size => $region_size,
alloc => $alloc,
yes_flag => $yes_flag,
}
if $createfs {
filesystem { $lvm_device_path:
ensure => $ensure,
fs_type => $fs_type,
options => $mkfs_options,
}
}
if $createfs or $ensure != 'present' {
if $fs_type != 'swap' {
exec { "ensure mountpoint '${fixed_mountpath}' exists":
path => ['/bin', '/usr/bin', '/sbin'],
command => "mkdir -p ${fixed_mountpath}",
unless => "test -d ${fixed_mountpath}",
onlyif => "lvs /dev/${volume_group}/${name} > /dev/null 2>&1",
before => Mount[$mount_title],
}
}
mount { $mount_title:
ensure => $mount_ensure,
name => $fixed_mountpath,
device => $lvm_device_path,
fstype => $fs_type,
options => $options,
pass => $fixed_pass,
dump => $fixed_dump,
atboot => true,
}
}
}
|