From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <t.lamprecht@proxmox.com>
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 A4BA46880E
 for <pve-devel@lists.proxmox.com>; Thu,  9 Sep 2021 18:25:00 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 9B9F5AF80
 for <pve-devel@lists.proxmox.com>; Thu,  9 Sep 2021 18:25:00 +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 F0501AF72
 for <pve-devel@lists.proxmox.com>; Thu,  9 Sep 2021 18:24:59 +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 C217B44645
 for <pve-devel@lists.proxmox.com>; Thu,  9 Sep 2021 18:24:59 +0200 (CEST)
Message-ID: <c9d43541-02c9-3480-b7e9-333aca6e27ac@proxmox.com>
Date: Thu, 9 Sep 2021 18:24:27 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:92.0) Gecko/20100101
 Thunderbird/92.0
Content-Language: en-US
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
 Fabian Ebner <f.ebner@proxmox.com>
References: <20210907093055.39627-1-f.ebner@proxmox.com>
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
In-Reply-To: <20210907093055.39627-1-f.ebner@proxmox.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL 1.253 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           -1.922 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
Subject: Re: [pve-devel] [PATCH storage] fix #3610: properly build ZFS
 detail tree
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Thu, 09 Sep 2021 16:25:00 -0000

On 07.09.21 11:30, Fabian Ebner wrote:
> Previously, top-level vdevs like log or special were wrongly added as
> children of the previous outer vdev instead of the root.
> 
> Fix it by also showing the vdev with the same name as the pool and
> start counting from level 1 (the pool itself serves as the root and
> should be the only one with level 0). This results in the same kind
> of structure as in PBS and (except for the root) zpool status itself.
> 
> Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
> ---
>  PVE/API2/Disks/ZFS.pm | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/PVE/API2/Disks/ZFS.pm b/PVE/API2/Disks/ZFS.pm
> index 0418794..60077c4 100644
> --- a/PVE/API2/Disks/ZFS.pm
> +++ b/PVE/API2/Disks/ZFS.pm
> @@ -240,8 +240,8 @@ __PACKAGE__->register_method ({
>  		$config = 1;
>  	    } elsif ($config && $line =~ m/^(\s+)(\S+)\s*(\S+)?(?:\s+(\S+)\s+(\S+)\s+(\S+))?\s*(.*)$/) {
>  		my ($space, $name, $state, $read, $write, $cksum, $msg) = ($1, $2, $3, $4, $5, $6, $7);
> -		if ($name ne "NAME" and $name ne $param->{name}) {
> -		    my $lvl= int(length($space)/2); # two spaces per level
> +		if ($name ne "NAME") {
> +		    my $lvl = int(length($space) / 2) + 1; # two spaces per level
>  		    my $vdev = {
>  			name => $name,
>  			msg => $msg,
> 

hmm, I get the idea and can see how one could assert that this is more correct,
but as it is presented it'd be a bit more confusing too, IMO, as it does not
matches the zpool status CLI output anymore.

I.e., the following (real):
>         NAME                                      STATE     READ WRITE CKSUM
>         zpt                                       ONLINE       0     0     0
>           mirror-0                                ONLINE       0     0     0
>             scsi-0QEMU_QEMU_HARDDISK_drive-scsi3  ONLINE       0     0     0
>             scsi-0QEMU_QEMU_HARDDISK_drive-scsi4  ONLINE       0     0     0
>         logs
>           scsi-0QEMU_QEMU_HARDDISK_drive-scsi5    ONLINE       0     0     0


Is suggested to be (adapted):
>         NAME                                      STATE     READ WRITE CKSUM
>         zpt                                       ONLINE
>           zpt                                       ONLINE       0     0     0
>             mirror-0                                ONLINE       0     0     0
>               scsi-0QEMU_QEMU_HARDDISK_drive-scsi3  ONLINE       0     0     0
>               scsi-0QEMU_QEMU_HARDDISK_drive-scsi4  ONLINE       0     0     0
>         logs
>           scsi-0QEMU_QEMU_HARDDISK_drive-scsi5    ONLINE       0     0     0


How about hiding the root in the devices tree and add a line to the
KV grid above instead? E.g., something that would then render:

Pool       <ID> (<STATUS>)

That can be a GUI change only, did not really checked implementation details, but
I'd like to clear that up before applying this patch.