r1542 + fixed SLB tactical overview
authorDenis Ovsienko <infrastation@yandex.ru>
Tue, 15 Jan 2008 23:05:46 +0000 (23:05 +0000)
committerDenis Ovsienko <infrastation@yandex.ru>
Tue, 15 Jan 2008 23:05:46 +0000 (23:05 +0000)
inc/database.php
inc/interface.php

index 1a5dffd449f21af46985696111ed84d5f7e7636f..789ab56182768581713d74e40647893a3a273fca 100644 (file)
@@ -2007,6 +2007,12 @@ function getSLBSummary ()
                'inner join IPRSPool as rsp on lb.rspool_id = rsp.id ' .
                'inner join IPRealServer as rs on lb.rspool_id = rs.rspool_id ' .
                'group by rsp.id, object_id order by vip, object_id';
+       $query = 'select vs.id as vsid, inet_ntoa(vip) as vip, vport, proto, vs.name, object_id, ' .
+               'lb.rspool_id, pool.name as pool_name, count(rs.id) as rscount ' .
+               'from IPVirtualService as vs inner join IPLoadBalancer as lb on vs.id = lb.vs_id ' .
+               'inner join IPRSPool as pool on rspool_id = pool.id ' .
+               'left join IPRealServer as rs on rs.rspool_id = lb.rspool_id ' .
+               'group by vs.id, object_id order by vs.vip, object_id';
        $result = $dbxlink->query ($query);
        if ($result == NULL)
        {
@@ -2026,7 +2032,13 @@ function getSLBSummary ()
                                $ret[$vsid][$cname] = $row[$cname];
                        $ret[$vsid]['lblist'] = array();
                }
-               $ret[$vsid]['lblist'][$row['object_id']][$row['pool_id']] = array ('size' => $row['rscount'], 'name' => $row['pool_name']);
+               // There's only one assigned RS pool possible for each LB-VS combination.
+               $ret[$vsid]['lblist'][$row['object_id']] = array
+               (
+                       'id' => $row['rspool_id'],
+                       'size' => $row['rscount'],
+                       'name' => $row['pool_name']
+               );
        }
        $result->closeCursor();
        return $ret;
index 5687a32c6e0be60e0670bd1cff90c0aadd4628ec..dad72bb36cd57d77340c479c8bd61c4603c711a1 100644 (file)
@@ -1657,15 +1657,15 @@ function renderAddressspace ()
 
        echo "</td>\n<td class=pcright>";
 
-       startPortlet ('SLB details');
+       startPortlet ('SLB configuration');
        echo "<table border=0 width='100%'><tr>";
        foreach (array ('vservices', 'rspools', 'rservers', 'lbs') as $pno)
                echo "<td><h3><a href='${root}?page=${pno}'>" . $page[$pno]['title'] . "</a></h3></td>";
        echo '</tr></table>';
        finishPortlet();
 
-       startPortlet ('current SLB setup');
        $summary = getSLBSummary();
+       startPortlet ('SLB tactical overview');
        // A single id-keyed array isn't used here to preserve existing
        // order of LBs returned by getSLBSummary()
        $lblist = array();
@@ -1683,7 +1683,7 @@ function renderAddressspace ()
        else
        {
                echo "<table class='widetable' border=0 cellpadding=5 cellspacing=0 align='center'>\n";
-               echo "<tr><th>VIP</th><th>Name</th>";
+               echo "<tr><th>VS</th>";
                foreach ($lblist as $lb_object_id)
                        echo "<th><a href='${root}?page=object&tab=default&object_id=${lb_object_id}'>" . $lbdname[$lb_object_id]  . "</a></th>";
                echo "</tr>\n";
@@ -1691,18 +1691,22 @@ function renderAddressspace ()
                {
                        echo "<tr><td class=tdleft><a href='$root?page=vservice&tab=default&id=${vsid}'>";
                        echo buildVServiceName ($vsdata);
-                       echo "</td><td>${vsdata['name']}</td>";
+                       echo '</a>';
+                       if (!empty ($vsdata['name']))
+                               echo " (${vsdata['name']})";
+                       echo "</td>";
                        foreach ($lblist as $lb_object_id)
                        {
                                echo '<td>';
                                if (!isset ($vsdata['lblist'][$lb_object_id]))
                                        echo '&nbsp;';
                                else
-                                       foreach ($vsdata['lblist'][$lb_object_id] as $pool_id => $pool_info)
-                                       {
-                                               echo $pool_info['size'] . "@(<a href='${root}?page=rspool&id=${pool_id}'>";
-                                               echo $pool_info['name'] . '</a>)';
-                                       }
+                               {
+                                       echo $vsdata['lblist'][$lb_object_id]['size'];
+                                       echo "@(<a href='${root}?page=rspool&id=";
+                                       echo $vsdata['lblist'][$lb_object_id]['id'] . "'>";
+                                       echo $vsdata['lblist'][$lb_object_id]['name'] . '</a>)';
+                               }
                                echo '</td>';
                        }
                        echo "</tr>\n";