Commit 17fd96c4 authored by Mac Newbold's avatar Mac Newbold

Fix the fix for not showing ixp hosts. Tested better now, too.

parent 6ca9093e
...@@ -135,7 +135,7 @@ setpriority(PRIO_PROCESS, 0, 15); ...@@ -135,7 +135,7 @@ setpriority(PRIO_PROCESS, 0, 15);
# read nodes # read nodes
my $result = DBQueryWarn("SELECT vname FROM virt_nodes " . my $result = DBQueryWarn("SELECT vname,fixed FROM virt_nodes " .
"WHERE pid='$pid' AND eid='$eid'"); "WHERE pid='$pid' AND eid='$eid'");
fatal("Failed to get virt_nodes info from DB") fatal("Failed to get virt_nodes info from DB")
...@@ -144,10 +144,30 @@ fatal("Failed to get virt_nodes info from DB") ...@@ -144,10 +144,30 @@ fatal("Failed to get virt_nodes info from DB")
my $nodes = (); my $nodes = ();
my $lans = (); my $lans = ();
my $links = (); my $links = ();
my $fixednodes = ();
# all virt_nodes are visualizer nodes of type "node" # all virt_nodes are visualizer nodes of type "node"
while (my ($vname) = $result->fetchrow) { while (my ($vname,$fixed) = $result->fetchrow) {
dprint "node $vname $fixed\t";
if (!defined($fixednodes{$vname})) {
# This node is not a parent node, so we can add it
$nodes{$vname}{"type"} = "node"; $nodes{$vname}{"type"} = "node";
dprint "added nodes($vname)\t";
} else {
dprint "$vname is a fixed host!\t";
}
if (defined($fixed) && $fixed ne "") {
# $vname is a subnode of $fixed, so we don't want
# to viz any vnames named $fixed
dprint "adding fixed($fixed)\t";
$fixednodes{$fixed} = $vname;
if (defined($nodes{$fixed})) {
# Remove the node if it is already there
delete $nodes{$fixed};
dprint "rm nodes($fixed)\t";
}
}
dprint "\n";
} }
# read lans # read lans
...@@ -160,7 +180,13 @@ fatal("Failed to get virt_lans info from DB") ...@@ -160,7 +180,13 @@ fatal("Failed to get virt_lans info from DB")
while (my ($vname, $member) = $result->fetchrow) { while (my ($vname, $member) = $result->fetchrow) {
$member =~ s/\:.*//; $member =~ s/\:.*//;
dprint "link $vname $member\t";
if (defined($nodes{$member})) {
# the node exists, so add the link
$lans{$vname}{$member} = 1; $lans{$vname}{$member} = 1;
dprint "added lans($vname)($member)\t";
}
dprint "\n";
} }
# construct links from lans # construct links from lans
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment