r2167 - make SLB summary more narrow
authorDenis Ovsienko <infrastation@yandex.ru>
Fri, 22 Aug 2008 11:14:13 +0000 (11:14 +0000)
committerDenis Ovsienko <infrastation@yandex.ru>
Fri, 22 Aug 2008 11:14:13 +0000 (11:14 +0000)
 - produce correct redirect URLs for IPv4 addresses in search results
 - accept empty ports for real servers, use VS port for config generation in this case

inc/database.php
inc/functions.php
inc/interface.php
inc/ophandlers.php

index 85d5286..873de66 100644 (file)
@@ -2278,11 +2278,13 @@ function getRSPoolInfo ($id = 0)
 
 function addRStoRSPool ($pool_id = 0, $rsip = '', $rsport = 0, $inservice = 'no', $rsconfig = '')
 {
-       if ($pool_id <= 0 or $rsport <= 0)
+       if ($pool_id <= 0)
        {
                showError ('Invalid arguments', __FUNCTION__);
                die;
        }
+       if (empty ($rsport) or $rsport == 0)
+               $rsport = 'NULL';
        return useInsertBlade
        (
                'IPRealServer',
@@ -2371,7 +2373,7 @@ function commitDeleteLB ($object_id = 0, $pool_id = 0, $vs_id = 0)
 
 function commitUpdateRS ($rsid = 0, $rsip = '', $rsport = 0, $rsconfig = '')
 {
-       if ($rsid <= 0 or $rsport <= 0)
+       if ($rsid <= 0)
        {
                showError ('Invalid args', __FUNCTION__);
                die;
@@ -2381,6 +2383,8 @@ function commitUpdateRS ($rsid = 0, $rsip = '', $rsport = 0, $rsconfig = '')
                showError ("Invalid IP address '${rsip}'", __FUNCTION__);
                die;
        }
+       if (empty ($rsport) or $rsport == 0)
+               $rsport = 'NULL';
        global $dbxlink;
        $query =
                "update IPRealServer set rsip = inet_aton('${rsip}'), rsport = ${rsport}, rsconfig = " .
index 0f33eb0..9db6790 100644 (file)
@@ -1330,6 +1330,8 @@ function buildLVSConfig ($object_id = 0)
                );
                foreach ($vsinfo['rslist'] as $rs)
                {
+                       if (empty ($rs['rsport']))
+                               $rs['rsport'] = $vsinfo['vport'];
                        $macros['%RSIP%'] = $rs['rsip'];
                        $macros['%RSPORT%'] = $rs['rsport'];
                        $newconfig .=  "\treal_server ${rs['rsip']} ${rs['rsport']} {\n";
index 34bd86a..eaa642d 100644 (file)
@@ -2034,9 +2034,9 @@ function renderIPv4SLB ()
                                else
                                {
                                        echo $vsdata['lblist'][$lb_object_id]['size'];
-                                       echo " (<a href='${root}?page=ipv4rsp&pool_id=";
-                                       echo $vsdata['lblist'][$lb_object_id]['id'] . "'>";
-                                       echo $vsdata['lblist'][$lb_object_id]['name'] . '</a>)';
+//                                     echo " (<a href='${root}?page=ipv4rsp&pool_id=";
+//                                     echo $vsdata['lblist'][$lb_object_id]['id'] . "'>";
+//                                     echo $vsdata['lblist'][$lb_object_id]['name'] . '</a>)';
                                }
                                echo '</td>';
                        }
@@ -2885,14 +2885,14 @@ function renderSearchResults ()
                        case 'ipv4addressbydq':
                                $parentnet = getIPv4AddressNetworkId ($record);
                                if ($parentnet !== NULL)
-                                       echo "<script language='Javascript'>document.location='${root}?page=iprange&id=${parentnet}&hl_ipv4_addr=${record}';//</script>";
+                                       echo "<script language='Javascript'>document.location='${root}?page=iprange&tab=default&id=${parentnet}&hl_ipv4_addr=${record}';//</script>";
                                else
                                        echo "<script language='Javascript'>document.location='${root}?page=ipaddress&ip=${record}';//</script>";
                                break;
                        case 'ipv4addressbydescr':
                                $parentnet = getIPv4AddressNetworkId ($record['ip']);
                                if ($parentnet !== NULL)
-                                       echo "<script language='Javascript'>document.location='${root}?page=iprange&id=${parentnet}&hl_ipv4_addr=${record['ip']}';//</script>";
+                                       echo "<script language='Javascript'>document.location='${root}?page=iprange&tab=default&id=${parentnet}&hl_ipv4_addr=${record['ip']}';//</script>";
                                else
                                        echo "<script language='Javascript'>document.location='${root}?page=ipaddress&ip=${record['ip']}';//</script>";
                                break;
index f99e72d..4c40d45 100644 (file)
@@ -822,7 +822,7 @@ function addRealServer ()
 {
        assertUIntArg ('pool_id', __FUNCTION__);
        assertIPv4Arg ('remoteip', __FUNCTION__);
-       assertUIntArg ('rsport', __FUNCTION__);
+       assertStringArg ('rsport', __FUNCTION__, TRUE);
        assertStringArg ('rsconfig', __FUNCTION__, TRUE);
        if (!addRStoRSPool (
                $_REQUEST['pool_id'],
@@ -951,7 +951,7 @@ function updateRealServer ()
 {
        assertUIntArg ('rs_id', __FUNCTION__);
        assertIPv4Arg ('rsip', __FUNCTION__);
-       assertUIntArg ('rsport', __FUNCTION__);
+       assertStringArg ('rsport', __FUNCTION__, TRUE);
        assertStringArg ('rsconfig', __FUNCTION__, TRUE);
        if (!commitUpdateRS (
                $_REQUEST['rs_id'],