Add initial meta-stx to support StarlingX build
[pti/rtp.git] / meta-stx / recipes-support / puppet / files / puppetlabs-lvm / Fix-the-logical-statement-for-nuke_fs_on_resize.patch
diff --git a/meta-stx/recipes-support/puppet/files/puppetlabs-lvm/Fix-the-logical-statement-for-nuke_fs_on_resize.patch b/meta-stx/recipes-support/puppet/files/puppetlabs-lvm/Fix-the-logical-statement-for-nuke_fs_on_resize.patch
new file mode 100644 (file)
index 0000000..e1796ba
--- /dev/null
@@ -0,0 +1,45 @@
+From 21d2c4e714611ad08e5aa999e555e1e7591f2717 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 1/1] Patch4:
+ Fix-the-logical-statement-for-nuke_fs_on_resize_2.patch
+
+---
+ .../puppet/modules/lvm/lib/puppet/provider/logical_volume/lvm.rb | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/packstack/puppet/modules/lvm/lib/puppet/provider/logical_volume/lvm.rb b/packstack/puppet/modules/lvm/lib/puppet/provider/logical_volume/lvm.rb
+index 2abfea3..f9b1c66 100755
+--- a/packstack/puppet/modules/lvm/lib/puppet/provider/logical_volume/lvm.rb
++++ b/packstack/puppet/modules/lvm/lib/puppet/provider/logical_volume/lvm.rb
+@@ -184,13 +184,15 @@ Puppet::Type.type(:logical_volume).provide :lvm do
+           exec_cmd('umount', path)
+           exec_cmd('fsadm', '-y', 'check', path )
+           r = exec_cmd('fsadm', '-y', 'resize', path, "#{new_size}k")
+-          if r[:exit] != 0 and @resource[:nuke_fs_on_resize_failure]
++          if r[:exit] != 0 and [:true, "true", true ].include? @resource[:nuke_fs_on_resize_failure]
++            info( "Failed 'fsadm resize' erase the disk #{r}" )
+             exec_cmd('dd', 'if=/dev/zero', "of=#{path}", "bs=512", "count=16", "conv=notrunc")
+             blkid('-g')
+           end
+           r = exec_cmd('lvresize', '-r', '-f', '-L', "#{new_size}k", path)
+           if r[:exit] != 0
+-            if @resource[:nuke_fs_on_resize_failure]
++            if [:true, "true", true ].include? @resource[:nuke_fs_on_resize_failure]
++              info( "Failed 'fsadm resize' erase the disk #{r}" )
+               exec_cmd('dd', 'if=/dev/zero', "of=#{path}", "bs=512", "count=16", "conv=notrunc")
+               blkid('-g')
+               lvresize( '-f', '-L', "#{new_size}k", path) || fail( "Cannot reduce to size #{new_size} because lvresize failed." )
+@@ -215,7 +217,8 @@ Puppet::Type.type(:logical_volume).provide :lvm do
+         exec_cmd('umount', path)
+         exec_cmd('fsadm', '-y', 'check', path )
+         r = exec_cmd('fsadm', '-y', 'resize', path, "#{new_size}k")
+-        if r[:exit] != 0 and @resource[:nuke_fs_on_resize_failure]
++        if r[:exit] != 0 and [:true, "true", true ].include? @resource[:nuke_fs_on_resize_failure]
++          info( "Failed 'fsadm resize' erase the disk #{r}" )
+           exec_cmd('dd', 'if=/dev/zero', "of=#{path}", "bs=512", "count=16", "conv=notrunc")
+           blkid('-g')
+         end
+-- 
+1.8.3.1
+