Puppet Class: swift

Defined in:
modules/swift/manifests/init.pp

Overview

Parameters:

  • hash_path_suffix (String)
  • storage_policies (Boolean) (defaults to: true)


1
2
3
4
5
6
7
8
9
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
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
# File 'modules/swift/manifests/init.pp', line 1

class swift (
    String $hash_path_suffix,
    Boolean $storage_policies = true,
) {
    # Recommendations from Swift -- see <http://tinyurl.com/swift-sysctl>.
    sysctl::parameters { 'swift_performance':
        values => {
            'net.ipv4.tcp_syncookies'             => '0',
            # Disable TIME_WAIT
            'net.ipv4.tcp_tw_recycle'             => '1',
            'net.ipv4.tcp_tw_reuse'               => '1',
            'net.ipv4.netfilter.ip_conntrack_max' => '262144',

            # Other general network/TCP tuning

            # Increase the number of ephemeral ports
            'net.ipv4.ip_local_port_range'        =>  [ 1024, 65535 ],

            # Recommended to increase this for 1000 BT or higher
            'net.core.netdev_max_backlog'         =>  30000,

            # Increase the queue size of new TCP connections
            'net.core.somaxconn'                  => 4096,
            'net.ipv4.tcp_max_syn_backlog'        => 262144,
            'net.ipv4.tcp_max_tw_buckets'         => 360000,

            # Decrease FD usage
            'net.ipv4.tcp_fin_timeout'            => 3,
            'net.ipv4.tcp_max_orphans'            => 262144,
            'net.ipv4.tcp_synack_retries'         => 2,
            'net.ipv4.tcp_syn_retries'            => 2,
        },
    }

    package { [
        'swift',
        'python-swift',
        'python-swiftclient',
        'parted',
    ]:
        ensure => present,
    }

    require_package('python-statsd')

    file {
        default:
            owner   => 'swift',
            group   => 'swift',
            mode    => '0440',
            require => Package['swift'];
        '/etc/swift':
            ensure  => directory,
            recurse => true;
        '/etc/swift/swift.conf':
            ensure  => file,
            content => template('swift/swift.conf.erb');
        '/var/cache/swift':
            ensure => directory,
            mode   => '0755';
        # Create swift user home. Once T123918 is resolved this should be moved as
        # part of a user resource declaration.
        '/var/lib/swift':
            ensure => directory,
            mode   => '0755',
    }

    if !defined(File['/srv/log']) {
        file { '/srv/log':
            ensure => 'directory',
            mode   => '0755',
            owner  => 'root',
            group  => 'root',
        }
    }

    file { '/srv/log/swift':
        ensure  => directory,
        require => Package['swift'],
        owner   => 'root',
        group   => 'root',
        mode    => '0755',
    }

    file { '/var/log/swift':
        ensure  => link,
        target  => '/srv/log/swift',
        require => File['/srv/log/swift'],
    }

    logrotate::conf { 'swift':
        ensure => present,
        source => 'puppet:///modules/swift/swift.logrotate.conf',
    }

    rsyslog::conf { 'swift':
        source   => 'puppet:///modules/swift/swift.rsyslog.conf',
        priority => 40,
    }
}