mirror of
git://git.proxmox.com/git/pve-storage.git
synced 2025-02-03 13:47:16 +03:00
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:
parent
59db1208c3
commit
8a5ffcd991
@ -363,6 +363,7 @@ __PACKAGE__->register_method ({
|
||||
my $compression = $param->{compression} // 'on';
|
||||
my $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_format, $param->{'draid-config'});
|
||||
}
|
||||
@ -431,9 +432,6 @@ __PACKAGE__->register_method ({
|
||||
|
||||
die "At least $draidmin disks needed for current dRAID config\n"
|
||||
if $numdisks < $draidmin;
|
||||
} else {
|
||||
die "draidspares and/or draiddata set without using dRAID"
|
||||
if ($draid_spares or $draid_data);
|
||||
}
|
||||
|
||||
my $code = sub {
|
||||
|
Loading…
x
Reference in New Issue
Block a user