]> git.proxmox.com Git - pve-storage.git/commitdiff
fix #3610: properly build ZFS detail tree
authorFabian Ebner <f.ebner@proxmox.com>
Fri, 10 Sep 2021 11:45:35 +0000 (13:45 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 10 Sep 2021 12:19:39 +0000 (14:19 +0200)
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

index 04187946f238b8b41d387a2d2d519b1375b678ea..60077c421f7a3df7f0ac741d2f7332a10555c5da 100644 (file)
@@ -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,