Commit 31e17da2 authored by Mike Hibler's avatar Mike Hibler

Print a less obtuse error if they attempt to image an "empty" partition.

This is in the node type check where we look at what is currently in the
partition they are imaging, and base the set of valid node type on that.
However, if they specify a partition that doesn't currently have an image,
we would previously effectively tell them that the image will not run on
the node type that it is currently running on!

Now we just say "there is no current image in that partition."
parent 9de52c35
......@@ -538,22 +538,25 @@ if (!$isadmin && defined($node_id)) {
DBQueryFatal("select oi.type from osidtoimageid as oi ".
"left join partitions as p on oi.osid=p.osid ".
"where p.node_id='$node_id' and p.partition=$loadpart");
my %otypes;
while (my ($ntype) = $query_result->fetchrow_array()) {
$otypes{$ntype} = 1;
}
my @invalid_node_types;
foreach my $ntype (@mtype_keys) {
$ntype =~ s/^mtype_//;
if (!exists($otypes{$ntype})) {
push @invalid_node_types, $ntype;
if ($query_result->numrows != 0) {
my %otypes;
while (my ($ntype) = $query_result->fetchrow_array()) {
$otypes{$ntype} = 1;
}
}
if (@invalid_node_types) {
UserError("Node Types: Current image on $node_id".
" cannot run on the following node types: ".
join(' ', @invalid_node_types));
my @invalid_node_types;
foreach my $ntype (@mtype_keys) {
$ntype =~ s/^mtype_//;
if (!exists($otypes{$ntype})) {
push @invalid_node_types, $ntype;
}
}
if (@invalid_node_types) {
UserError("Node Types: Current image on $node_id".
" cannot run on the following node types: ".
join(' ', @invalid_node_types));
}
} else {
UserError("Partition: No image originally loaded in partition $loadpart on $node_id; this is probably not the partition you meant to save");
}
}
......
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