[DRBD-user] Determining whether a resource is in dual-primary mode

Ivan ivan at c3i.bg
Thu Oct 29 17:28:30 CET 2015

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

On 10/29/2015 03:12 PM, Veit Wahlich wrote:
> Hi,
> is there a (preferred) method to determine whether a resource is
> currently in dual-primary mode, e.g. show the active net-options?
> I use "drbdadm net-options --protocol=C --allow-two-primaries <res>" to
> active dual-primary mode temporarily for a resource and promote it on
> the former secondary, so I can migrate a virtual machine backed by this
> resource to another node. After migration has completed or failed, I
> demote the resource on the machine that does not run the vm and
> deactivate dual-primary mode with "drbdadm net-options
> --allow-two-primaries=no <res>".

you may be interested by this:


I wrote it some time ago as a qemu hook before ending setting up a full 
fledged cluster (pacemaker) with proper fencing, which rendered the 
script useless. It worked pretty well though (it doesn't change the 
"--allow-two-primaries" but you could easily add it if you end up using 
the script).

> For safety reasons, I would like to verify whether the resource is not
> already resp. no longer in dual-primary mode, but I found no method to
> obtain this information:
>   - /proc/drbd does not seem to contain this information

are you sure ? on my machine, cat /proc/drbd

version: 8.4.6 (api:1/proto:86-101)
GIT-hash: 9304f3b0995d97316d6bd4455ecbcf2963147ab4 build by 
build at vm-build-el7.c3i.priv, 2015-10-03 16:07:33

10: cs:Connected ro:Primary/Primary ds:UpToDate/UpToDate C r-----
ns:9850696 nr:7822820 dw:17672764 dr:10737789 al:151 bm:0 lo:0 pe:0 ua:0 
ap:0 ep:1 wo:f oos:0
11: cs:Connected ro:Primary/Primary ds:UpToDate/UpToDate C r-----
ns:977368 nr:16 dw:977384 dr:1143886 al:212 bm:0 lo:0 pe:0 ua:0 ap:0 
ep:1 wo:f oos:0

a little sed magic and you're set up.

>   - neither the documented nor official hidden commands of drbdadm seem
>     to be able to return this information

what about:

$ drbdadm role vm-file

(resource vm-file here has 2 volumes)

> Any idea appreciated.
> Regards,
> // Veit


> _______________________________________________
> drbd-user mailing list
> drbd-user at lists.linbit.com
> http://lists.linbit.com/mailman/listinfo/drbd-user

More information about the drbd-user mailing list