Commit 5f0c970b authored by Mike Hibler's avatar Mike Hibler

Argh! I couldn't take it any longer: start vnodes in numeric order!

No more 1,10,11..19,2,20,21...
parent 0b847cfb
#!/usr/bin/perl -w
#
# Copyright (c) 2000-2014 University of Utah and the Flux Group.
# Copyright (c) 2000-2015 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -194,6 +194,20 @@ foreach my $str (@tmccresults) {
}
}
#
# Sort by vnode number if it follows are convention. We need this because
# we don't use a fixed field width for the vnode number.
# XXX I am sure there are more perl-ish ways to do this.
#
sub byvnode {
if ($a =~ /^(.*)-(\d+)$/ && ($apre = $1) && ($anum = $2) &&
$b =~ /^(.*)-(\d+)$/ && ($bpre = $1) && ($bnum = $2) &&
$apre eq $bpre) {
return $anum <=> $bnum;
}
return $a cmp $b;
}
#
# If doing a reconfig, get the current set of vnodes that are running.
# We want to compare that list against the list we just got from tmcd.
......@@ -219,7 +233,7 @@ if ($reconfig) {
# Reboot nodes that are running and in the current list from tmcd.
# Kill nodes that are running but not in the current list from tmcd.
#
foreach my $vnode (sort(keys(%curvnodelist))) {
foreach my $vnode (sort byvnode keys(%curvnodelist)) {
if (exists($newvnodelist{$vnode})) {
bootvnode($vnode,
(defined($action) ? $action : "reboot"),
......@@ -242,7 +256,7 @@ exit(0)
prebootvnodes(\%curvnodelist, \%newvnodelist)
if (!$fakejails);
foreach my $vnode (sort(keys(%newvnodelist))) {
foreach my $vnode (sort byvnode keys(%newvnodelist)) {
# Blocks until mostly setup.
bootvnode($vnode, "boot", $newvnodelist{$vnode});
}
......
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