diff options
Diffstat (limited to 'manifests')
-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}"], } } } |