From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id CE402707FD for ; Fri, 3 Jun 2022 14:31:21 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id C566F7D7F for ; Fri, 3 Jun 2022 14:31:21 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 7C6A27D72 for ; Fri, 3 Jun 2022 14:31:20 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 9620943A25; Fri, 3 Jun 2022 14:31:17 +0200 (CEST) Message-ID: <0149f80c-09b0-eb22-1179-aa925b000bb1@proxmox.com> Date: Fri, 3 Jun 2022 14:31:16 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:101.0) Gecko/20100101 Thunderbird/101.0 Content-Language: en-US To: Proxmox VE development discussion , Stefan Hrdlicka References: <20220602112234.1868726-1-s.hrdlicka@proxmox.com> <20220602112234.1868726-2-s.hrdlicka@proxmox.com> From: Dominik Csapak In-Reply-To: <20220602112234.1868726-2-s.hrdlicka@proxmox.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-SPAM-LEVEL: Spam detection results: 0 AWL 1.395 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment NICE_REPLY_A -2.575 Looks like a legit reply (A) SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [zfs.pm] Subject: Re: [pve-devel] [PATCH pve-storage 1/3] fix #3967: enable ZFS dRAID creation via API X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jun 2022 12:31:21 -0000 just saw an additional thing, comment inline On 6/2/22 13:22, Stefan Hrdlicka wrote: > It is possible to set the number of spares and the size of > data stripes via draidspares & dreaddata parameters. > > Signed-off-by: Stefan Hrdlicka > --- > PVE/API2/Disks/ZFS.pm | 40 +++++++++++++++++++++++++++++++++++++++- > 1 file changed, 39 insertions(+), 1 deletion(-) > > diff --git a/PVE/API2/Disks/ZFS.pm b/PVE/API2/Disks/ZFS.pm > index eeb9f48..63946d2 100644 > --- a/PVE/API2/Disks/ZFS.pm > +++ b/PVE/API2/Disks/ZFS.pm > @@ -299,12 +299,27 @@ __PACKAGE__->register_method ({ > raidlevel => { > type => 'string', > description => 'The RAID level to use.', > - enum => ['single', 'mirror', 'raid10', 'raidz', 'raidz2', 'raidz3'], > + enum => ['single', 'mirror', > + 'raid10', 'raidz', 'raidz2', 'raidz3', > + 'draid', 'draid2', 'draid3', > + ], > }, > devices => { > type => 'string', format => 'string-list', > description => 'The block devices you want to create the zpool on.', > }, > + draiddata => { > + type => 'integer', > + minimum => 1, > + optional => 1, > + description => 'Number of dRAID data stripes.', > + }, > + draidspares => { > + type => 'integer', > + minimum => 0, > + optional => 1, > + description => 'Number of dRAID spares.', > + }, > ashift => { > type => 'integer', > minimum => 9, > @@ -339,6 +354,8 @@ __PACKAGE__->register_method ({ > my $devs = [PVE::Tools::split_list($param->{devices})]; > my $raidlevel = $param->{raidlevel}; > my $compression = $param->{compression} // 'on'; > + my $draid_data = $param->{draiddata}; > + my $draid_spares = $param->{draidspares}; > > for my $dev (@$devs) { > $dev = PVE::Diskmanage::verify_blockdev_path($dev); > @@ -354,6 +371,9 @@ __PACKAGE__->register_method ({ > raidz => 3, > raidz2 => 4, > raidz3 => 5, > + draid => 3, > + draid2 => 4, > + draid3 => 5, > }; > > # sanity checks > @@ -366,6 +386,19 @@ __PACKAGE__->register_method ({ > die "$raidlevel needs at least $mindisks->{$raidlevel} disks\n" > if $numdisks < $mindisks->{$raidlevel}; > > + # draid checks > + if ($raidlevel =~ m/^draid/) { > + # bare minium would be two drives: > + # one parity & one data drive this code doesn't allow that because > + # it makes no sense, at least one spare disk should be used > + my $draidmin = $mindisks->{$raidlevel} - 2; > + $draidmin += $draid_data if $draid_data; > + $draidmin += $draid_spares if $draid_spares; isn't that calculation wrong? if i set draid and no data/spares, i just have to give a single disk? (so we should initialize draid_data with 1 in that case probably?) also why do you set min draid => 3, subtract 2 then add some again? why not have draid => 1, and just add the other things? > + > + die "At least $draidmin disks needed for current dRAID config\n" > + if $numdisks < $draidmin; > + } > + > my $code = sub { > for my $dev (@$devs) { > PVE::Diskmanage::assert_disk_unused($dev); > @@ -402,6 +435,11 @@ __PACKAGE__->register_method ({ > } > } elsif ($raidlevel eq 'single') { > push @$cmd, $devs->[0]; > + } elsif ($raidlevel =~ m/^draid/) { > + my $draid_cmd = $raidlevel; > + $draid_cmd .= ":${draid_data}d" if $draid_data; > + $draid_cmd .= ":${draid_spares}s" if $draid_spares; > + push @$cmd, $draid_cmd, @$devs; > } else { > push @$cmd, $raidlevel, @$devs; > }