[ClusterLabs] how to "switch on" cLVM ?
Digimer
lists at alteeve.ca
Tue Jun 7 15:54:36 UTC 2016
On 07/06/16 07:23 AM, Lentes, Bernd wrote:
>>> Ok. Does DLM takes care that a LV just can be used on one host ?
>>> cLVM just takes care that the naming is the same on all nodes, right ?
>>
>> AFAIK DLM takes care about the LVM Locking cluster wide.
>
> What does that mean concretely, "LVM Locking cluster wide" ?
> I read it always, but no explaination.
> Does that mean that a LV just can be accesses from one node ?
> That DLM "locks" (in the sense of "blocking the other node") the access ?
> Or does the LV has to be a cluster ressource to prevent concurrent access ?
DLM is just a distributed lock manager, that's it. LVM uses it to
coordinate actions within the cluster, so what LVM does is still up to LVM.
I'm not a dev, so I might get this a little wrong, but basically it
works like this...
You want to create an LV from a clustered VG. The dlm and clvmd daemons
are running on all nodes. You type 'lvcreate ...' on node 1. Node 1 asks
for a lock from DLM, DLM checks to make sure the lock your asking for
doesn't conflict with any locks held elsewhere in the cluster and then
it is granted.
Now the local machine creates the LV (same that no one else is going to
work on the same bits because of the DLM lock), releases the lock and
informs the other nodes. The other nodes update their view of the VG and
see the new LV.
>From the user's perspective, the LV they created on node 1 is instantly
seen on the other nodes.
>>>>> Later on it's possible that some vm's run on host 1 and some on host 2. Does
>>>>> clvm needs to be a ressource managed by the cluster manager ?
>>>>
>>>> Yes, you can live-migrate as well. I do this all the time, except I use
>>>> DRBD instead of a SAN and RHEL instead of SUSE, but those are trivial
>>>> differences in this case.
>>>>
>>>>> If i use a fs inside the lv, a "normal" fs like ext3 is sufficient, i think. But
>>>>> it has to be a cluster ressource, right ?
>>>>
>>>> You can format a clustered LV with a cluster unaware filesystem just
>>>> fine. However, the FS is not made magically cluster aware... If you
>>>> mount it on two nodes, you will almost certainly corrupt the FS quickly.
>>>> If you want to mount an LV on two+ nodes at once, you need a
>>>> cluster-aware file system, life GFS2.
>>>
>>> No. Pacemaker takes care that the FS is just mounted on one node.
>>> So it should not be a problem ?
>>
>> If you want to be sure to mount an LV on just one Node, you have to activate the
>> VG exclusively on one node. You have to configure the ressource for the VG
>> accordingly. Otherwise it's possible to activate and mount an LV on several
>> nodes at the same time, even with a non Cluster FS, e.g. ext4, which would end
>> up in corrupted FS, most likely. (as mentioned above allready).
>
> But maybe i want to have some vm's running on host A and others on host B.
> Remember: one vm per LV.
> So i need access to the VG concurrently from both nodes, right ?
> But if the FS from the LV is a cluster ressource, pacemaker takes care the the FS is mounted just from one node.
> I can rely it on it, right ? That's what i read often.
> But what if i don't have a FS ? It's possible to have vm's in plain partitions, which should be a performance advantage.
Clustered LVM doesn't care how an LV is used. It only cares that changes
won't conflict (thanks to DLM) and that all nodes have the same view of
the LVM. So deactivate, activate, grow, create, delete of PVs, VGs and
LVs are always seen on all nodes right away.
What you do on the LVs is up to you. If boot a VM on node 1 using an LV
as backing storage, nothing in LVM stopping you from accessing that LV
on another node and destroying your data.
For that, you need pacemaker or something else smart enough and cluster
aware to prevent uncoordinated access. So if you create a standard FS,
you configure pacemaker to ensure it's only mounted on one node at a
time (and use fencing!). If you do use a cluster-aware FS, like GFS2,
then it's perfectly fine to mount the LV on multiple drives (which is
why LVM doesn't get in your way).
--
Digimer
Papers and Projects: https://alteeve.ca/w/
What if the cure for cancer is trapped in the mind of a person without
access to education?
More information about the Users
mailing list