|
|
cf07b3 |
From de258066eafa7a2c3a42ef88e2c7657ae95d1e99 Mon Sep 17 00:00:00 2001
|
|
|
cf07b3 |
From: David Vossel <dvossel@redhat.com>
|
|
|
cf07b3 |
Date: Tue, 16 Jul 2013 18:29:42 -0500
|
|
|
cf07b3 |
Subject: [PATCH] Low: LVM: Detect duplicate resources with the same volgrpname
|
|
|
cf07b3 |
name when using exclusive activation with tags.
|
|
|
cf07b3 |
|
|
|
cf07b3 |
For exclusive activation with tags, we already detect
|
|
|
cf07b3 |
if the resource is a clone and prevent the LVM resource
|
|
|
cf07b3 |
from activating. This check goes a step further and
|
|
|
cf07b3 |
detects if there is another primitive attempting to access
|
|
|
cf07b3 |
the same volume group in pacemaker's configuraiton. This
|
|
|
cf07b3 |
check is ignored if pacemaker is not in use, allowing this
|
|
|
cf07b3 |
agent to continue to be portable to other cluster managers
|
|
|
cf07b3 |
in the future.
|
|
|
cf07b3 |
|
|
|
cf07b3 |
This patch also re-words the 'exclusive' option's documentation
|
|
|
cf07b3 |
in order to clarify how volume_list filtering works.
|
|
|
cf07b3 |
|
|
|
cf07b3 |
Resolves: rhbz#984054
|
|
|
cf07b3 |
---
|
|
|
cf07b3 |
heartbeat/LVM | 32 +++++++++++++++++++++++++++++---
|
|
|
cf07b3 |
1 file changed, 29 insertions(+), 3 deletions(-)
|
|
|
cf07b3 |
|
|
|
cf07b3 |
diff --git a/heartbeat/LVM b/heartbeat/LVM
|
|
|
cf07b3 |
index 0ff6ba7..27315df 100755
|
|
|
cf07b3 |
--- a/heartbeat/LVM
|
|
|
cf07b3 |
+++ b/heartbeat/LVM
|
|
|
cf07b3 |
@@ -80,9 +80,17 @@ The name of volume group.
|
|
|
cf07b3 |
If set, the volume group will be activated exclusively. This option works one of
|
|
|
cf07b3 |
two ways. If the volume group has the cluster attribute set, then the volume group
|
|
|
cf07b3 |
will be activated exclusively using clvmd across the cluster. If the cluster attribute
|
|
|
cf07b3 |
-is not set, the volume group will be activated exclusively using a tag and the volume_list
|
|
|
cf07b3 |
-filter. When the tag option is in use, the volume_list in lvm.con must be initialized. This
|
|
|
cf07b3 |
-can be as simple as setting 'volume_list = []' depending on your setup.
|
|
|
cf07b3 |
+is not set, the volume group will be activated exclusively through the use of the
|
|
|
cf07b3 |
+volume_list filter in lvm.conf. In the filter scenario, the LVM agent verifies
|
|
|
cf07b3 |
+that pacemaker's configuration will result in the volume group only being active on a
|
|
|
cf07b3 |
+single node in the cluster and that the local node's volume_list filter will prevent
|
|
|
cf07b3 |
+the volume group from activating outside of the resource agent. On activation this
|
|
|
cf07b3 |
+agent claims the volume group through the use of a unique tag, and then overrides the
|
|
|
cf07b3 |
+volume_list field in a way that allows the volume group to be activated only by the
|
|
|
cf07b3 |
+agent. To use exclusive activation without clvmd, the volume_list in lvm.conf must be
|
|
|
cf07b3 |
+initialized. If volume groups exist locally that are not controlled by the cluster, such
|
|
|
cf07b3 |
+as the root volume group, make sure those volume groups are listed in the volume_list
|
|
|
cf07b3 |
+so they will be allowed to activate on bootup.
|
|
|
cf07b3 |
</longdesc>
|
|
|
cf07b3 |
<shortdesc lang="en">Exclusive activation</shortdesc>
|
|
|
cf07b3 |
<content type="boolean" default="false" />
|
|
|
cf07b3 |
@@ -191,6 +199,24 @@ verify_tags_environment()
|
|
|
cf07b3 |
return $OCF_ERR_GENERIC
|
|
|
cf07b3 |
fi
|
|
|
cf07b3 |
|
|
|
cf07b3 |
+
|
|
|
cf07b3 |
+ ##
|
|
|
cf07b3 |
+ # Verify that if this agent is being used in a Pacemaker cluster,
|
|
|
cf07b3 |
+ # no other LVM agents in the cib contain the same volgrpname
|
|
|
cf07b3 |
+ ##
|
|
|
cf07b3 |
+ if have_binary "cibadmin" ; then
|
|
|
cf07b3 |
+ # This detects if there is any other LVM primitive (besides this instance) that
|
|
|
cf07b3 |
+ # is already assigned the same volume group. If so, do not activate this instance.
|
|
|
cf07b3 |
+ cibadmin --local -Q --xpath '//primitive[@type="LVM"][@id!="'${OCF_RESOURCE_INSTANCE}'"]//instance_attributes//nvpair[@name="volgrpname"][@value="'${OCF_RESKEY_volgrpname}'"]' \
|
|
|
cf07b3 |
+ > /dev/null 2>&1
|
|
|
cf07b3 |
+
|
|
|
cf07b3 |
+ if [ $? -eq 0 ]; then
|
|
|
cf07b3 |
+ ocf_log err "LVM: Improper setup detected"
|
|
|
cf07b3 |
+ ocf_log err "Duplicate LVM resource controlling vg '$OCF_RESKEY_volgrpname' detected in cib configuration. Can not activate exclusively"
|
|
|
cf07b3 |
+ return $OCF_ERR_GENERIC
|
|
|
cf07b3 |
+ fi
|
|
|
cf07b3 |
+
|
|
|
cf07b3 |
+ fi
|
|
|
cf07b3 |
return $OCF_SUCCESS
|
|
|
cf07b3 |
}
|
|
|
cf07b3 |
|
|
|
cf07b3 |
--
|
|
|
cf07b3 |
1.8.1
|
|
|
cf07b3 |
|