Discussion:
[linux-lvm] add_lockspace done -19
Moshe Lazarov
2017-10-12 18:30:24 UTC
Permalink
Hi,

I am using the following script to create shared VGs using SANLOCK. However,
I keep getting an error when trying to add the lock space.



#!/bin/bash



killall sanlock

/etc/init.d/sanlock stop

killall lvmetad

lvmetad

sleep 2

vgremove -ff --config global/use_lvmlockd=0 vglock



echo 'y' | pvremove -ff --config global/use_lvmlockd=0 /dev/sdb1

echo 'y' | pvremove -ff --config global/use_lvmlockd=0 /dev/sdc1

echo 'y' | pvremove -ff --config global/use_lvmlockd=0 /dev/sdb2



#http://man7.org/linux/man-pages/man8/lvmlockd.8.html

#The first vgcreate command needs to be given the path to a device that has
not yet been initialized with pvcreate. /dev/sdb2 is used for the lock and
should not be

#initialized with pvcreate.



#Lock VG & LV

vgcreate --verbose --config global/use_lvmlockd=0 vglock /dev/sdb2

lvcreate --config global/use_lvmlockd=0 -n locklv -L 10MB vglock



sanlock direct init -s lsgl:1:/dev/vglock/locklv:0



lvmlockd

sleep 2

systemctl start sanlock

lvmlockd -g sanlock --host-id 1

sleep 2

systemctl status sanlock



sanlock client add_lockspace -s lsgl:1:/dev/vglock/locklv:0



pvcreate -ff --config global/use_lvmlockd=0 /dev/sdc1

vgcreate --verbose --shared vg1 /dev/sdc1 --lock-type sanlock

lvcreate -n slowlv -L 150G vg1 /dev/sdc1



Please advise.



Thanks.
David Teigland
2017-10-13 14:41:11 UTC
Permalink
Post by Moshe Lazarov
I am using the following script to create shared VGs using SANLOCK. However,
I keep getting an error when trying to add the lock space.
The lvmlockd man page you mention lists the steps you should follow
under "Initial set up", but the commands you have shown are nothing
at all like that. Please follow these steps. I'm copying from the
man page and adding some of the commands you have used:


1. choose a lock manager

You have chosen sanlock.

2. configure hosts to use lvmlockd

You must edit /etc/lvm/lvm.conf on all of your nodes, setting
global {
locking_type = 1
use_lvmlockd = 1
use_lvmetad = 1 (this is optional)

Then edit /etc/lvm/lvmlocal.conf on all of your nodes, setting
local {
host_id = 1 (on the first host)
or
host_id = 2 (on the second host)
etc

3. start lvmlockd

# lvmlockd

4. start lock manager

# systemctl start sanlock

5. create VG on shared devices

I get the impression that you would like to create a special, small VG on
sdb2 to hold the sanlock global lock, and then a general purpose VG on
sdc1. To do that:

# vgcreate --shared global /dev/sdb2

# vgcreate --shared vg1 /dev/sdc1

(You are not required to create the special small VG for the global lock.
If you want to use a single general purpose VG, you could just leave out
the first vgcreate.)

6. start VG on all hosts

# vgchange --lock-start

(run that on all your hosts; they should all start "global" and "vg1")

7. create and activate LVs

lvcreate -n slowlv -L 150G vg1 /dev/sdc1

Once that works, please let me know what part of the man page was not
clear to you. Thanks
Post by Moshe Lazarov
#Lock VG & LV
vgcreate --verbose --config global/use_lvmlockd=0 vglock /dev/sdb2
lvcreate --config global/use_lvmlockd=0 -n locklv -L 10MB vglock
sanlock direct init -s lsgl:1:/dev/vglock/locklv:0
sanlock client add_lockspace -s lsgl:1:/dev/vglock/locklv:0
I'm curious what led you to believe that you should use commands like
these?
David Teigland
2017-10-16 18:54:29 UTC
Permalink
The command "vgcreate --shared global /dev/sdb2" creates a VG that
Please send me:

- the versions of lvm and sanlock you are using

- that vgcreate command with -vvvv, e.g.
vgcreate -vvvv --shared global /dev/sdb2 2>&1 | tee vgs.log

- after the failure, the debug logs from lvmlockd and sanlock:
lvmlockctl -d > lvmlockd.log
sanlock log_dump > sanlock.log

Thanks
Moshe Lazarov
2017-10-16 22:07:15 UTC
Permalink
LVM version - 2.02.173
Sanlock version - 3.5.0

The log files are attached.

Thanks a lot!


-----Original Message-----
From: David Teigland [mailto:***@redhat.com]
Sent: Monday, October 16, 2017 11:54 AM
To: Moshe Lazarov <***@axxana.com>
Cc: LVM general discussion and development <linux-***@redhat.com>
Subject: Re: [linux-lvm] add_lockspace done -19
The command "vgcreate --shared global /dev/sdb2" creates a VG that
Please send me:

- the versions of lvm and sanlock you are using

- that vgcreate command with -vvvv, e.g.
vgcreate -vvvv --shared global /dev/sdb2 2>&1 | tee vgs.log

- after the failure, the debug logs from lvmlockd and sanlock:
lvmlockctl -d > lvmlockd.log
sanlock log_dump > sanlock.log

Thanks
David Teigland
2017-10-17 16:54:56 UTC
Permalink
It looks like you have a permission problem. The sanlock daemon needs to
be able to use /dev/mapper/global-lvmlockd, but in your case it is getting
an EACCES error when it tries to use that device.

Check what UID/GID the sanlock daemon is running as, and that this GID is
allowed to access disks. The sanlock daemon by default will try to run
with UID/GID of sanlock/sanlock. I have things set up like this to allow
that (the sanlock rpm will typically set this up for you):

$ cat /etc/passwd | grep sanlock
sanlock:x:179:179:sanlock:/var/run/sanlock:/sbin/nologin

$ cat /etc/group | grep sanlock
disk:x:6:sanlock
tape:x:33:sanlock
sanlock:x:179:

You could also configure sanlock to run as root and not bother with the
user/group setup. Set "uname = root" and "gname = root" in
/etc/sanlock/sanlock.conf.

Dave

Loading...