[DRBD-user] Determining whether a resource is in dual-primary mode
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 " 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 ". 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 - neither the documented nor official hidden commands of drbdadm seem to be able to return this information Any idea appreciated. Regards, // Veit ___ drbd-user mailing list drbd-user@lists.linbit.com http://lists.linbit.com/mailman/listinfo/drbd-user
Re: [DRBD-user] Determining whether a resource is in dual-primary mode
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 " 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 ". you may be interested by this: https://github.com/taradiddles/cluster/blob/master/libvirt_hooks/qemu 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 bu...@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 Primary/Primary Primary/Primary (resource vm-file here has 2 volumes) Any idea appreciated. Regards, // Veit regards, ivan ___ drbd-user mailing list drbd-user@lists.linbit.com http://lists.linbit.com/mailman/listinfo/drbd-user ___ drbd-user mailing list drbd-user@lists.linbit.com http://lists.linbit.com/mailman/listinfo/drbd-user
Re: [DRBD-user] Determining whether a resource is in dual-primary mode
Hi Ivan, thank you for your suggestions. Am Donnerstag, den 29.10.2015, 18:28 +0200 schrieb Ivan: > you may be interested by this: > > https://github.com/taradiddles/cluster/blob/master/libvirt_hooks/qemu > > 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). This looks nice. I have written a similar Perl based hook for this case, but at the moment it only takes care to promote resources used by the domain before the domain starts, and demotes the resources when it stops or is migrated away. I was unsure to add migration support to this hook due to safety concerns about what happens when migration fails. I already experienced split-brain situations due to configuration mismatch after one side executed the "drbdadm --allow-two-primaries" command, but the other one did not. So I decided to put this functionality into a control program with direct user interaction. It also checks for a lot of other potential problems before migration starts, such as 'file' type disks (e.g. ISOs for domains' cdroms) not on cluster filesystems, 'dir' type disks, any DRBD-backed disk cache setting not being 'writethrough', domain being already defined on other nodes than source, domain having active snapshots, domain not being persistently defined, ... > are you sure ? on my machine, cat /proc/drbd > > version: 8.4.6 (api:1/proto:86-101) > GIT-hash: 9304f3b0995d97316d6bd4455ecbcf2963147ab4 build by > bu...@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 > $ drbdadm role vm-file > Primary/Primary > Primary/Primary I think I explained my problem mistakable: My problem is not that I do not know whether there are two primaries active, but whether two primaries are still allowed (esp. whether "drbdadm --allow-two-primaeries=no" has been successfully executed. So I was unable to find a flag in /proc/drbd that indicates whether allow-dual-primary is active or not. Best regards, // Veit ___ drbd-user mailing list drbd-user@lists.linbit.com http://lists.linbit.com/mailman/listinfo/drbd-user
Re: [DRBD-user] Determining whether a resource is in dual-primary mode
On Thu, Oct 29, 2015 at 06:11:28PM +0100, Veit Wahlich wrote: > > My problem is not that I do not know whether there are two primaries > active, but whether two primaries are still allowed (esp. whether > "drbdadm --allow-two-primaeries=no" has been successfully executed. > > So I was unable to find a flag in /proc/drbd that indicates whether > allow-dual-primary is active or not. What's wrong with # drbdsetup XYZ show --show-defaults -- : Lars Ellenberg : http://www.LINBIT.com | Your Way to High Availability : DRBD, Linux-HA and Pacemaker support and consulting DRBD® and LINBIT® are registered trademarks of LINBIT, Austria. __ please don't Cc me, but send to list -- I'm subscribed ___ drbd-user mailing list drbd-user@lists.linbit.com http://lists.linbit.com/mailman/listinfo/drbd-user
Re: [DRBD-user] Determining whether a resource is in dual-primary mode
Am Montag, den 02.11.2015, 15:53 +0100 schrieb Lars Ellenberg: > What's wrong with > # drbdsetup XYZ show --show-defaults That is exactly what I was looking for, thank you! Just a little more complicated to parse than I hoped for, but feasible without problems. Regards, // Veit ___ drbd-user mailing list drbd-user@lists.linbit.com http://lists.linbit.com/mailman/listinfo/drbd-user
Re: [DRBD-user] Determining whether a resource is in dual-primary mode
On Mon, Nov 02, 2015 at 04:01:00PM +0100, Veit Wahlich wrote: > Am Montag, den 02.11.2015, 15:53 +0100 schrieb Lars Ellenberg: > > What's wrong with > > # drbdsetup XYZ show --show-defaults > > That is exactly what I was looking for, thank you! > > Just a little more complicated to parse than I hoped for, but feasible > without problems. res=XYZ if drbdsetup show $res | grep -q allow-two-primaries; then echo "Two primaries are allowed." else echo "Two primaries are not allowed." fi complicated to parse? where? -- : Lars Ellenberg : http://www.LINBIT.com | Your Way to High Availability : DRBD, Linux-HA and Pacemaker support and consulting DRBD® and LINBIT® are registered trademarks of LINBIT, Austria. __ please don't Cc me, but send to list -- I'm subscribed ___ drbd-user mailing list drbd-user@lists.linbit.com http://lists.linbit.com/mailman/listinfo/drbd-user
Re: [DRBD-user] Determining whether a resource is in dual-primary mode
Am Montag, den 02.11.2015, 17:14 +0100 schrieb Lars Ellenberg: > res=XYZ > if drbdsetup show $res | grep -q allow-two-primaries; then > echo "Two primaries are allowed." > else > echo "Two primaries are not allowed." > fi > > complicated to parse? > where? Well, for safety reasons I thought about something more sophisticated, a parser that understands the structure of drbdsetup's configuration data output and converts sections and attributes to a neat data structure that can be addressed directly. I will use the data captured for other things to, in this case (live migration) to determine the protocol before setting it to C, to be able re-set it after migration to its previous value. E.g. in case some VMs might use protocol B in the future, so after live migration I will set it back to B without having to call drbdadm adjust. Best regards, // Veit ___ drbd-user mailing list drbd-user@lists.linbit.com http://lists.linbit.com/mailman/listinfo/drbd-user