feat: lxc compatability with datavol #263
@ -2,6 +2,9 @@
|
|||||||
#
|
#
|
||||||
# This class manages the creation of a logical volume using the `lvm::volume` definition.
|
# This class manages the creation of a logical volume using the `lvm::volume` definition.
|
||||||
#
|
#
|
||||||
|
# For LXC hosts, this is replaced with a mount added from the host os. This class will simply check the
|
||||||
|
# mountpoint exists.
|
||||||
|
#
|
||||||
# Parameters:
|
# Parameters:
|
||||||
# $ensure - Ensure whether the logical volume is present or not. Defaults to 'present'.
|
# $ensure - Ensure whether the logical volume is present or not. Defaults to 'present'.
|
||||||
# $vg - Volume group name. No default.
|
# $vg - Volume group name. No default.
|
||||||
@ -25,33 +28,48 @@ class profiles::base::datavol (
|
|||||||
]] $mount_options = ['noatime', 'nodiratime'],
|
]] $mount_options = ['noatime', 'nodiratime'],
|
||||||
) {
|
) {
|
||||||
|
|
||||||
# Ensure the physical volume exists
|
if $facts['virtual'] != 'lxc' {
|
||||||
physical_volume { $pv:
|
|
||||||
ensure => $ensure,
|
|
||||||
before => Volume_group[$vg],
|
|
||||||
}
|
|
||||||
|
|
||||||
# Ensure the volume group exists
|
# Ensure the physical volume exists
|
||||||
volume_group { $vg:
|
physical_volume { $pv:
|
||||||
ensure => $ensure,
|
ensure => $ensure,
|
||||||
physical_volumes => [$pv],
|
before => Volume_group[$vg],
|
||||||
before => Logical_volume[$lv],
|
}
|
||||||
}
|
|
||||||
|
|
||||||
# Ensure the logical volume exists
|
# Ensure the volume group exists
|
||||||
logical_volume { $lv:
|
volume_group { $vg:
|
||||||
ensure => $ensure,
|
ensure => $ensure,
|
||||||
volume_group => $vg,
|
physical_volumes => [$pv],
|
||||||
size => $size,
|
before => Logical_volume[$lv],
|
||||||
before => Filesystem["/dev/${vg}/${lv}"],
|
}
|
||||||
}
|
|
||||||
|
|
||||||
# Ensure the filesystem is created on the logical volume
|
# Ensure the logical volume exists
|
||||||
filesystem { "/dev/${vg}/${lv}":
|
logical_volume { $lv:
|
||||||
ensure => $ensure,
|
ensure => $ensure,
|
||||||
fs_type => $fstype,
|
volume_group => $vg,
|
||||||
require => Logical_volume[$lv],
|
size => $size,
|
||||||
before => Mount[$mount],
|
before => Filesystem["/dev/${vg}/${lv}"],
|
||||||
|
}
|
||||||
|
|
||||||
|
# Ensure the filesystem is created on the logical volume
|
||||||
|
filesystem { "/dev/${vg}/${lv}":
|
||||||
|
ensure => $ensure,
|
||||||
|
fs_type => $fstype,
|
||||||
|
require => Logical_volume[$lv],
|
||||||
|
before => Mount[$mount],
|
||||||
|
}
|
||||||
|
|
||||||
|
# Ensure the logical volume is mounted at the desired location
|
||||||
|
mount { $mount:
|
||||||
|
ensure => $mountstate,
|
||||||
|
device => "/dev/${vg}/${lv}",
|
||||||
|
fstype => $fstype,
|
||||||
|
options => $mount_options.join(','),
|
||||||
|
require => [
|
||||||
|
Filesystem["/dev/${vg}/${lv}"],
|
||||||
|
File[$mount]
|
||||||
|
],
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Ensure the mountpath exists
|
# Ensure the mountpath exists
|
||||||
@ -62,12 +80,4 @@ class profiles::base::datavol (
|
|||||||
mode => '0755',
|
mode => '0755',
|
||||||
}
|
}
|
||||||
|
|
||||||
# Ensure the logical volume is mounted at the desired location
|
|
||||||
mount { $mount:
|
|
||||||
ensure => $mountstate,
|
|
||||||
device => "/dev/${vg}/${lv}",
|
|
||||||
fstype => $fstype,
|
|
||||||
options => $mount_options.join(','),
|
|
||||||
require => Filesystem["/dev/${vg}/${lv}"],
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user