Defined Type: openiosds::rawx
- Defined in:
- manifests/rawx.pp
Overview
Configure and install an OpenIO rawx service
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 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'manifests/rawx.pp', line 2
define openiosds::rawx (
$action = 'create',
$type = 'rawx',
$num = '0',
$ns = undef,
$ipaddress = $::ipaddress,
$port = $::openiosds::params::rawx_port,
$documentRoot = undef,
$serverRoot = undef,
$grid_hash_width = '3',
$grid_hash_depth = '1',
$checks = undef,
$stats = undef,
$serverName = 'localhost',
$serverSignature = 'Off',
$serverTokens = 'Prod',
$typesConfig = '/etc/mime.types',
$grid_fsync = 'enabled',
$grid_fsync_dir = 'enabled',
$prefork_MaxClients = '150',
$prefork_StartServers = '5',
$prefork_MinSpareServers = '5',
$prefork_MaxSpareServers = '10',
$worker_StartServers = '5',
$worker_MaxClients = '100',
$worker_MinSpareThreads = '5',
$worker_MaxSpareThreads = '25',
$worker_ThreadsPerChild = '10',
$worker_MaxRequestsPerChild = '0',
$location = $hostname,
$no_exec = false,
) {
if ! defined(Class['openiosds']) {
include openiosds
}
# Validation
validate_string($ns)
if ! has_interface_with('ipaddress',$ipaddress) { fail("${ipaddress} is invalid.") }
validate_integer($port)
if $documentRoot { $_documentRoot = $documentRoot }
else { $_documentRoot = "${openiosds::sharedstatedir}/${ns}/${type}-${num}" }
if $serverRoot { $_serverRoot = $serverRoot }
else { $_serverRoot = "${openiosds::sharedstatedir}/${ns}/coredump" }
validate_integer($grid_hash_width)
validate_integer($grid_hash_depth)
if $checks { $_checks = $checks }
else { $_checks = ['{type: http, uri: /info}'] }
if $stats { $_stats = $stats }
else { $_stats = ["{type: volume, path: ${_documentRoot}}",'{type: rawx, path: /stat}','{type: system}'] }
validate_string($serverName)
validate_string($serverSignature)
validate_string($serverTokens)
validate_string($typesConfig)
validate_string($grid_fsync)
validate_string($grid_fsync_dir)
validate_integer($grid_hash_width)
validate_integer($prefork_MaxClients)
validate_integer($prefork_StartServers)
validate_integer($prefork_MinSpareServers)
validate_integer($prefork_MaxSpareServers)
validate_integer($worker_StartServers)
validate_integer($worker_MaxClients)
validate_integer($worker_MinSpareThreads)
validate_integer($worker_MaxSpareThreads)
validate_integer($worker_ThreadsPerChild)
validate_integer($worker_MaxRequestsPerChild)
validate_string($location)
# Namespace
if $action == 'create' {
if ! defined(Openiosds::Namespace[$ns]) {
fail('You must include the namespace class before using OpenIO defined types.')
}
}
# Packages
ensure_packages([$::openiosds::httpd_package_name],$::openiosds::params::package_install_options)
# Service
openiosds::service {"${ns}-${type}-${num}":
action => $action,
type => $type,
num => $num,
ns => $ns,
volume => $_documentRoot,
} ->
# Configuration files
file { "${openiosds::sysconfdir}/${ns}/${type}-${num}/${type}-${num}-httpd.conf":
ensure => $openiosds::file_ensure,
content => template('openiosds/dav-httpd.conf.erb'),
mode => $openiosds::file_mode,
require => Package[$::openiosds::httpd_package_name],
} ->
file { "${openiosds::sysconfdir}/${ns}/watch/${type}-${num}.yml":
ensure => $openiosds::file_ensure,
content => template('openiosds/service-watch.yml.erb'),
mode => $openiosds::file_mode,
} ->
# Init
gridinit::program { "${ns}-${type}-${num}":
action => $action,
command => "${openiosds::httpd_daemon} -D FOREGROUND -f ${openiosds::sysconfdir}/${ns}/${type}-${num}/${type}-${num}-httpd.conf",
group => "${ns},${type},${type}-${num}",
uid => $openiosds::user,
gid => $openiosds::group,
no_exec => $no_exec,
}
}
|