[DRBD-user] Display resource name in /proc/drbd?

Lars Ellenberg lars.ellenberg at linbit.com
Wed Aug 29 15:41:15 CEST 2007

Note: "permalinks" may not be as permanent as we would like,
direct links of old sources may well be a few messages off.


On Wed, Aug 29, 2007 at 02:39:42PM +0200, Dominik Klein wrote:
> Maybe this is useful for you?
> 
> Bas van Schaik schrieb:
> >Hi all,
> >
> >I've got two Xen-servers running drbd-on-LVM-on-MD synchronized DomU's
> >and in this setup a resource name is much more relevant than a drbd
> >device number. Is there any chance that that information will be shown
> >in /proc/drbd somewhere in future drbd versions? Or is it available
> >already in 0.8 versions? In that case, I will seriously think of
> >upgrading my 0.7 to 0.8 because of that simple "feature".
> >
> >Regards,
> >
> >  -- Bas
> >_______________________________________________
> >drbd-user mailing list
> >drbd-user at lists.linbit.com
> >http://lists.linbit.com/mailman/listinfo/drbd-user
> >
> 
> drbdstatus ()
> {
>     NAMES=`grep resource /etc/drbd.conf | cut -d " " -f 2 | tr 
> '\\\\\\n' ' '`;
>     cat /proc/drbd >/tmp/drbdstatus;
>     i=0;
>     for NAME in $NAMES;
>     do
>         sed "s/^\ *$i:/$NAME:/" /tmp/drbdstatus > /tmp/tmpdrbdstatus;
>         mv /tmp/tmpdrbdstatus /tmp/drbdstatus;
>         let "i++";
>     done;
>     cat /tmp/drbdstatus;
>     rm -f /tmp/drbdstatus
> }

thanks for the inspiration.
this is not exactly correct,
since the resources are not necessarily in sequencial device order.

but this should do,
unless you named your resources in a very unusual way:
sed_script=$(paste <(drbdadm sh-dev all) <(drbdadm sh-resources| tr '/ ' '-\n') |
		sed -e 's,^/dev/drbd,s/^ *,;s,\t,:/\&\[,;s,$,\]/;,')
sed -e "$sed_script" < /proc/drbd

-- 
: Lars Ellenberg                            Tel +43-1-8178292-0  :
: LINBIT Information Technologies GmbH      Fax +43-1-8178292-82 :
: Vivenotgasse 48, A-1120 Vienna/Europe    http://www.linbit.com :
__
please use the "List-Reply" function of your email client.



More information about the drbd-user mailing list