[PATCH] drbd-overview: We need to track disk states per volume.

Philipp Marek philipp.marek at linbit.com
Mon Dec 12 07:25:00 CET 2016


As reported by David on -user (Thank you!), the drbd-overview output
was wrong if volumes within a resource had different states (eg. one
"UpToDate", the other "Inconsistent").

Fix that by tracking disk state per volume.
---
 scripts/drbd-overview.pl | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/scripts/drbd-overview.pl b/scripts/drbd-overview.pl
index c2802a2..22abdf4 100755
--- a/scripts/drbd-overview.pl
+++ b/scripts/drbd-overview.pl
@@ -228,10 +228,11 @@ sub slurp_drbdsetup() {
             my $minor = $f{minor};
             my $vol = $f{volume};
             $later{$res}{vol_minor}{$vol} = $minor;
-            $later{$res}{peers}{dstates}{$HOSTNAME}  = $f{disk};
+            $later{$res}{peers}{dstates}{$vol}{$HOSTNAME} = $f{disk};
         } elsif ($what eq "peer-device") {
             my $n = $f{"conn-name"};
-            $later{$res}{peers}{dstates}{$n} = $f{"peer-disk"};
+            my $vol = $f{volume};
+            $later{$res}{peers}{dstates}{$vol}{$n} = $f{"peer-disk"};
         } else {
             warn("unknown key $what\n");
         }
@@ -259,7 +260,7 @@ sub slurp_drbdsetup() {
 # role with all mixed together
             $v->{role} = shorten_list(\@h_incl, $peers->{states});
 
-            $v->{dstate} = shorten_list(\@h_incl, $peers->{dstates});
+            $v->{dstate} = shorten_list(\@h_incl, $peers->{dstates}{$vol2});
             $v->{conn} = shorten_list(\@h_incl, $peers->{conns});
         }
     }
-- 
2.10.2


--7bttugq4alldsu6t--


More information about the drbd-dev mailing list