Commit f1ba32f4 authored by Jonathon Duerig's avatar Jonathon Duerig
Browse files

Added a '-f' option to fix remaining_bandwidth problems.

Integrated into install process. Now it is a part of the exclusive sbin club.
parent f46a463d
......@@ -28,7 +28,7 @@ SBIN_SCRIPTS = vlandiff vlansync withadminprivs export_tables cvsupd.pl \
dumpdescriptor subboss_tftpboot_sync testbed-control \
archive-expinfo grantfeature emulabfeature addblob readblob \
prereserve grantimage getimages localize_mfs \
management_iface sharevlan
management_iface sharevlan check-shared-bw
WEB_SBIN_SCRIPTS= webnewnode webdeletenode webspewconlog webarchive_list \
webwanodecheckin webspewimage
......
......@@ -3,11 +3,21 @@
# Checks to see if the bandwidth remaining on shared interfaces
# matches the maximum capacity - used capacity for those interfaces
# Usage: check-shared-bw.in
# Usage: check-shared-bw [-f]
#
# -f -- Fix any problems encountered.
our $TB = "/usr/testbed";
$shouldFix = 0;
if (scalar(@ARGV) == 1 && $ARGV[0] eq "-f") {
$shouldFix = 1;
} elsif (scalar(@ARGV) > 0) {
print STDERR "Usage: check-shared-bw [-f]\n";
exit(1);
}
our $TB = "@prefix@";
use lib "/usr/testbed/lib";
use lib "@prefix@/lib";
use libdb;
# Get max bandwidth for interface types on all matching nodes
......@@ -53,6 +63,14 @@ foreach my $key (sort(keys(%iface_remaining))) {
} elsif ($iface_bw{$key} != $iface_remaining{$key}) {
print STDERR "$key\thas\t" . $iface_remaining{$key} .
"\tshould have\t" . $iface_bw{$key} . "\n";
if ($shouldFix) {
my ($node, $iface) = split(":", $key);
my $query = "update interface_state " .
"set remaining_bandwidth=" . $iface_bw{$key} . " " .
"where node_id='$node' and iface='$iface'";
print "Running: " . $query . "\n";
DBQueryFatal($query);
}
}
}
......
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