Defined Type: openiosds::meta0

Defined in:
manifests/meta0.pp

Overview

Configure and install an OpenIO meta0 service

Parameters:

  • action (Any) (defaults to: 'create')
  • type (Any) (defaults to: 'meta0')
  • num (Any) (defaults to: '0')
  • ns (Any) (defaults to: undef)
  • ipaddress (Any) (defaults to: $::ipaddress)
  • port (Any) (defaults to: $::openiosds::params::meta0_port)
  • debug (Any) (defaults to: false)
  • volume (Any) (defaults to: undef)
  • pidfile (Any) (defaults to: undef)
  • checks (Any) (defaults to: undef)
  • stats (Any) (defaults to: undef)
  • cmdline_options (Any) (defaults to: '')
  • location (Any) (defaults to: $hostname)
  • no_exec (Any) (defaults to: false)


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
# File 'manifests/meta0.pp', line 2

define openiosds::meta0 (
  $action          = 'create',
  $type            = 'meta0',
  $num             = '0',

  $ns              = undef,
  $ipaddress       = $::ipaddress,
  $port            = $::openiosds::params::meta0_port,
  $debug           = false,
  $volume          = undef,
  $pidfile         = undef,
  $checks          = undef,
  $stats           = undef,
  $cmdline_options = '',

  $location        = $hostname,
  $no_exec         = false,
) {

  if ! defined(Class['openiosds']) {
    include openiosds
  }

  # Validation
  $actions = ['create','remove']
  validate_re($action,$actions,"${action} is invalid.")
  validate_string($type)
  validate_integer($num)
  validate_string($ns)
  if ! has_interface_with('ipaddress',$ipaddress) { fail("${ipaddress} is invalid.") }
  validate_integer($port)
  validate_bool($debug)
  if $debug { $verbose = '-v ' }
  if $volume { $_volume = $volume }
  else { $_volume = "${openiosds::sharedstatedir}/${ns}/${type}-${num}" }
  if $pidfile { $_pidfile = $pidfile }
  else { $_pidfile = "${openiosds::runstatedir}/${ns}-${type}-${num}.pid" }
  if $checks { $_checks = $checks }
  else { $_checks = ['{type: tcp}'] }
  if $stats { $_stats = $stats }
  else { $_stats = ["{type: volume, path: ${_volume}}",'{type: meta}','{type: system}'] }
  validate_string($cmdline_options)
  validate_string($location)


  # Namespace
  if $action == 'create' {
    if ! defined(Openiosds::Namespace[$ns]) {
      fail('You must include the namespace class before using OpenIO defined types.')
    }
  }

  # Service
  openiosds::service {"${ns}-${type}-${num}":
    action => $action,
    type   => $type,
    num    => $num,
    ns     => $ns,
    volume => $_volume,
  } ->
  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::bindir}/oio-meta0-server ${verbose} ${cmdline_options} -p ${_pidfile} -s OIO,${ns},${type},${num} -O Endpoint=${ipaddress}:${port} ${ns} ${_volume}",
    group   => "${ns},${type},${type}-${num}",
    uid     => $openiosds::user,
    gid     => $openiosds::group,
    no_exec => $no_exec,
  }

}