Commit 7aa1e29b authored by Leigh B. Stoller's avatar Leigh B. Stoller

A set of minor changes for specifying deltas in the NS file.

parent 02d790b7
......@@ -161,7 +161,7 @@ foreach my $n (@node_names) {
# And clean out various tidbits from the nodes table.
$cmd = "update nodes set def_boot_cmd_line='',def_boot_path='',".
"startupcmd='',rpms='',def_boot_image_id='$defimageid' ".
"startupcmd='',rpms='',deltas='',def_boot_image_id='$defimageid' ".
"where node_id='$n'";
$sth = $dbh->query($cmd)
|| (print "Failed Command:\n$cmd\nError string is:".$dbh->errstr."\n"
......
......@@ -206,6 +206,19 @@ foreach (split("\n",&ir_get("/rpms"))) {
$sth->execute;
$sth->finish;
}
if (! &ir_exists("/deltas")) {
print STDERR "IR incomplete: No /deltas.\n";
exit(1);
}
foreach (split("\n",&ir_get("/deltas"))) {
($node,$deltas) = /^([^ ]+)(.*)$/;
$deltas =~ s/^ //;
$deltas =~ s/ /:/g;
$sth = $dbh->prepare("UPDATE nodes set deltas = \"$deltas\" ".
"where node_id = \"$nodemap{$node}\"");
$sth->execute;
$sth->finish;
}
foreach (values(%nodemap)) {
$node = $_;
......
......@@ -97,6 +97,7 @@ open(TBCMD,$tbcmdfile) || do {
$cmdlines = ();
$startups = ();
$rpms = ();
$deltas = ();
while (<TBCMD>) {
chop;
@line = split;
......@@ -180,8 +181,17 @@ while (<TBCMD>) {
next;
}
$startups{$line[1]} = join(" ",@line[2..$#line]);
} elsif ($line[0] eq "tb-set-node-deltas") {
if ($#line < 2) {
push(@ERRORS,"Syntax: tb-set-node-deltas node rpms...");
next;
}
if (! defined($nodes{$line[1]})) {
push(@ERRORS,"$line[1] is not a valid node.");
next;
}
$deltas{$line[1]} = join(" ",@line[2..$#line]);
}
}
close(TBCMD);
......@@ -282,5 +292,14 @@ foreach $node (keys(%nodes)) {
}
}
print IRFILE "END cmdline\n";
print IRFILE "START deltas\n";
foreach $node (keys(%nodes)) {
if (defined($deltas{$node})) {
print IRFILE "$node $deltas{$node}\n";
} else {
print IRFILE "$node\n";
}
}
print IRFILE "END deltas\n";
close IRFILE;
......@@ -90,6 +90,10 @@ proc tb-set-node-startup {node cmd} {
global TBCMD nodeid_map
puts $TBCMD "tb-set-node-startup $nodeid_map($node) $cmd"
}
proc tb-set-node-deltas {node args} {
global TBCMD nodeid_map
puts $TBCMD "tb-set-node-deltas $nodeid_map($node) $args"
}
# Show that we have loaded
set TB_COMPACT 1
......@@ -13,3 +13,4 @@ proc tb-set-lan-loss {lan rate} {}
proc tb-set-node-rpms {node args} {}
proc tb-set-node-startup {node cmd} {}
proc tb-set-node-cmdline {node cmd} {}
proc tb-set-node-deltas {node args} {}
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