build_inf.sh: change the protocal for github repo
[pti/rtp.git] / meta-stx / recipes-support / puppet / files / puppet-drbd / 0004-US-96914-reuse-existing-drbd-cinder-resource.patch
1 From 132fc324c633ee95ca9ac8d00fb27fe5c4df6a3a Mon Sep 17 00:00:00 2001
2 From: Daniel Badea <daniel.badea@windriver.com>
3 Date: Tue, 30 May 2017 21:52:52 +0000
4 Subject: [PATCH] US-96914 reuse existing drbd-cinder resource
5
6 Trying to initialize and enable DRBD resource fails in "drbdadm
7 create-md" when the disk already contains meta data. In this case
8 "drbdadm adjust" should be called.
9 ---
10  manifests/resource/up.pp | 13 ++++++++++++-
11  1 file changed, 12 insertions(+), 1 deletion(-)
12
13 diff --git a/manifests/resource/up.pp b/manifests/resource/up.pp
14 index f9de8ab..160c8c2 100644
15 --- a/manifests/resource/up.pp
16 +++ b/manifests/resource/up.pp
17 @@ -14,7 +14,7 @@ define drbd::resource::up (
18    exec { "initialize DRBD metadata for ${name}":
19      command => "yes yes | drbdadm create-md ${name}",
20      onlyif  => "test -e ${disk}",
21 -    unless  => "drbdadm dump-md ${name} || (drbdadm cstate ${name} | egrep -q '^(Sync|Connected|WFConnection|StandAlone|Verify)')",
22 +    unless  => "drbdadm dump-md ${name} || (drbdadm cstate ${name} | egrep -q '^(Sync|Connected|WFConnection|StandAlone|Verify)') || (drbdadm show-gi ${name} | grep 'meta-data: need apply-al')",
23      before  => Service['drbd'],
24      require => [
25        Exec['modprobe drbd'],
26 @@ -26,6 +26,7 @@ define drbd::resource::up (
27    exec { "enable DRBD resource ${name}":
28      command => "drbdadm up ${name}",
29      onlyif  => "drbdadm dstate ${name} | egrep -q '^(Diskless/|Unconfigured|Consistent)'",
30 +    unless  => "drbdadm show-gi ${name} | grep 'meta-data: need apply-al'",
31      before  => Service['drbd'],
32      require => [
33        Exec["initialize DRBD metadata for ${name}"],
34 @@ -34,6 +35,16 @@ define drbd::resource::up (
35      notify  => Service['drbd'],
36    }
37  
38 +  exec { "reuse existing DRBD resoure ${name}":
39 +    command => "drbdadm adjust ${name}",
40 +    onlyif  => "test -e ${disk} && (drbdadm show-gi ${name} | grep 'meta-data: need apply-al')",
41 +    before  => Service['drbd'],
42 +    require => [
43 +      Exec['modprobe drbd'],
44 +      Concat["/etc/drbd.d/${name}.res"],
45 +    ],
46 +    notify  => Service['drbd'],
47 +  }
48  
49    # these resources should only be applied if we are configuring the
50    # primary node in our HA setup
51 -- 
52 1.8.3.1
53