Puppet Class: profile::docker::storage

Defined in:
modules/profile/manifests/docker/storage.pp

Overview

Class profile::docker::storage

Sets up the storage for the devicemanager docker storage driver with thick pools

This should be used on jessie, see:

github.com/docker/docker/issues/15629

Parameters:

  • physical_volumes (Any) (defaults to: hiera('profile::docker::storage::physical_volumes'))
  • vg_to_remove (Any) (defaults to: hiera('profile::docker::storage::vg_to_remove'))


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'modules/profile/manifests/docker/storage.pp', line 10

class profile::docker::storage(
    # list of physical volumes to use.
    $physical_volumes = hiera('profile::docker::storage::physical_volumes'),
    # Volume group to substitute.
    $vg_to_remove = hiera('profile::docker::storage::vg_to_remove'),
) {
    # Size of the thin pool and the metadata pool.
    $extents = '95%VG'
    $metadata_size = '5%VG'

    Class['::profile::docker::storage'] -> Service['docker']

    if ($vg_to_remove  and ! empty($vg_to_remove)) {
        volume_group { $vg_to_remove:
            ensure           => absent,
            physical_volumes => [],
        }
    }

    $main_lv_params = {
        extents  => $extents,
        mounted  => false,
        createfs => false,
    }

    $metadata_lv_params = {
        extents  => $metadata_size,
        mounted  => false,
        createfs => false,
    }

    $logical_volumes = {
        'data'     => $main_lv_params,
        'metadata' => $metadata_lv_params,
    }

    $volume_group = {
        docker => {
            ensure           => present,
            physical_volumes => $physical_volumes,
            logical_volumes  => $logical_volumes,
        },
    }

    class { '::lvm':
        manage_pkg    => true,
        volume_groups => $volume_group,
    }

    # This will be used in profile::docker::engine
    $options = {
        'storage-driver' => 'devicemapper',
        'storage-opts'   =>  [
            'dm.datadev=/dev/mapper/docker-data',
            'dm.metadatadev=/dev/mapper/docker-metadata',
        ],
    }
}