From d30afa6092c0abd129fd72aa59437b7673cfceb0 Mon Sep 17 00:00:00 2001 From: jim-p Date: Mon, 27 Jun 2011 12:09:22 -0400 Subject: In upgrade code for server load balancing, set redirect_mode. Also in the backend code, assume redirect_mode as the default if it's not set. --- etc/inc/upgrade_config.inc | 2 ++ etc/inc/vslb.inc | 26 +++++++++++++------------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/etc/inc/upgrade_config.inc b/etc/inc/upgrade_config.inc index 1b9ed17..8159638 100644 --- a/etc/inc/upgrade_config.inc +++ b/etc/inc/upgrade_config.inc @@ -897,6 +897,8 @@ function upgrade_045_to_046() { } /* Convert sitedown entries to pools and re-attach */ for ($i = 0; isset($vs_a[$i]); $i++) { + /* Set mode while we're here. */ + $vs_a[$i]['mode'] = "redirect_mode"; if (isset($vs_a[$i]['sitedown'])) { $pool = array(); $pool['type'] = 'server'; diff --git a/etc/inc/vslb.inc b/etc/inc/vslb.inc index 980bcd0..c26b785 100644 --- a/etc/inc/vslb.inc +++ b/etc/inc/vslb.inc @@ -237,7 +237,19 @@ function relayd_configure() { if(is_array($vs_a)) { for ($i = 0; isset($vs_a[$i]); $i++) { switch($vs_a[$i]['mode']) { - case 'redirect_mode': { + case 'relay': + $conf .= "relay \"{$vs_a[$i]['name']}\" {\n"; + $conf .= " listen on {$vs_a[$i]['ipaddr']} port {$vs_a[$i]['port']}\n"; + $conf .= " protocol \"{$vs_a[$i]['relay_protocol']}\"\n"; + $conf .= " forward to <{$vs_a[$i]['pool']}> port {$pools[$vs_a[$i]['pool']]['port']} {$check_a[$pools[$vs_a[$i]['pool']]['monitor']]} \n"; + + if (isset($vs_a[$i]['sitedown']) && strlen($vs_a[$i]['sitedown']) > 0) + $conf .= " forward to <{$vs_a[$i]['sitedown']}> port {$pools[$vs_a[$i]['pool']]['port']} {$check_a[$pools[$vs_a[$i]['pool']]['monitor']]} \n"; + $conf .= "}\n"; + break; + /* Default to Redirect Mode */ + case 'redirect_mode': + default: $conf .= "redirect \"{$vs_a[$i]['name']}\" {\n"; $conf .= " listen on {$vs_a[$i]['ipaddr']} port {$vs_a[$i]['port']}\n"; $conf .= " forward to <{$vs_a[$i]['pool']}> port {$pools[$vs_a[$i]['pool']]['port']} {$check_a[$pools[$vs_a[$i]['pool']]['monitor']]} \n"; @@ -251,18 +263,6 @@ function relayd_configure() { $conf .= "}\n"; break; - } - case 'relay': { - $conf .= "relay \"{$vs_a[$i]['name']}\" {\n"; - $conf .= " listen on {$vs_a[$i]['ipaddr']} port {$vs_a[$i]['port']}\n"; - $conf .= " protocol \"{$vs_a[$i]['relay_protocol']}\"\n"; - $conf .= " forward to <{$vs_a[$i]['pool']}> port {$pools[$vs_a[$i]['pool']]['port']} {$check_a[$pools[$vs_a[$i]['pool']]['monitor']]} \n"; - - if (isset($vs_a[$i]['sitedown']) && strlen($vs_a[$i]['sitedown']) > 0) - $conf .= " forward to <{$vs_a[$i]['sitedown']}> port {$pools[$vs_a[$i]['pool']]['port']} {$check_a[$pools[$vs_a[$i]['pool']]['monitor']]} \n"; - $conf .= "}\n"; - break; - } } } } -- cgit v1.1