diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2010-09-03 15:42:15 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2010-09-03 15:42:15 -0300 |
commit | 91d86183ce3a248da990da50c32e4b55c6f499dc (patch) | |
tree | 3384aa89b2373b56b47647b5b075270d307d3792 | |
parent | aba70cfed5b870625bcd0d805bfcb46a1487a95d (diff) | |
download | puppet-virtual-91d86183ce3a248da990da50c32e4b55c6f499dc.tar.gz puppet-virtual-91d86183ce3a248da990da50c32e4b55c6f499dc.tar.bz2 |
Adding vs_cflags definition
-rw-r--r-- | manifests/vserver.pp | 48 |
1 files changed, 33 insertions, 15 deletions
diff --git a/manifests/vserver.pp b/manifests/vserver.pp index 6913659..20ed29c 100644 --- a/manifests/vserver.pp +++ b/manifests/vserver.pp @@ -432,6 +432,11 @@ define vs_sched($vserver, $ensure = present, $fill_rate = '', $fill_rate2 = '', content => "$priority_bias\n", } + vs_flags { "${vserver}-sched_hard": + flag => "sched_hard", + ensure => $ensure, + } + case $ensure { present: { @@ -508,7 +513,7 @@ define vs_sched($vserver, $ensure = present, $fill_rate = '', $fill_rate2 = '', $vsched_params = "$set_fill_rate $set_fill_rate2 $set_interval $set_interval2 $set_tokens_min $set_tokens_max $set_tokens $set_idle_time $set_priority_bias" - exec { "vattribute --set --xid `cat /etc/vservers/$vserver/context` --flag sched_hard": + exec { "vsched --xid `cat /etc/vservers/$vserver/context` ${vsched_params} --force": subscribe => File["/etc/vservers/$vserver/sched/fill_rate", "/etc/vservers/$vserver/sched/fill_rate2", "/etc/vservers/$vserver/sched/interval", "/etc/vservers/$vserver/sched/interval2", "/etc/vservers/$vserver/sched/tokens-min", "/etc/vservers/$vserver/sched/tokens-max", @@ -516,24 +521,37 @@ define vs_sched($vserver, $ensure = present, $fill_rate = '', $fill_rate2 = '', refreshonly => true, require => Exec["vs_create_${vserver}"], } + } + } +} - exec { "vsched --xid `cat /etc/vservers/$vserver/context` ${vsched_params} --force": - subscribe => File["/etc/vservers/$vserver/sched/fill_rate", "/etc/vservers/$vserver/sched/fill_rate2", - "/etc/vservers/$vserver/sched/interval", "/etc/vservers/$vserver/sched/interval2", - "/etc/vservers/$vserver/sched/tokens-min", "/etc/vservers/$vserver/sched/tokens-max", - "/etc/vservers/$vserver/sched/tokens", "/etc/vservers/$vserver/sched/idle-time"], +define vs_cflags($vserver, $flag, $ensure = present) { + if ! defined(File["/etc/vservers/${vserver}/cflags"]) { + file { "/etc/vservers/${vserver}/cflags": + ensure => present, + } + } + + line {"vs_cflags-${vserver}-${flag}": + ensure => $ensure, + file => "/etc/vservers/${vserver}/cflags", + line => "${flag}", + require => Exec["vs_create_${vserver}"], + notify => Exec["vattribute-${vserver}-${flag}"], + } + + case $ensure { + present: { + exec { "vattribute-${vserver}-${flag}" + command => "vattribute --set --xid `cat /etc/vservers/$vserver/context` --flag ${flag}", refreshonly => true, - require => Exec["vs_create_${vserver}"], + require => exec["vs_create_${vserver}"], } - } - default { - exec { "vattribute --set --xid `cat /etc/vservers/$vserver/context` --flag ~sched_hard": - subscribe => File["/etc/vservers/$vserver/sched/fill_rate", "/etc/vservers/$vserver/sched/fill_rate2", - "/etc/vservers/$vserver/sched/interval", "/etc/vservers/$vserver/sched/interval2", - "/etc/vservers/$vserver/sched/tokens-min", "/etc/vservers/$vserver/sched/tokens-max", - "/etc/vservers/$vserver/sched/tokens", "/etc/vservers/$vserver/sched/idle-time"], + default: { + exec { "vattribute-${vserver}-${flag}" + command => "vattribute --set --xid `cat /etc/vservers/$vserver/context` --flag ~${flag}", refreshonly => true, - require => Exec["vs_create_${vserver}"], + require => exec["vs_create_${vserver}"], } } } |