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
1 From 21d2c4e714611ad08e5aa999e555e1e7591f2717 Mon Sep 17 00:00:00 2001
2 From: Kristine Bujold <kristine.bujold@windriver.com>
3 Date: Thu, 19 Jul 2018 09:02:27 -0400
4 Subject: [PATCH 1/1] Patch4:
5  Fix-the-logical-statement-for-nuke_fs_on_resize_2.patch
6
7 ---
8  .../puppet/modules/lvm/lib/puppet/provider/logical_volume/lvm.rb | 9 ++++++---
9  1 file changed, 6 insertions(+), 3 deletions(-)
10
11 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
12 index 2abfea3..f9b1c66 100755
13 --- a/packstack/puppet/modules/lvm/lib/puppet/provider/logical_volume/lvm.rb
14 +++ b/packstack/puppet/modules/lvm/lib/puppet/provider/logical_volume/lvm.rb
15 @@ -184,13 +184,15 @@ Puppet::Type.type(:logical_volume).provide :lvm do
16            exec_cmd('umount', path)
17            exec_cmd('fsadm', '-y', 'check', path )
18            r = exec_cmd('fsadm', '-y', 'resize', path, "#{new_size}k")
19 -          if r[:exit] != 0 and @resource[:nuke_fs_on_resize_failure]
20 +          if r[:exit] != 0 and [:true, "true", true ].include? @resource[:nuke_fs_on_resize_failure]
21 +            info( "Failed 'fsadm resize' erase the disk #{r}" )
22              exec_cmd('dd', 'if=/dev/zero', "of=#{path}", "bs=512", "count=16", "conv=notrunc")
23              blkid('-g')
24            end
25            r = exec_cmd('lvresize', '-r', '-f', '-L', "#{new_size}k", path)
26            if r[:exit] != 0
27 -            if @resource[:nuke_fs_on_resize_failure]
28 +            if [:true, "true", true ].include? @resource[:nuke_fs_on_resize_failure]
29 +              info( "Failed 'fsadm resize' erase the disk #{r}" )
30                exec_cmd('dd', 'if=/dev/zero', "of=#{path}", "bs=512", "count=16", "conv=notrunc")
31                blkid('-g')
32                lvresize( '-f', '-L', "#{new_size}k", path) || fail( "Cannot reduce to size #{new_size} because lvresize failed." )
33 @@ -215,7 +217,8 @@ Puppet::Type.type(:logical_volume).provide :lvm do
34          exec_cmd('umount', path)
35          exec_cmd('fsadm', '-y', 'check', path )
36          r = exec_cmd('fsadm', '-y', 'resize', path, "#{new_size}k")
37 -        if r[:exit] != 0 and @resource[:nuke_fs_on_resize_failure]
38 +        if r[:exit] != 0 and [:true, "true", true ].include? @resource[:nuke_fs_on_resize_failure]
39 +          info( "Failed 'fsadm resize' erase the disk #{r}" )
40            exec_cmd('dd', 'if=/dev/zero', "of=#{path}", "bs=512", "count=16", "conv=notrunc")
41            blkid('-g')
42          end
43 -- 
44 1.8.3.1
45