On Mon, May 20, 2013 at 10:48:00AM +0300, Liutauras Adomaitis wrote: > Hi there, > > this is my first post. I would like to share my fix for drbd-overview perl > script. The problem I am trying to solve is that if a KVM virtual machine > is using 2 drbd devices, drbd-overview doesn't show second device as used > by any virtual machine. > Here is the output of original drbd-overview: > 1:r0/0 Connected Primary/Secondary UpToDate/UpToDate A > r----- > 2:Antras-drbd0/0 Connected Secondary/Primary UpToDate/UpToDate A > r----- _Antras vda virtio > 3:Svarainis-drbd0/0 Connected Primary/Secondary UpToDate/UpToDate A > r----- *Svarainis vda virtio > 4:Svarainis-drbd1/0 Connected Primary/Secondary UpToDate/UpToDate A > r----- > > Here is the patch I suggest: > > --- ./drbd-overview.orig 2013-05-20 10:38:00.790616544 +0300 > +++ ./drbd-overview.new 2013-05-20 10:37:29.207518963 +0300 > @@ -216,7 +216,7 @@ > # parent > $_ = <V>; > close(V) or warn "virsh dumpxml exit code: $?\n"; > - for (m{<disk\ [^>]*>.*</disk>}gs) { > + for (m{<disk\ [^>]*>.*?</disk>}gs) {
Thanks. Looks "obviously correct" ;-) > m{<source\ dev='/dev/drbd([^']+)'/>} or next; > my $dev = $1; > if ($dev !~ /^\d+$/) { > > And here is the output fixed drbd-overview: > 1:r0/0 Connected Primary/Secondary UpToDate/UpToDate A > r----- > 2:Antras-drbd0/0 Connected Secondary/Primary UpToDate/UpToDate A > r----- _Antras vda virtio > 3:Svarainis-drbd0/0 Connected Primary/Secondary UpToDate/UpToDate A > r----- *Svarainis vda virtio > 4:Svarainis-drbd1/0 Connected Primary/Secondary UpToDate/UpToDate A > r----- *Svarainis vdb virtio > > Notice the 4th line. Previously it didn't provide any associations with > virtual machines, now it provides correct one. > I am not a perl expert, nor even a beginner, so feel free to improve the > fix. Didn't test it more extensively, so don't know what it will show with > different virsh configs. > > Regards, > Liutauras -- : Lars Ellenberg : LINBIT | Your Way to High Availability : DRBD/HA support and consulting http://www.linbit.com _______________________________________________ drbd-user mailing list drbd-user@lists.linbit.com http://lists.linbit.com/mailman/listinfo/drbd-user