Add initial meta-stx to support StarlingX build
[pti/rtp.git] / meta-stx / recipes-support / puppet / files / puppetlabs-lvm / 0002-UEFI-pvcreate-fix.patch
1 From ac6a60e4d65e33017f8db0eca499f8dd898acb3c Mon Sep 17 00:00:00 2001
2 From: Kristine Bujold <kristine.bujold@windriver.com>
3 Date: Fri, 15 Jul 2016 16:55:16 -0400
4 Subject: [PATCH] US80802 - PXE Installation changes for UEFI support. Fixing
5  pvcreate issue.
6
7 ---
8  .../lvm/lib/puppet/provider/physical_volume/lvm.rb      | 17 ++++++++++++++++-
9  1 file changed, 16 insertions(+), 1 deletion(-)
10
11 diff --git a/packstack/puppet/modules/lvm/lib/puppet/provider/physical_volume/lvm.rb b/packstack/puppet/modules/lvm/lib/puppet/provider/physical_volume/lvm.rb
12 index 6ac6e0a..18183ae 100644
13 --- a/packstack/puppet/modules/lvm/lib/puppet/provider/physical_volume/lvm.rb
14 +++ b/packstack/puppet/modules/lvm/lib/puppet/provider/physical_volume/lvm.rb
15 @@ -1,12 +1,27 @@
16  Puppet::Type.type(:physical_volume).provide(:lvm) do
17      desc "Manages LVM physical volumes"
18  
19 -    commands :pvcreate  => 'pvcreate', :pvremove => 'pvremove', :pvs => 'pvs', :vgs => 'vgs'
20 +
21 +    commands :pvcreate  => 'pvcreate',
22 +             :pvremove => 'pvremove',
23 +             :pvs => 'pvs',
24 +             :vgs => 'vgs',
25 +             :dd  => 'dd'
26  
27      def create
28 +        # Delete the first few bytes at the start and end of the partition. This is required with
29 +        # GPT partitions, they save partition info at the start and the end of the block.
30 +        exec_cmd('dd', 'if=/dev/zero', "of=#{@resource[:name]}", "bs=512", "count=34")
31 +        exec_cmd('dd', 'if=/dev/zero', "of=#{@resource[:name]}", "bs=512", "count=34", "seek=$((`blockdev --getsz #{@resource[:name]}` - 34))")
32 +
33          pvcreate('-y', @resource[:name])
34      end
35  
36 +    def exec_cmd(*cmd)
37 +      output = Puppet::Util::Execution.execute(cmd, :failonfail => false, :combine => true)
38 +      {:out => output, :exit => $CHILD_STATUS.exitstatus}
39 +    end
40 +
41      def destroy
42          pvremove(@resource[:name])
43      end
44 -- 
45 1.8.3.1
46