Example #1
0
function renderVirtualResourcesSummary()
{
    global $pageno, $nextorder;
    echo "<table border=0 class=objectview>\n";
    echo "<tr><td class=pcleft>";
    $clusters = getVMClusterSummary();
    startPortlet('Clusters (' . count($clusters) . ')');
    if (count($clusters) > 0) {
        echo "<table border=0 cellpadding=5 cellspacing=0 align=center class=cooltable>\n";
        echo "<tr><th>Cluster</th><th>Hypervisors</th><th>Resource Pools</th><th>Cluster VMs</th><th>RP VMs</th><th>Total VMs</th></tr>\n";
        $order = 'odd';
        foreach ($clusters as $cluster) {
            $total_vms = $cluster['cluster_vms'] + $cluster['resource_pool_vms'];
            echo "<tr class=row_{$order} valign=top>";
            echo '<td class="tdleft">' . mkA("<strong>{$cluster['name']}</strong>", 'object', $cluster['id']) . '</td>';
            echo "<td class='tdleft'>{$cluster['hypervisors']}</td>";
            echo "<td class='tdleft'>{$cluster['resource_pools']}</td>";
            echo "<td class='tdleft'>{$cluster['cluster_vms']}</td>";
            echo "<td class='tdleft'>{$cluster['resource_pool_vms']}</td>";
            echo "<td class='tdleft'>{$total_vms}</td>";
            echo "</tr>\n";
            $order = $nextorder[$order];
        }
        echo "</table>\n";
    } else {
        echo '<b>No clusters exist</b>';
    }
    finishPortlet();
    echo "</td><td class=pcright>";
    $pools = getVMResourcePoolSummary();
    startPortlet('Resource Pools (' . count($pools) . ')');
    if (count($pools) > 0) {
        echo "<table border=0 cellpadding=5 cellspacing=0 align=center class=cooltable>\n";
        echo "<tr><th>Pool</th><th>Cluster</th><th>VMs</th></tr>\n";
        $order = 'odd';
        foreach ($pools as $pool) {
            echo "<tr class=row_{$order} valign=top>";
            echo '<td class="tdleft">' . mkA("<strong>{$pool['name']}</strong>", 'object', $pool['id']) . '</td>';
            echo '<td class="tdleft">';
            if ($pool['cluster_id']) {
                echo mkA("<strong>{$pool['cluster_name']}</strong>", 'object', $pool['cluster_id']);
            }
            echo '</td>';
            echo "<td class='tdleft'>{$pool['VMs']}</td>";
            echo "</tr>\n";
            $order = $nextorder[$order];
        }
        echo "</table>\n";
    } else {
        echo '<b>No pools exist</b>';
    }
    finishPortlet();
    echo "</td></tr><tr><td class=pcleft>";
    $hypervisors = getVMHypervisorSummary();
    startPortlet('Hypervisors (' . count($hypervisors) . ')');
    if (count($hypervisors) > 0) {
        echo "<table border=0 cellpadding=5 cellspacing=0 align=center class=cooltable>\n";
        echo "<tr><th>Hypervisor</th><th>Cluster</th><th>VMs</th></tr>\n";
        $order = 'odd';
        foreach ($hypervisors as $hypervisor) {
            echo "<tr class=row_{$order} valign=top>";
            echo '<td class="tdleft">' . mkA("<strong>{$hypervisor['name']}</strong>", 'object', $hypervisor['id']) . '</td>';
            echo '<td class="tdleft">';
            if ($hypervisor['cluster_id']) {
                echo mkA("<strong>{$hypervisor['cluster_name']}</strong>", 'object', $hypervisor['cluster_id']);
            }
            echo '</td>';
            echo "<td class='tdleft'>{$hypervisor['VMs']}</td>";
            echo "</tr>\n";
            $order = $nextorder[$order];
        }
        echo "</table>\n";
    } else {
        echo '<b>No hypervisors exist</b>';
    }
    finishPortlet();
    echo "</td><td class=pcright>";
    $switches = getVMSwitchSummary();
    startPortlet('Virtual Switches (' . count($switches) . ')');
    if (count($switches) > 0) {
        echo "<table border=0 cellpadding=5 cellspacing=0 align=center class=cooltable>\n";
        echo "<tr><th>Name</th></tr>\n";
        $order = 'odd';
        foreach ($switches as $switch) {
            echo "<tr class=row_{$order} valign=top>";
            echo '<td class="tdleft">' . mkA("<strong>{$switch['name']}</strong>", 'object', $switch['id']) . '</td>';
            echo "</tr>\n";
            $order = $nextorder[$order];
        }
        echo "</table>\n";
    } else {
        echo '<b>No virtual switches exist</b>';
    }
    finishPortlet();
    echo "</td></tr></table>\n";
}
Example #2
0
function renderVirtualResourcesSummary()
{
    global $pageno, $nextorder;
    echo "<table border=0 class=objectview>\n";
    echo "<tr><td class=pcleft>";
    $clusters = getVMClusterSummary();
    startPortlet('Clusters (' . count($clusters) . ')');
    if (count($clusters) > 0) {
        echo "<table border=0 cellpadding=5 cellspacing=0 align=center class=cooltable>\n";
        echo "<tr><th>Cluster</th><th>Hypervisors</th><th>VMs</th></tr>\n";
        $order = 'odd';
        foreach ($clusters as $cluster) {
            echo "<tr class=row_{$order} valign=top><td class='tdleft'><a href='" . makeHref(array('page' => 'object', 'object_id' => $cluster['id'])) . "'><strong>{$cluster['name']}</strong></a></td>";
            echo "<td class='tdleft'>{$cluster['hypervisors']}</td>";
            echo "<td class='tdleft'>{$cluster['VMs']}</td>";
            echo "</tr>\n";
            $order = $nextorder[$order];
        }
        echo "</table>\n";
    } else {
        echo '<b>No clusters exist</b>';
    }
    finishPortlet();
    echo "</td><td class=pcright>";
    $pools = getVMResourcePoolSummary();
    startPortlet('Resource Pools (' . count($pools) . ')');
    if (count($pools) > 0) {
        echo "<table border=0 cellpadding=5 cellspacing=0 align=center class=cooltable>\n";
        echo "<tr><th>Pool</th><th>Cluster</th><th>VMs</th></tr>\n";
        $order = 'odd';
        foreach ($pools as $pool) {
            echo "<tr class=row_{$order} valign=top><td class='tdleft'><a href='" . makeHref(array('page' => 'object', 'object_id' => $pool['id'])) . "'><strong>{$pool['name']}</strong></a></td>";
            echo "<td class='tdleft'><a href='" . makeHref(array('page' => 'object', 'object_id' => $pool['cluster_id'])) . "'><strong>{$pool['cluster_name']}</strong></a></td>";
            echo "<td class='tdleft'>{$pool['VMs']}</td>";
            echo "</tr>\n";
            $order = $nextorder[$order];
        }
        echo "</table>\n";
    } else {
        echo '<b>No pools exist</b>';
    }
    finishPortlet();
    echo "</td></tr><tr><td class=pcleft>";
    $hypervisors = getVMHypervisorSummary();
    startPortlet('Hypervisors (' . count($hypervisors) . ')');
    if (count($hypervisors) > 0) {
        echo "<table border=0 cellpadding=5 cellspacing=0 align=center class=cooltable>\n";
        echo "<tr><th>Hypervisor</th><th>Cluster</th><th>VMs</th></tr>\n";
        $order = 'odd';
        foreach ($hypervisors as $hypervisor) {
            echo "<tr class=row_{$order} valign=top><td class='tdleft'><a href='" . makeHref(array('page' => 'object', 'object_id' => $hypervisor['id'])) . "'><strong>{$hypervisor['name']}</strong></a></td>";
            echo "<td class='tdleft'><a href='" . makeHref(array('page' => 'object', 'object_id' => $hypervisor['cluster_id'])) . "'><strong>{$hypervisor['cluster_name']}</strong></a></td>";
            echo "<td class='tdleft'>{$hypervisor['VMs']}</td>";
            echo "</tr>\n";
            $order = $nextorder[$order];
        }
        echo "</table>\n";
    } else {
        echo '<b>No hypervisors exist</b>';
    }
    finishPortlet();
    echo "</td><td class=pcright>";
    $switches = getVMSwitchSummary();
    startPortlet('Virtual Switches (' . count($switches) . ')');
    if (count($switches) > 0) {
        echo "<table border=0 cellpadding=5 cellspacing=0 align=center class=cooltable>\n";
        echo "<tr><th>Name</th></tr>\n";
        $order = 'odd';
        foreach ($switches as $switch) {
            echo "<tr class=row_{$order} valign=top><td class='tdleft'><a href='" . makeHref(array('page' => 'object', 'object_id' => $switch['id'])) . "'><strong>{$switch['name']}</strong></a></td>";
            echo "</tr>\n";
            $order = $nextorder[$order];
        }
        echo "</table>\n";
    } else {
        echo '<b>No virtual switches exist</b>';
    }
    finishPortlet();
    echo "</td></tr></table>\n";
}