disk manage: move "draid-config set only on draid level" assertion
so that there is a better code locality and also we avoid forgetting to adapt the check for each specific draid-config parameter if a new one gets added or an existing one changed. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
@ -363,6 +363,7 @@ __PACKAGE__->register_method ({
|
|||||||
my $compression = $param->{compression} // 'on';
|
my $compression = $param->{compression} // 'on';
|
||||||
my $draid_config = {};
|
my $draid_config = {};
|
||||||
if (exists $param->{'draid-config'}) {
|
if (exists $param->{'draid-config'}) {
|
||||||
|
die "draid-config set without using dRAID level\n" if $raidlevel !~ m/^draid/;
|
||||||
$draid_config = PVE::JSONSchema::parse_property_string(
|
$draid_config = PVE::JSONSchema::parse_property_string(
|
||||||
$draid_config_format, $param->{'draid-config'});
|
$draid_config_format, $param->{'draid-config'});
|
||||||
}
|
}
|
||||||
@ -431,9 +432,6 @@ __PACKAGE__->register_method ({
|
|||||||
|
|
||||||
die "At least $draidmin disks needed for current dRAID config\n"
|
die "At least $draidmin disks needed for current dRAID config\n"
|
||||||
if $numdisks < $draidmin;
|
if $numdisks < $draidmin;
|
||||||
} else {
|
|
||||||
die "draidspares and/or draiddata set without using dRAID"
|
|
||||||
if ($draid_spares or $draid_data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
my $code = sub {
|
my $code = sub {
|
||||||
|
|||||||
Reference in New Issue
Block a user