Dear Guy,
thanks for your answer.
I came exactly to the same solution after i failed to get the build
environment running. My first try was to change the "lvchange" params in
the storage driver from "-aln" to "-asn" to get the volumes mounted
in
shared mode. But this idea was not good anyway because it can lead to
data corruption if two domains mount the volume r/w.
Then i disabled the autostart of the storage pools and wrote a qemu
python hook to activate and deactivate the volumes on prepare and
release. It is a quick fix for now but if anyone is interested...find
the hook code below...
Regards,
Timm
-----------------------------
#!/usr/bin/python3
#
# Libvirt hook for qemu.
#
# This hook prepares and releases domain LVM volumes in shared LVM
volume group
#
import logging
from logging.handlers import SysLogHandler
import subprocess
import sys
import xml.etree.ElementTree as etree
# name of the shared volume group
# if this string is part of the
# domain disk source device path,
# the disk will be activated
shared_vg = 'vmgroup1'
LOG = logging.getLogger(__file__)
LOG.setLevel(logging.DEBUG)
handler = SysLogHandler(address = '/dev/log')
formatter = logging.Formatter('libvirt-hook: %(levelname)s: %(message)s')
handler.setFormatter(formatter)
LOG.addHandler(handler)
def find_disks(args):
root = etree.fromstring(args)
disk_nodes = root.findall(".//disk[@device='disk']")
disks = []
for disk_node in disk_nodes:
if disk_node.attrib.get('type') == 'block':
disk = disk_node.find('./source')
# get device path
lv_path = disk.attrib['dev']
if shared_vg in lv_path:
# append path without /dev/
disks.append(lv_path[5:])
return disks
def main():
if len(sys.argv) < 3:
LOG.debug("Nothing to do: too few arguments")
sys.exit()
domain = sys.argv[1]
action = sys.argv[2]
if action == 'prepare':
LOG.debug("Preparing {}...".format(domain))
xml = sys.stdin.read()
for disk in find_disks(xml):
LOG.debug("Trying to activate LV: {}...".format(disk))
try:
subprocess.check_call(['lvchange','-ay', disk])
except subprocess.CalledProcessError as e:
LOG.exception("Unable to activate LVM volume {} for
{}".format(lv_path, domain))
LOG.error("Output: %s", e.output)
LOG.debug("Successfully prepared {}...".format(domain))
elif action == 'release':
LOG.debug("Releasing {}...".format(domain))
xml = sys.stdin.read()
for disk in find_disks(xml):
LOG.debug("Trying to deactivate LV: {}...".format(disk))
try:
subprocess.check_call(['lvchange','-an', disk])
except subprocess.CalledProcessError as e:
LOG.exception("Unable to deactivate LVM volume {} for
{}".format(lv_path, domain))
LOG.error("Output: %s", e.output)
LOG.debug("Successfully released {}...".format(domain))
if __name__ == '__main__':
try:
main()
except Exception:
LOG.exception("Unexpected exception occured")
------------------------------
Am 19.02.20 um 10:33 schrieb Guy Godfroy:
Hello Timm,
I had exactly the same problem a few weeks ago. It pissed me off quite a
bit, but I made myself a reason.
My workaround is not to define the volume pool anymore. The domains are
able to use any volume anyway, even when not part of any pool.
I use custom hooks to activate and deactivate LVs.
Hope that helps,
Guy
Le 14/02/2020 à 11:28, Timm Wunderlich a écrit :
> dear all,
>
> i have a problem with clustered lvm storage and the "logical" storage
> driver, perhaps someone has a suggestion.
>
> i have a clustered lvm (lvmlockd, not clvm) with 4 hosts running.
>
> when i start the storage on a host it activates all volumes in the whole
> volume group. then i cannot start the storage on other hosts because all
> volumes are already activated on one host.
>
> if i then deactivate all volumes in the started pool i can start the
> pool on other hosts. but then i have to manually activate the volume if
> i want to start the domain.
>
> it would be great if the logical pool driver would only activate the
> volume of a domain at domain start and not on pool start.
>
> does anybody have a workaround for this or any suggestions for me? do
> you think i should open an issue on it?
>
> Regards,
> Timm
>
>
--
__________________________________________
Timm Wunderlich
Systemadministrator
Universität Siegen, Fakultät III
Lehrstuhl für Wirtschaftsinformatik und Neue Medien
Kohlbett Str. 15, 57068 Siegen
Tel: +49 271-740 3382
timm.wunderlich(a)uni-siegen.de
www.wineme.uni-siegen.de
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBFtFv/cBEAC8s0N+dShoUlPAjN089DyWGuWuZHGJcHyU81GmSI5lYLdOqvfN
NAZzZcUckuxlzqvT/Z18IbXMlzxkzxgM9Cf+x3TYdkEFW2Nm8NqdPAdW5Y9is8xg
3FcWjvSSj52VwkM8WvpR40X4c5amXxfIU0YfkGW49xMHNrvd+4keniNrsOhYR2Ej
EHTEGfHz7jT0YiO2kytfpQqTFKGgeAsFzlfXJ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