puppet-lvm: Handle multipath persistent device support

For HDD/SSD and NVMe disks we provide 'by-path' values which correspond
to physical locations residing within a specific host (i.e. controller
pci slot location). For multipath devices we will use by-id/wwn values
to uniquely identify a persistent disk which will have multiple devices
that coalesce into a single multipath device.

This change will match physical volumes provided to the module in both
/dev/disk/by-path and /dev/disk/by-id/wwn-* patterns. This aligns with
the hiera data generated from the system inventory

Test Plan:
PASS - AIO-SX: HPE multipath install/bootstrap/unlock
PASS - AIO-SX: Qemu virtual multipath install/bootstrap/unlock
PASS - AIO-DX: Qemu virtual multipath install/bootstrap/unlock
PASS - AIO-DX+: Qemu virtual multipath install/bootstrap/unlock
PASS - 2+2 (controller storage): Qemu virtual multipath install/
bootstrap/unlock
PASS - 2+2+2 (dedicated storage): Qemu virtual multipath install/
bootstrap/unlock
PASS - Add OSD ceph storage configuration (AIO-SX)
PASS - Expand CGTS volume group using extra disk (Partition) (AIO-SX)
PASS - Expand CGTS volume group using extra disk (disk) (AIO-SX)
PASS - Add nova local volume group using extra disk (AIO-SX)
PASS - App pod that alocates and writes into a PVC (AIO-SX)
PASS - Local disk Commands (Disk API) - AIO-SX/DX
- host-disk-list
- host-disk-show
- host-disk-partition-list
- host-disk-partition-show
- host-pv-list
- host-pv-show
- host-stor-list
- host-stor-show
- host-lvg-list
- host-lvg-show
- host-pv-add
PASS - Create nova-local volume group
PASS - Local disk Commands on AIO-DX after swact

Regression:
PASS - AIO-SX: Non-multipath install/bootstrap/unlock (NVME)
PASS - AIO-DX: Non-multipath install/bootstrap/unlock (SSD)
PASS - 2+2: Non-multipath install/bootstrap/unlock (SSD)
PASS - 2+2+2 : Non-multipath install/bootstrap/unlock (SSD and HD)
PASS - Distributed cloud: Non-multipath install/bootstrap/unlock

Change-Id: I99cfa858ed6c1e410ceafd6ad7713ad7d6692baf
Depends-On: https://review.opendev.org/c/starlingx/tools/+/860590
Story: 2010046
Task: 47200
Signed-off-by: Robert Church <robert.church@windriver.com>
This commit is contained in:
Robert Church 2023-01-19 23:15:55 -06:00 committed by Matheus Guilhermino
parent c13cd3cf54
commit 3e7aefdb4d
9 changed files with 42 additions and 36 deletions

View File

@ -1,7 +1,6 @@
From 73bbdf3003296ba8b7d4f71b182e58fdb7a04fbd Mon Sep 17 00:00:00 2001
From: Al Bailey <al.bailey@windriver.com>
Date: Tue, 7 Jun 2016 10:36:17 -0400
Subject: [PATCH 1/6] puppet-lvm kilo quilt changes
Subject: puppet-lvm kilo quilt changes
---
lib/puppet/provider/logical_volume/lvm.rb | 168 ++++++++++++++-------
@ -630,6 +629,3 @@ index 7ad3ed6..24017e8 100644
@provider.expects(:lvcreate).with('-n', 'mylv', '--size', '1g', 'myvg')
@provider.create
@provider.expects(:lvs).with('--noheading', '--unit', 'g', '/dev/myvg/mylv').returns(' 1.00g').at_least_once
--
2.16.6

View File

@ -1,7 +1,6 @@
From 16802f9ad304e5aa286a1466ee42cd69c976cfb9 Mon Sep 17 00:00:00 2001
From: Kristine Bujold <kristine.bujold@windriver.com>
Date: Fri, 15 Jul 2016 16:55:16 -0400
Subject: [PATCH 2/6] US80802 - PXE Installation changes for UEFI support.
Subject: US80802 - PXE Installation changes for UEFI support.
Fixing pvcreate issue.
---
@ -42,6 +41,3 @@ index 3d92a55..ff2f94c 100644
def destroy
pvremove(@resource[:name])
end
--
2.16.6

View File

