Commit 942cdc07 authored by Leigh B. Stoller's avatar Leigh B. Stoller
Browse files

Remove some special handling for the nsfiles table; make it part

of virt_tables so that it is saved and restored like the rest of
the virtual state.
parent 1b208ab0
......@@ -493,7 +493,7 @@ sub TBDB_WIDEAREA_LOCALNODE { "boss"; }
#
# We should list all of the DB limits.
#
sub DBLIMIT_NSFILESIZE() { (1024 * 16); }
sub DBLIMIT_NSFILESIZE() { (2**16 - 1); }
#
# Virtual nodes must operate within a restricted port range. The range
......@@ -2548,9 +2548,6 @@ sub TBExptDestroy($$)
#
# Remove all trace from the DB.
#
DBQueryWarn("DELETE from nsfiles ".
"WHERE eid='$eid' and pid='$pid'");
DBQueryWarn("DELETE from exppid_access ".
"WHERE exp_eid='$eid' and exp_pid='$pid'");
......@@ -2627,7 +2624,8 @@ sub TBGetSiteVar($)
"virt_node_desires",
"nseconfigs",
"eventlist",
"ipsubnets");
"ipsubnets",
"nsfiles");
@physicalTables = ("delays",
"vlans",
......
......@@ -284,25 +284,6 @@ if (system("$parser -n $pid $gid $eid $nsfile") != 0) {
fatal("NS Parse failed!");
}
#
# Shove a copy of the NS file into the DB to make Mike happy.
#
$nsfile_string = `cat $nsfile`;
if ($nsfile_string) {
$nsfile_string = DBQuoteSpecial($nsfile_string);
DBQueryWarn("delete from nsfiles WHERE eid='$eid' and pid='$pid'");
#
# I could strlen check the string, but the webserver has a limit,
# plus the DB is going to truncate it if its longer. Doing it here
# would be a third (call it redundant) check.
#
DBQueryWarn("insert into nsfiles (pid, eid, nsfile) ".
"VALUES('$pid', '$eid', $nsfile_string)");
}
#
# A batch experiment is essentially preloaded (frontend mode) and then
# dropped into the batch queue, unless the user requested only preload.
......
......@@ -729,24 +729,6 @@ if ($batch) {
exit(0);
}
#
# HACK! if successful, put new NS file in DB.
#
if ($inout eq "modify") {
$nsdata_string = `cat $modnsfile`;
if (defined($nsdata_string)) {
$nsdata_string = DBQuoteSpecial($nsdata_string);
DBQueryWarn("delete from nsfiles WHERE eid='$eid' and pid='$pid'");
DBQueryWarn("insert into nsfiles (pid, eid, nsfile) ".
"VALUES('$pid', '$eid', $nsdata_string)");
}
else {
print "Warning!! Could not read nsfile '$modnsfile'!\n";
}
}
#
# Clear the log file so the web page stops spewing.
#
......
......@@ -122,6 +122,28 @@ if (system("parse-ns $pid $gid $eid $nsfile")) {
TBDebugTimeStamp("parser finished");
print "Parser done! " . TBTimeStamp() . "\n";
#
# Put the nsfile into the DB, now that we know it parses okay.
#
$nsfile_string = `cat $nsfile`;
if ($nsfile_string) {
$nsfile_string = DBQuoteSpecial($nsfile_string);
if (length($nsfile_string) >= DBLIMIT_NSFILESIZE()) {
cleanup();
die("*** $0:\n".
" NS File is way too big!\n");
}
if (!DBQueryWarn("delete from nsfiles where eid='$eid' and pid='$pid'") ||
!DBQueryWarn("insert into nsfiles (pid, eid, nsfile) ".
"VALUES('$pid', '$eid', $nsfile_string)")) {
cleanup();
die("*** $0:\n".
" Error storing the NS file into the database!\n");
}
}
TBDebugTimeStamp("prerender started in background");
print "Precomputing visualization ...\n";
system("prerender -t $pid $eid");
......
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