From 3e7aefdb4dede2c24e516757fcf965ad2e710c5b Mon Sep 17 00:00:00 2001 From: Robert Church Date: Thu, 19 Jan 2023 23:15:55 -0600 Subject: [PATCH] puppet-lvm: Handle multipath persistent device support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../0001-puppet-lvm-kilo-quilt-changes.patch | 6 +--- ...stallation-changes-for-UEFI-support.patch} | 6 +--- .../0003-US94222-Persistent-Dev-Naming.patch | 6 +--- ...e_fs_on_resize_failure-functionality.patch | 6 +--- ...ical-statement-for-nuke_fs_on_resize.patch | 6 +--- ...0MB-after-we-lvextend-the-partitions.patch | 6 +--- .../0007-Debian-Fix-issue-on-re-install.patch | 6 +--- ...-multipath-persistent-device-support.patch | 33 +++++++++++++++++++ .../debian/deb_folder/patches/series | 3 +- 9 files changed, 42 insertions(+), 36 deletions(-) rename config/puppet-modules/puppet-lvm-1.4.0/debian/deb_folder/patches/{0002-US80802-PXE-Installation-changes-for-UEFI-support.-F.patch => 0002-US80802-PXE-Installation-changes-for-UEFI-support.patch} (91%) create mode 100644 config/puppet-modules/puppet-lvm-1.4.0/debian/deb_folder/patches/0009-Handle-multipath-persistent-device-support.patch diff --git a/config/puppet-modules/puppet-lvm-1.4.0/debian/deb_folder/patches/0001-puppet-lvm-kilo-quilt-changes.patch b/config/puppet-modules/puppet-lvm-1.4.0/debian/deb_folder/patches/0001-puppet-lvm-kilo-quilt-changes.patch index 3a1bf9ca9..e72acefb4 100644 --- a/config/puppet-modules/puppet-lvm-1.4.0/debian/deb_folder/patches/0001-puppet-lvm-kilo-quilt-changes.patch +++ b/config/puppet-modules/puppet-lvm-1.4.0/debian/deb_folder/patches/0001-puppet-lvm-kilo-quilt-changes.patch @@ -1,7 +1,6 @@ -From 73bbdf3003296ba8b7d4f71b182e58fdb7a04fbd Mon Sep 17 00:00:00 2001 From: Al Bailey 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 - diff --git a/config/puppet-modules/puppet-lvm-1.4.0/debian/deb_folder/patches/0002-US80802-PXE-Installation-changes-for-UEFI-support.-F.patch b/config/puppet-modules/puppet-lvm-1.4.0/debian/deb_folder/patches/0002-US80802-PXE-Installation-changes-for-UEFI-support.patch similarity index 91% rename from config/puppet-modules/puppet-lvm-1.4.0/debian/deb_folder/patches/0002-US80802-PXE-Installation-changes-for-UEFI-support.-F.patch rename to config/puppet-modules/puppet-lvm-1.4.0/debian/deb_folder/patches/0002-US80802-PXE-Installation-changes-for-UEFI-support.patch index a8908e082..ece8f9b4c 100644 --- a/config/puppet-modules/puppet-lvm-1.4.0/debian/deb_folder/patches/0002-US80802-PXE-Installation-changes-for-UEFI-support.-F.patch +++ b/config/puppet-modules/puppet-lvm-1.4.0/debian/deb_folder/patches/0002-US80802-PXE-Installation-changes-for-UEFI-support.patch @@ -1,7 +1,6 @@ -From 16802f9ad304e5aa286a1466ee42cd69c976cfb9 Mon Sep 17 00:00:00 2001 From: Kristine Bujold 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 - diff --git a/config/puppet-modules/puppet-lvm-1.4.0/debian/deb_folder/patches/0003-US94222-Persistent-Dev-Naming.patch b/config/puppet-modules/puppet-lvm-1.4.0/debian/deb_folder/patches/0003-US94222-Persistent-Dev-Naming.patch index 0e03822d4..8166298af 100644 --- a/config/puppet-modules/puppet-lvm-1.4.0/debian/deb_folder/patches/0003-US94222-Persistent-Dev-Naming.patch +++ b/config/puppet-modules/puppet-lvm-1.4.0/debian/deb_folder/patches/0003-US94222-Persistent-Dev-Naming.patch @@ -1,7 +1,6 @@ -From 96e0b83a1f3131b66188ce1c2c9060e243c02ce3 Mon Sep 17 00:00:00 2001 From: Robert Church 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 - diff --git a/config/puppet-modules/puppet-lvm-1.4.0/debian/deb_folder/patches/0004-Extending-nuke_fs_on_resize_failure-functionality.patch b/config/puppet-modules/puppet-lvm-1.4.0/debian/deb_folder/patches/0004-Extending-nuke_fs_on_resize_failure-functionality.patch index 7c15a175d..d03d53307 100644 --- a/config/puppet-modules/puppet-lvm-1.4.0/debian/deb_folder/patches/0004-Extending-nuke_fs_on_resize_failure-functionality.patch +++ b/config/puppet-modules/puppet-lvm-1.4.0/debian/deb_folder/patches/0004-Extending-nuke_fs_on_resize_failure-functionality.patch @@ -1,7 +1,6 @@ -From f2bfd68078f8eb2a09a2bbd2638f2e957b8397af Mon Sep 17 00:00:00 2001 From: Stefan Dinescu 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 - diff --git a/config/puppet-modules/puppet-lvm-1.4.0/debian/deb_folder/patches/0005-Fix-the-logical-statement-for-nuke_fs_on_resize.patch b/config/puppet-modules/puppet-lvm-1.4.0/debian/deb_folder/patches/0005-Fix-the-logical-statement-for-nuke_fs_on_resize.patch index e3c9aec97..c08dd53e4 100644 --- a/config/puppet-modules/puppet-lvm-1.4.0/debian/deb_folder/patches/0005-Fix-the-logical-statement-for-nuke_fs_on_resize.patch +++ b/config/puppet-modules/puppet-lvm-1.4.0/debian/deb_folder/patches/0005-Fix-the-logical-statement-for-nuke_fs_on_resize.patch @@ -1,7 +1,6 @@ -From 559be488a84f0699ea7a65208c3c7b32b9095387 Mon Sep 17 00:00:00 2001 From: Kristine Bujold 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 - diff --git a/config/puppet-modules/puppet-lvm-1.4.0/debian/deb_folder/patches/0006-Wipe-10MB-after-we-lvextend-the-partitions.patch b/config/puppet-modules/puppet-lvm-1.4.0/debian/deb_folder/patches/0006-Wipe-10MB-after-we-lvextend-the-partitions.patch index 56feae2ab..86624124b 100644 --- a/config/puppet-modules/puppet-lvm-1.4.0/debian/deb_folder/patches/0006-Wipe-10MB-after-we-lvextend-the-partitions.patch +++ b/config/puppet-modules/puppet-lvm-1.4.0/debian/deb_folder/patches/0006-Wipe-10MB-after-we-lvextend-the-partitions.patch @@ -1,7 +1,6 @@ -From 90f502417268230528dd8fb855b8a4a9b236e96e Mon Sep 17 00:00:00 2001 From: Mihnea Saracin 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 - diff --git a/config/puppet-modules/puppet-lvm-1.4.0/debian/deb_folder/patches/0007-Debian-Fix-issue-on-re-install.patch b/config/puppet-modules/puppet-lvm-1.4.0/debian/deb_folder/patches/0007-Debian-Fix-issue-on-re-install.patch index c37f38a6d..e9406ec8d 100644 --- a/config/puppet-modules/puppet-lvm-1.4.0/debian/deb_folder/patches/0007-Debian-Fix-issue-on-re-install.patch +++ b/config/puppet-modules/puppet-lvm-1.4.0/debian/deb_folder/patches/0007-Debian-Fix-issue-on-re-install.patch @@ -1,7 +1,6 @@ -From bf53ce258c7e06cc9dc0e315ee52f41e6a92a108 Mon Sep 17 00:00:00 2001 From: Fabricio Henrique Ramos 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 - diff --git a/config/puppet-modules/puppet-lvm-1.4.0/debian/deb_folder/patches/0009-Handle-multipath-persistent-device-support.patch b/config/puppet-modules/puppet-lvm-1.4.0/debian/deb_folder/patches/0009-Handle-multipath-persistent-device-support.patch new file mode 100644 index 000000000..6d02b7d9c --- /dev/null +++ b/config/puppet-modules/puppet-lvm-1.4.0/debian/deb_folder/patches/0009-Handle-multipath-persistent-device-support.patch @@ -0,0 +1,33 @@ +From: Matheus Guilhermino +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 +Signed-off-by: Matheus Guilhermino +--- + 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 diff --git a/config/puppet-modules/puppet-lvm-1.4.0/debian/deb_folder/patches/series b/config/puppet-modules/puppet-lvm-1.4.0/debian/deb_folder/patches/series index 8546b65bd..22a43919f 100644 --- a/config/puppet-modules/puppet-lvm-1.4.0/debian/deb_folder/patches/series +++ b/config/puppet-modules/puppet-lvm-1.4.0/debian/deb_folder/patches/series @@ -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