Commit 46a1bf2b authored by Leigh Stoller's avatar Leigh Stoller

Support for getloadinfo returning a list of more then 1, as when doinf

image deltas. Canonicalize name to remove , and : which are valid in file
names but not in LVM name (sheesh), and must be converted to dashes.
parent 423fee47
...@@ -374,11 +374,6 @@ $vnconfig{"fwconfig"} = {"fwinfo" => $fwinfo, ...@@ -374,11 +374,6 @@ $vnconfig{"fwconfig"} = {"fwinfo" => $fwinfo,
"fwrules" => \@fwrules, "fwrules" => \@fwrules,
"fwhosts" => \@fwhosts}; "fwhosts" => \@fwhosts};
if ($debug) {
print "VN Config:\n";
print Dumper(\%vnconfig);
}
# #
# see if we 1) are supposed to be "booting" into the reload mfs, and 2) if # see if we 1) are supposed to be "booting" into the reload mfs, and 2) if
# we have loadinfo. Need both to reload! # we have loadinfo. Need both to reload!
...@@ -397,15 +392,39 @@ if (scalar(@tmp) && exists($tmp[0]->{"WHAT"})) { ...@@ -397,15 +392,39 @@ if (scalar(@tmp) && exists($tmp[0]->{"WHAT"})) {
if (!scalar(@tmp)) { if (!scalar(@tmp)) {
fatal("vnode $vnodeid in reloading, but got no loadinfo!"); fatal("vnode $vnodeid in reloading, but got no loadinfo!");
} }
#
# Loadinfo can now be a list, when loading deltas. Actually, I suppose
# we could support loading multiple partitions, but other stuff would
# have to change for that to work, so not going there right now.
#
$vnconfig{"reloadinfo"} = \@tmp;
#
# But the image we eventually boot is in jailconfig.
# Sheesh, LVM names cannot include comma or colon.
#
if (VNCONFIG('IMAGENAME') =~ /^([-\w]+),([-\w]+),([-\w]+)$/) {
$vnconfig{"image"} = "$1-$2-$3";
}
elsif (VNCONFIG('IMAGENAME') =~ /^([-\w]+),([-\w]+),([^:]+):(\d+)$/) {
$vnconfig{"image"} = "$1-$2-$3-$4";
}
else { else {
if ($tmp[0]->{"IMAGEID"} =~ fatal("vnode $vnodeid in reloading, but got bogus IMAGENAME " .
/^([-\d\w]+),([-\d\w]+),([-\d\w\.]+)$/) { VNCONFIG('IMAGENAME') . " from jailconf!");
$vnconfig{"reloadinfo"} = $tmp[0]; }
$vnconfig{"image"} = "$1-$2-$3"; #
# Apply the same transform to each loadinfo so that we do not have
# duplicate it in the library,
#
foreach my $ref (@tmp) {
if ($ref->{'IMAGEID'} =~ /^([-\w]+),([-\w]+),([-\w]+)$/) {
$ref->{'IMAGENAME'} = "$1-$2-$3";
}
elsif ($ref->{'IMAGEID'} =~ /^([-\w]+),([-\w]+),([^:]+):(\d+)$/) {
$ref->{'IMAGENAME'} = "$1-$2-$3-$4";
} }
else { else {
fatal("vnode $vnodeid in reloading, but got bogus IMAGEID " . fatal("Bad IMAGEID in loadinfo");
$tmp[0]->{"IMAGEID"} . " from loadinfo!");
} }
} }
} }
...@@ -416,15 +435,25 @@ if (scalar(@tmp) && exists($tmp[0]->{"WHAT"})) { ...@@ -416,15 +435,25 @@ if (scalar(@tmp) && exists($tmp[0]->{"WHAT"})) {
# the jailconfig to see what image should boot. That image better # the jailconfig to see what image should boot. That image better
# be resident already. # be resident already.
# #
# Sheesh, LVM names cannot include comma or colon.
#
if (VNCONFIG('IMAGENAME') =~ /^([-\w]+),([-\w]+),([-\w]+)$/) { if (VNCONFIG('IMAGENAME') =~ /^([-\w]+),([-\w]+),([-\w]+)$/) {
$vnconfig{"image"} = "$1-$2-$3"; $vnconfig{"image"} = "$1-$2-$3";
} }
elsif (VNCONFIG('IMAGENAME') =~ /^([-\w]+),([-\w]+),([^:]+):(\d+)$/) {
$vnconfig{"image"} = "$1-$2-$3-$4";
}
} }
else { else {
# The library will boot the default, whatever that is. # The library will boot the default, whatever that is.
} }
} }
if ($debug) {
print "VN Config:\n";
print Dumper(\%vnconfig);
}
# #
# Install a signal handler. We can get signals from vnodesetup. # Install a signal handler. We can get signals from vnodesetup.
# #
......
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