'vsconfig' => $row['vsconfig'],
);
unset ($result);
+ $record['rslist'] = array();
$query = "select id, inservice, inet_ntoa(rsip) as rsip, rsport, rsconfig from " .
"IPv4RS where rspool_id = ${record['id']} order by IPv4RS.rsip, rsport";
$result = useSelectBlade ($query, __FUNCTION__);
'rsconfig' => $row['rsconfig'],
);
unset ($result);
+ break;
+ case 'ipv4vs':
+ // Get the detailed composition of a particular virtual service, namely the list
+ // of all pools, each shown with the list of objects servicing it. VS/RS configs
+ // will be returned as well.
+ $record['rspool'] = array();
+ $query = "select pool.id, name, pool.vsconfig, pool.rsconfig, object_id, " .
+ "lb.vsconfig as lb_vsconfig, lb.rsconfig as lb_rsconfig from " .
+ "IPv4RSPool as pool left join IPv4LB as lb on pool.id = lb.rspool_id " .
+ "where vs_id = ${record['id']} order by pool.name, object_id";
+ $result = useSelectBlade ($query, __FUNCTION__);
+ while ($row = $result->fetch (PDO::FETCH_ASSOC))
+ {
+ if (!isset ($record['rspool'][$row['id']]))
+ $record['rspool'][$row['id']] = array
+ (
+ 'name' => $row['name'],
+ 'vsconfig' => $row['vsconfig'],
+ 'rsconfig' => $row['rsconfig'],
+ 'lblist' => array(),
+ );
+ if ($row['object_id'] == NULL)
+ continue;
+ $record['rspool'][$row['id']]['lblist'][$row['object_id']] = array
+ (
+ 'vsconfig' => $row['lb_vsconfig'],
+ 'rsconfig' => $row['lb_rsconfig'],
+ );
+ }
+ unset ($result);
+ break;
default:
}
}
return $ret;
}
-// Get the detailed composition of a particular virtual service, namely the list
-// of all pools, each shown with the list of objects servicing it. VS/RS configs
-// will be returned as well.
-function getVServiceInfo ($vsid = 0)
-{
- $query1 = "select id, inet_ntoa(vip) as vip, vport, proto, name, vsconfig, rsconfig " .
- "from IPv4VS where id = ${vsid}";
- $result = useSelectBlade ($query1, __FUNCTION__);
- $vsinfo = array ();
- $row = $result->fetch (PDO::FETCH_ASSOC);
- if (!$row)
- return NULL;
- foreach (array ('id', 'vip', 'vport', 'proto', 'name', 'vsconfig', 'rsconfig') as $cname)
- $vsinfo[$cname] = $row[$cname];
- $vsinfo['rspool'] = array();
- $result->closeCursor();
- unset ($result);
- $query2 = "select pool.id, name, pool.vsconfig, pool.rsconfig, object_id, " .
- "lb.vsconfig as lb_vsconfig, lb.rsconfig as lb_rsconfig from " .
- "IPv4RSPool as pool left join IPv4LB as lb on pool.id = lb.rspool_id " .
- "where vs_id = ${vsid} order by pool.name, object_id";
- $result = useSelectBlade ($query2, __FUNCTION__);
- while ($row = $result->fetch (PDO::FETCH_ASSOC))
- {
- if (!isset ($vsinfo['rspool'][$row['id']]))
- {
- $vsinfo['rspool'][$row['id']]['name'] = $row['name'];
- $vsinfo['rspool'][$row['id']]['vsconfig'] = $row['vsconfig'];
- $vsinfo['rspool'][$row['id']]['rsconfig'] = $row['rsconfig'];
- $vsinfo['rspool'][$row['id']]['lblist'] = array();
- }
- if ($row['object_id'] == NULL)
- continue;
- $vsinfo['rspool'][$row['id']]['lblist'][$row['object_id']] = array
- (
- 'vsconfig' => $row['lb_vsconfig'],
- 'rsconfig' => $row['lb_rsconfig']
- );
- }
- $result->closeCursor();
- return $vsinfo;
-}
-
function addRStoRSPool ($pool_id = 0, $rsip = '', $rsport = 0, $inservice = 'no', $rsconfig = '')
{
if ($pool_id <= 0)
case 'ipv4vs':
$page = 'ipv4vs';
$id_name = 'vs_id';
- $parent = getVServiceInfo($row['entity_id']);
+ $parent = spotEntity ($row['entity_type'], $row['entity_id']);
$name = $parent['name'];
break;
case 'object':
showError ('Invalid argument', __FUNCTION__);
return;
}
- $vsinfo = getVServiceInfo ($vsid);
+ $vsinfo = spotEntity ('ipv4vs', $vsid);
+ amplifyCell ($vsinfo);
echo '<table border=0 class=objectview cellspacing=0 cellpadding=0>';
if (!empty ($vsinfo['name']))
echo "<tr><td colspan=2 align=center><h1>${vsinfo['name']}</h1></td></tr>\n";
function renderVServiceLBForm ($vs_id)
{
global $nextorder;
- $vsinfo = getVServiceInfo ($vs_id);
+ $vsinfo = spotEntity ('ipv4vs', $vs_id);
+ amplifyCell ($vsinfo);
if (count ($vsinfo['rspool']))
{
function renderEditVService ($vsid)
{
- $vsinfo = getVServiceInfo ($vsid);
+ $vsinfo = spotEntity ('ipv4vs', $vsid);
+ amplifyCell ($vsinfo);
printOpFormIntro ('updIPv4VS');
echo '<table border=0 align=center>';
echo "<tr><th class=tdright>VIP:</th><td class=tdleft><input tabindex=1 type=text name=vip value='${vsinfo['vip']}'></td></tr>\n";
// FIXME: migrate to renderIPv4VSCell()
function renderVSCell ($vs_id)
{
- renderIPv4VSCell (getVServiceInfo ($vs_id));
+ renderIPv4VSCell (spotEntity ('ipv4vs', $vs_id));
}
function renderIPv4VSCell ($vsinfo)
);
case 'ipv4vs':
assertUIntArg ('vs_id', __FUNCTION__);
+ $tmp = spotEntity ('ipv4vs', $_REQUEST['vs_id']);
return array
(
- 'name' => buildVServiceName (getVServiceInfo ($_REQUEST['vs_id'])),
+ 'name' => $tmp['dname'],
'params' => array ('vs_id' => $_REQUEST['vs_id'])
);
case 'object':