summaryrefslogtreecommitdiffstats
path: root/scripts/clvm-vg/main.yml
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--scripts/clvm-vg/main.yml74
1 files changed, 74 insertions, 0 deletions
diff --git a/scripts/clvm-vg/main.yml b/scripts/clvm-vg/main.yml
new file mode 100644
index 0000000..846c70b
--- /dev/null
+++ b/scripts/clvm-vg/main.yml
@@ -0,0 +1,74 @@
+# Copyright (C) 2015 Kristoffer Gronlund
+#
+# License: GNU General Public License (GPL)
+version: 2.2
+category: File System
+shortdesc: Cluster-aware LVM (auto activation)
+longdesc: |
+ Configures a resource to manage the activation of a volume
+ group. Before adding this resource, you need to proceed as below
+ to create new VG and LVs. Refer to manpage lvmlockd(8) for more
+ detailed steps.
+
+ - create VG on shared devices:
+ vgcreate --shared <vgname> <devices>
+
+ - create an LV:
+ lvcreate -an -L <size> -n <lvname> <vgname>
+
+ For LVs in shared VG, there are two activation modes: "exclusive"
+ and "shared". With the "exclusive" mode, a LV activated on one
+ host cannot be activated on another, which is the default option.
+ With the "shared" mode, a LV can be activated concurrently on
+ multiple hosts, and cluster filesystem like OCFS2 can use it.
+
+ If the resource is created with activation_mode="shared", it will
+ be added to the cLVM group resource. The cLVM group resource is
+ assumed to be named g-clvm. This is the name of the resource created
+ by the clvm wizard.
+
+parameters:
+ - name: id
+ shortdesc: Volume group instance ID
+ longdesc: Unique ID for the volume group instance in the cluster.
+ required: true
+ unique: true
+ type: resource
+ value: vg1
+
+ - name: vgname
+ shortdesc: Volume Group Name
+ longdesc: LVM volume group name.
+ required: true
+ type: string
+ value: vg1
+
+ - name: activation_mode
+ shortdesc: LVM activation mode
+ longdesc: |
+ How a VG/LV is activated in cluster, either "exclusive" (default) or "shared".
+ It depends on the filesystem you need to create on the LV to choose the
+ activation mode. For local filesystem like ext4, you need "exclusive" activation.
+ For cluster filesystem like OCFS2, you need "shared" activation.
+ required: false
+ type: string
+ value: exclusive
+
+ - name: clvm-group
+ shortdesc: cLVM Resource Group ID
+ longdesc: ID of the cLVM resource group.
+ type: resource
+ required: false
+ value: g-clvm
+
+actions:
+ - cib: |
+ primitive {{id}} ocf:heartbeat:LVM-activate
+ params vgname="{{vgname}}" vg_access_mode="lvmlockd" activation_mode="{{activation_mode}}"
+ op start timeout=60s
+ op stop timeout=60s
+ op monitor interval=30s timeout=90s
+
+ - crm: configure modgroup {{clvm-group}} add {{id}}
+ shortdesc: Add volume group to the cLVM group resource
+ when: activation_mode == "shared"