@ -1,7 +1,6 @@
From 96e0b83a1f3131b66188ce1c2c9060e243c02ce3 Mon Sep 17 00:00:00 2001
From: Robert Church <robert.church@windriver.com>
Date: Wed, 1 Mar 2017 09:12:34 +0000
Subject: [PATCH 3/6] US94222: Persistent Dev Naming
Subject: US94222: Persistent Dev Naming
---
lib/puppet/provider/volume_group/lvm.rb | 2 +-
@ -20,6 +19,3 @@ index 4d6e426..a6d4a70 100644
lines.split(%r{\n}).grep(%r{,#{@resource[:name]}$}).map do |s|
s.split(%r{,})[0].strip
end
--
2.16.6

View File

@ -1,7 +1,6 @@
From f2bfd68078f8eb2a09a2bbd2638f2e957b8397af Mon Sep 17 00:00:00 2001
From: Stefan Dinescu <stefan.dinescu@windriver.com>
Date: Wed, 6 Dec 2017 12:50:14 +0000
Subject: [PATCH 4/6] Extending nuke_fs_on_resize_failure functionality
Subject: Extending nuke_fs_on_resize_failure functionality
---
lib/puppet/provider/logical_volume/lvm.rb | 11 ++++++++++-
@ -29,6 +28,3 @@ index 76c7ec0..6aa2989 100644
end
elsif new_size > current_size
if new_size % vg_extent_size != 0
--
2.16.6

View File

@ -1,7 +1,6 @@
From 559be488a84f0699ea7a65208c3c7b32b9095387 Mon Sep 17 00:00:00 2001
From: Kristine Bujold <kristine.bujold@windriver.com>
Date: Thu, 19 Jul 2018 09:02:27 -0400
Subject: [PATCH 5/6] Fix the logical statement for nuke_fs_on_resize
Subject: Fix the logical statement for nuke_fs_on_resize
---
lib/puppet/provider/logical_volume/lvm.rb | 9 ++++++---
@ -39,6 +38,3 @@ index 6aa2989..70037e2 100644
exec_cmd('dd', 'if=/dev/zero', "of=#{path}", "bs=512", "count=16", "conv=notrunc")
blkid('-g')
end
--
2.16.6

View File

@ -1,7 +1,6 @@
From 90f502417268230528dd8fb855b8a4a9b236e96e Mon Sep 17 00:00:00 2001
From: Mihnea Saracin <mihnea.saracin@windriver.com>
Date: Fri, 21 May 2021 13:34:41 -0400
Subject: [PATCH 6/6] Wipe 10MB after we lvextend the partitions
Subject: Wipe 10MB after we lvextend the partitions
---
lib/puppet/provider/logical_volume/lvm.rb | 1 +
@ -19,6 +18,3 @@ index 70037e2..df333f3 100644
exec_cmd('umount', path)
exec_cmd('fsadm', '-y', 'check', path )
r = exec_cmd('fsadm', '-y', 'resize', path, "#{new_size}k")
--
2.16.6

View File

@ -1,7 +1,6 @@
From bf53ce258c7e06cc9dc0e315ee52f41e6a92a108 Mon Sep 17 00:00:00 2001
From: Fabricio Henrique Ramos <fabriciohenrique.ramos@windriver.com>
Date: Thu, 31 Mar 2022 14:59:12 -0300
Subject: [PATCH] Debian: Fix issue on re-install
Subject: Debian: Fix issue on re-install
There is an issue on Debian iso when re-installing which halts the
bootstrap with the error:
@ -37,6 +36,3 @@ index df333f3..322c6e4 100644
lvcreate(*args)
lvzero
end
--
2.17.1

View File

@ -0,0 +1,33 @@
From: Matheus Guilhermino <matheus.machadoguilhermino@windriver.com>
Date: Mon, 13 Feb 2023 16:09:32 -0300
Subject: Handle multipath persistent device support
For HDD/SSD and NVMe disks we provide 'by-path' values which correspond
to physical locations residing within a specific host (i.e. controller
pci slot location). For multipath devices we will use by-id/wwn values
to uniquely identify a persistent disk which will have multiple devices
that coalesce into a single multipath device.
This change will match physical volumes provided to the module in both
/dev/disk/by-path and /dev/disk/by-id/wwn-* patterns. This aligns with
the hiera data generated from the system inventory
Signed-off-by: Robert Church <robert.church@windriver.com>
Signed-off-by: Matheus Guilhermino <matheus.machadoguilhermino@windriver.com>
---
lib/puppet/provider/volume_group/lvm.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/puppet/provider/volume_group/lvm.rb b/lib/puppet/provider/volume_group/lvm.rb
index 9fa687f..f1b00f8 100644
--- a/lib/puppet/provider/volume_group/lvm.rb
+++ b/lib/puppet/provider/volume_group/lvm.rb
@@ -115,7 +115,7 @@ 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}'`
+ lines = `pvs -o pv_name,vg_name --separator ',' | awk -F ',' 'NR>1{cmd="find -L /dev/disk/by-{path,id/wwn-*} -samefile" $1; cmd | getline $1;print $1 "," $2; next};{print}' 2>/dev/null`
lines.split(%r{\n}).grep(%r{,#{@resource[:name]}$}).map do |s|
s.split(%r{,})[0].strip
end

View File

@ -1,8 +1,9 @@
0001-puppet-lvm-kilo-quilt-changes.patch
0002-US80802-PXE-Installation-changes-for-UEFI-support.-F.patch
0002-US80802-PXE-Installation-changes-for-UEFI-support.patch
0003-US94222-Persistent-Dev-Naming.patch
0004-Extending-nuke_fs_on_resize_failure-functionality.patch
0005-Fix-the-logical-statement-for-nuke_fs_on_resize.patch
0006-Wipe-10MB-after-we-lvextend-the-partitions.patch
0007-Debian-Fix-issue-on-re-install.patch
0008-Fix-Ruby-csv.to_a.map-parsing-behavior-under-Debian.patch
0009-Handle-multipath-persistent-device-support.patch