Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support configuration repositories when using mount #177

Merged
merged 3 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,16 @@ cvmfs::domain{'example.net'

To use puppet's mount type rather that autofs
a typical configuration might be the following. This
examples configures a cvmfs domain, a configuration
example configures a cvmfs domain for common settings, a configuration
repository and finally a particular repository for
mount.
mount. In this example the `cvmfs-config.example.org` has
been marked as the per client configuration repository and will always
be mounted first.

```puppet
class{'cvmfs':
mount_method => 'mount',
config_repo => 'cvmfs-config.example.org',
}
cvmfs::domain{'example.org':
cvmfs_server_url => 'http://web.example.org/cvmfs/@fqrn@'
Expand Down
55 changes: 44 additions & 11 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

#### Public Classes

* [`cvmfs`](#cvmfs): Installs and Configures CvmFS
* [`cvmfs`](#cvmfs): Installs and Configures CVMFS

#### Private Classes

* `cvmfs::apt`: Configure cvmfs apt repositories
* `cvmfs::config`: Central configuration of CvmFS
* `cvmfs::config`: Central configuration of CVMFS
* `cvmfs::fsck`: enable check_fsck as a cron or systemd timer
* `cvmfs::install`: Install cvmfs from a yum repository.
* `cvmfs::service`: Manages the cvmfs services. Opionally this also manages the autofs services
Expand Down Expand Up @@ -89,7 +89,7 @@ class{'cvmfs':
}
```

##### New parameters with CvmFS 2.11.0
##### New parameters with CVMFS 2.11.0

```puppet
class{'cvmfs':
Expand All @@ -109,6 +109,7 @@ class{'cvmfs':
The following parameters are available in the `cvmfs` class:

* [`mount_method`](#-cvmfs--mount_method)
* [`config_repo`](#-cvmfs--config_repo)
* [`manage_autofs_service`](#-cvmfs--manage_autofs_service)
* [`cvmfs_quota_limit`](#-cvmfs--cvmfs_quota_limit)
* [`cvmfs_quota_ratio`](#-cvmfs--cvmfs_quota_ratio)
Expand Down Expand Up @@ -187,6 +188,17 @@ skips all mounting. Note that migrating between for instance *autofs* and then

Default value: `'autofs'`

##### <a name="-cvmfs--config_repo"></a>`config_repo`

Data type: `Optional[Stdlib::Fqdn]`

When using the `mount_method` as `mount` it may be nescessary to specify a CVMFS located configuration_repository.
This is a repository containing extra cvmfs configuration required to be mounted before any other
repositories. There is at most one config_repo client. In addition the config_repo must actually be mounted
explicitly with a `cvmfs::mount{$config_repo:}`, this is **not** automatic.

Default value: `undef`

##### <a name="-cvmfs--manage_autofs_service"></a>`manage_autofs_service`

Data type: `Boolean`
Expand Down Expand Up @@ -566,7 +578,7 @@ Default value: `false`
Data type: `Optional[Boolean]`

Install or disable fuse3 variant of cvmfs, if left `undef` no change will be made. Note that changing
this value when CvmFS mounts are active may well destroy those mounts.
this value when CVMFS mounts are active may well destroy those mounts.
Not availabe on Ubuntu 18.04.

Default value: `undef`
Expand Down Expand Up @@ -766,7 +778,7 @@ The following parameters are available in the `cvmfs::domain` defined type:

Data type: `Stdlib::Fqdn`

The domain of CvmFS repositories to mount
The domain of CVMFS repositories to mount

Default value: `$name`

Expand Down Expand Up @@ -961,6 +973,27 @@ cvmfs::mount{'foobar.example.org':
}
```

##### Mount a repository with mount (not automount)

```puppet
class{ 'cvmfs':
mount_method => 'mount',
}
cvmfs::mount{'quark.example.org':}
```

##### Mount a repository with mount and a config_repo as well.

```puppet

class{ 'cvmfs':
mount_method => 'mount',
config_mount => 'cvmfs-config.example.org',
}
cvmfs::mount{'cvmfs-config.example.org':}
cvmfs::mount{'down.example.org':}
```

#### Parameters

The following parameters are available in the `cvmfs::mount` defined type:
Expand Down Expand Up @@ -1091,11 +1124,11 @@ Default value: `undef`

##### <a name="-cvmfs--mount--mount_method"></a>`mount_method`

Data type: `Enum['autofs','mount','none']`
Data type: `Optional[String[1]]`

Should the mount attempt be made with autofs or tranditional fstab mount. Do no use this.
Deprecated, do not set this, set mount_method for the whole client only on the main class.

Default value: `$cvmfs::mount_method`
Default value: `undef`

##### <a name="-cvmfs--mount--cvmfs_repo_list"></a>`cvmfs_repo_list`

Expand Down Expand Up @@ -1203,9 +1236,9 @@ Default value: `undef`

##### <a name="-cvmfs--mount--mount_options"></a>`mount_options`

Data type: `String[1]`
Data type: `Variant[String[1],Array[String[1]]]`

Mount options to use for fstab style mounting.
Mount options to use for fstab style mounting. mount_method==mount only

Default value: `'defaults,_netdev,nodev'`
Default value: `['defaults','_netdev','nodev']`

2 changes: 1 addition & 1 deletion manifests/config.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# @summary Central configuration of CvmFS
# @summary Central configuration of CVMFS
# @api private
#
class cvmfs::config (
Expand Down
2 changes: 1 addition & 1 deletion manifests/domain.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# cvmfs_server_url = 'http://example.org/cvmfs/@fqrn@',
# }
#
# @param domain The domain of CvmFS repositories to mount
# @param domain The domain of CVMFS repositories to mount
# @param cvmfs_quota_limit Per mount quota limit, not relavent to shared cache. Sets cvmfs_quota_limit
# @param cvmfs_server_url Stratum 1 list, typically `;` delimited. Sets CVMFS_SERVER_URL parameter.
# @param cvmfs_http_proxy List of http proxies to use. Sets CVMFS_PROXY_LIST parameter.
Expand Down
12 changes: 9 additions & 3 deletions manifests/init.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# @summary Installs and Configures CvmFS
# @summary Installs and Configures CVMFS
#
# @see https://cvmfs.readthedocs.io/en/stable/apx-parameters.html CVMFS configuration parameters
#
Expand Down Expand Up @@ -38,7 +38,7 @@
# }
# }
#
# @example New parameters with CvmFS 2.11.0
# @example New parameters with CVMFS 2.11.0
# class{'cvmfs':
# cvmfs_cache_symlinks => 'yes',
# cvmfs_streaming_cache => 'no',
Expand All @@ -54,6 +54,11 @@
# The `autofs` option will configure cvmfs to be mounted with autofs. The `mount` option will
# use puppet's mount type, currently adding a line to /etc/fstab. The *none* option
# skips all mounting. Note that migrating between for instance *autofs* and then *mount* is not supported.
# @param config_repo
# When using the `mount_method` as `mount` it may be nescessary to specify a CVMFS located configuration_repository.
# This is a repository containing extra cvmfs configuration required to be mounted before any other
# repositories. There is at most one config_repo client. In addition the config_repo must actually be mounted
# explicitly with a `cvmfs::mount{$config_repo:}`, this is **not** automatic.
# @param manage_autofs_service should the autofs service be maintained.
# @param cvmfs_quota_limit The cvmfs quota size in megabytes.
# @param cvmfs_quota_ratio
Expand Down Expand Up @@ -113,7 +118,7 @@
# @param cvmfs_fsck_onreboot Should fsck be run after every reboot
# @param fuse3
# Install or disable fuse3 variant of cvmfs, if left `undef` no change will be made. Note that changing
# this value when CvmFS mounts are active may well destroy those mounts.
# this value when CVMFS mounts are active may well destroy those mounts.
# Not availabe on Ubuntu 18.04.
# @param cvmfs_cache_symlinks If set to yes, enables symlink caching in the kernel.
# @param cvmfs_streaming_cache If set to yes, use a download manager to download regular files on read.
Expand Down Expand Up @@ -143,6 +148,7 @@
Variant[Undef,String] $cvmfs_http_proxy,
Optional[Variant[Enum['absent'], Array[String[1]]]] $repo_includepkgs,
Enum['autofs','mount','none'] $mount_method = 'autofs',
Optional[Stdlib::Fqdn] $config_repo = undef,
Boolean $manage_autofs_service = true,
Integer $default_cvmfs_partsize = 10000,
Variant[Enum['auto'],Integer] $cvmfs_quota_limit = 1000,
Expand Down
51 changes: 45 additions & 6 deletions manifests/mount.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,21 @@
# }
# }
#
# @example Mount a repository with mount (not automount)
# class{ 'cvmfs':
# mount_method => 'mount',
# }
# cvmfs::mount{'quark.example.org':}
#
# @example Mount a repository with mount and a config_repo as well.
#
# class{ 'cvmfs':
# mount_method => 'mount',
# config_mount => 'cvmfs-config.example.org',
# }
# cvmfs::mount{'cvmfs-config.example.org':}
# cvmfs::mount{'down.example.org':}
#
# @param repo The fully qualified repository name to mount
# @param cvmfs_quota_limit Per mount quota limit, not relavent to shared cache. Sets cvmfs_quota_limit
# @param cvmfs_server_url Stratum 1 list, typically `;` delimited. Sets CVMFS_SERVER_URL parameter.
Expand All @@ -29,7 +44,7 @@
# @param cvmfs_max_ttl Maximum effective TTL in seconds for DNS queries of proxy server names. Sets CVMFS_MAX_TTL
# @param cvmfs_env_variables Sets per repo environments variables for magic links.
# @param cvmfs_use_geoapi Set CVMFS_MAX_GEOAPI
# @param mount_method Should the mount attempt be made with autofs or tranditional fstab mount. Do no use this.
# @param mount_method Deprecated, do not set this, set mount_method for the whole client only on the main class.
# @param cvmfs_repo_list If true the repository will added to the list of repositories maintained in `/etc/cvmfs/default.local`
# @param cvmfs_mount_rw sets CVMFS_MOUNT_RW
# @param cvmfs_memcache_size Sets CVMFS_MEMCACHE_SIZE in Megabytes.
Expand All @@ -43,7 +58,7 @@
# @param cvmfs_external_timeout_direct Sets CVMFS_EXTERNAL_TIMEOUT_DIRECT
# @param cvmfs_external_url Sets CVMFS_EXTERNAL_URL
# @param cvmfs_repository_tag Sets CVMFS_REPOSITORY_TAG
# @param mount_options Mount options to use for fstab style mounting.
# @param mount_options Mount options to use for fstab style mounting. mount_method==mount only
#
define cvmfs::mount (
Stdlib::Fqdn $repo = $name,
Expand All @@ -65,8 +80,8 @@
Optional[Hash[Variant[Integer,String],Integer, 1]] $cvmfs_uid_map = undef,
Optional[Hash[Variant[Integer,String],Integer, 1]] $cvmfs_gid_map = undef,
Optional[Stdlib::Yes_no] $cvmfs_follow_redirects = undef,
String[1] $mount_options = 'defaults,_netdev,nodev',
Enum['autofs','mount','none'] $mount_method = $cvmfs::mount_method,
Variant[String[1],Array[String[1]]] $mount_options = ['defaults','_netdev','nodev'],
Optional[String[1]] $mount_method = undef,
Optional[String] $cvmfs_external_fallback_proxy = undef,
Optional[String] $cvmfs_external_http_proxy = undef,
Optional[Integer] $cvmfs_external_timeout = undef,
Expand All @@ -76,6 +91,19 @@
) {
include cvmfs

#
# deprecations
#
if $mount_method {
deprecation("mount_method on cvmfs::mount{${repo}:}", 'Never set mount method on a cvmfs::mount. It should only ever be set on the main class for the whole client')
}
if $mount_options =~ String {
deprecation("mount_options on cvmfs::mount{${repo}:}", 'Setting mount_options as a string is deprecated, set as an array of options instead')
$_mount_options = $mount_options.split(',')
} else {
$_mount_options = $mount_options
}

$_cvmfs_id_map_file_prefix = "/etc/cvmfs/config.d/${repo}"
if $cvmfs_uid_map {
cvmfs::id_map { "${_cvmfs_id_map_file_prefix}.uid_map":
Expand Down Expand Up @@ -130,18 +158,29 @@
content => "${repo},",
}
}
if $mount_method == 'mount' {
if $cvmfs::mount_method == 'mount' {
file { "/cvmfs/${repo}":
ensure => directory,
owner => 'cvmfs',
group => 'cvmfs',
require => Package['cvmfs'],
}

#
# Require the config repo for all repos except the config_repo
#
if $cvmfs::config_repo and $cvmfs::config_repo != $repo {
$_my_mount_options = $_mount_options + ["x-systemd.requires-mounts-for=/cvmfs/${cvmfs::config_repo}"]
Mount["/cvmfs/${cvmfs::config_repo}"] -> Mount["/cvmfs/${repo}"]
} else {
$_my_mount_options = $_mount_options
}

mount { "/cvmfs/${repo}":
ensure => mounted,
device => $repo,
fstype => 'cvmfs',
options => $mount_options,
options => $_my_mount_options.unique.join(','),
atboot => true,
require => [File["/cvmfs/${repo}"],File["/etc/cvmfs/config.d/${repo}.local"],Concat['/etc/cvmfs/default.local'],File['/etc/fuse.conf']],
}
Expand Down
Loading
Loading