puppet-lvm: add support for mpath device

The device path in /dev/disk/by-path can not be used directly
for mpath devices, /dev/disk/by-id/dm-uuid-mpath-<WWID> will
be used instead.

Test Plan:

PASS: AIO-SX

Story: 2010046
Task: 45426

Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
Signed-off-by: Thiago Miranda <ThiagoOliveira.Miranda@windriver.com>
Change-Id: Id5b1e27a4567a0791633ba83ed791fe6edaba3cd
This commit is contained in:
Joao Pedro Alexandroni 2022-05-23 17:04:06 -03:00
parent efff8bf47e
commit 72a66b7ae2
2 changed files with 37 additions and 0 deletions

View File

@ -0,0 +1,35 @@
From e603e6bc5a72c2dc0760471df08bcf6079abb789 Mon Sep 17 00:00:00 2001
From: Jackie Huang <jackie.huang@windriver.com>
Date: Mon, 14 Mar 2022 04:28:55 +0000
Subject: [PATCH] add support for mpath devices
The device path in /dev/disk/by-path can not be used directly
for mpath devices, /dev/disk/by-id/dm-uuid-mpath-<WWID> will
be used instead.
Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
---
.../modules/lvm/lib/puppet/provider/volume_group/lvm.rb | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/packstack/puppet/modules/lvm/lib/puppet/provider/volume_group/lvm.rb b/packstack/puppet/modules/lvm/lib/puppet/provider/volume_group/lvm.rb
index fd467e1..7170fa6 100644
--- a/packstack/puppet/modules/lvm/lib/puppet/provider/volume_group/lvm.rb
+++ b/packstack/puppet/modules/lvm/lib/puppet/provider/volume_group/lvm.rb
@@ -81,7 +81,12 @@ Puppet::Type.type(:volume_group).provide :lvm do
def physical_volumes
if @resource[:createonly].to_s == "false" || ! vgs(@resource[:name])
- lines = `pvs -o pv_name,vg_name --separator ',' | awk -F ',' 'NR>1{cmd="find -L /dev/disk/by-path/ -samefile" $1; cmd | getline $1;print $1 "," $2; next};{print}'`
+ pv_name = `pvs -o pv_name | tail -1`
+ if pv_name.include? "mpath"
+ lines = `pvs -o pv_name,vg_name --separator ',' | awk -F ',' 'NR>1{cmd="find -L /dev/disk/by-id/dm-uuid* -samefile" $1; cmd | getline $1;print $1 "," $2; next};{print}'`
+ else
+ lines = `pvs -o pv_name,vg_name --separator ',' | awk -F ',' 'NR>1{cmd="find -L /dev/disk/by-path/ -samefile" $1; cmd | getline $1;print $1 "," $2; next};{print}'`
+ end
lines.split(/\n/).grep(/,#{@resource[:name]}$/).map { |s|
s.split(/,/)[0].strip
}
--
2.29.2

View File

@ -18,6 +18,7 @@ Patch2: 0003-US94222-Persistent-Dev-Naming.patch
Patch3: 0004-extendind-nuke_fs_on_resize_failure-functionality.patch
Patch4: Fix-the-logical-statement-for-nuke_fs_on_resize.patch
Patch5: 0005-Wipe-10MB-after-we-lvextend-the-partitions.patch
Patch6: 0006-add-support-for-mpath-devices.patch
BuildArch: noarch
@ -38,6 +39,7 @@ A Puppet module for Logical Resource Management (LVM)
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%install
install -d -m 0755 %{buildroot}/%{_datadir}/puppet/modules/%{module_dir}