Skip to content

Commit

Permalink
[IMP] In some case, we might want to keep some lvm active
Browse files Browse the repository at this point in the history
In some special configuration, we might need not to deactivate some lvm.
This commit allows to define some lvm paths that will not be deactivated
by vdsm.
The list of the lvm paths can be configured in
/etc/vdsm/vdsm.conf.d/keep_alive_lvm.conf:

[lvm]
keep_active = /dev/vg1/lv1,/dev/vg1/lv2,/dev/vg2/lv1

Signed-off-by: Cyril VINH-TUNG <[email protected]>
  • Loading branch information
cvinh committed Jun 27, 2024
1 parent 4d11cae commit 9202b31
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/vdsm/common/config.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,10 @@ parameters = [
'are either "filter" or "devices". Filter method will use LVM '
'filter, while device will use LVM devices file. The default '
'value is "devices".'),

('keep_active', '',
'Comma-separated list of LVM paths that will never be deactivated.'
'For instance: "/dev/vg1/lv1,/dev/vg1/lv2,..."'),
]),

# Section: [sanlock]
Expand Down
6 changes: 6 additions & 0 deletions lib/vdsm/storage/lvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,9 @@ def __getattr__(self, attrName):

USE_DEVICES = config.get("lvm", "config_method").lower() == "devices"

KEEPACTIVE = [lvm for lvm in config.get("lvm", "keep_active").split(",")
if lvm is not None]


def _get_lvm_version():
packages = osinfo.package_versions()
Expand Down Expand Up @@ -1174,6 +1177,9 @@ def deactivateUnusedLVs(vgname, skiplvs=()):
elif lv.opened:
log.debug("Skipping open lv: vg=%s lv=%s", vgname,
lv.name)
elif lvPath(vgname, lv.name) in KEEPACTIVE:
log.debug("Skipping KEEPACTIVE lv: vg=%s lv=%s", vgname,
lv.name)
else:
deactivate.append(lv.name)

Expand Down

0 comments on commit 9202b31

Please sign in to comment.