From 8106a9787d86901d4ed927838503ebe08bf2adcb Mon Sep 17 00:00:00 2001 From: Felipe Sanches Zanoni Date: Mon, 14 Feb 2022 12:01:30 -0500 Subject: [PATCH] Fix DRBD cephmon resize --- manifests/resource/up.pp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/manifests/resource/up.pp b/manifests/resource/up.pp index 11cf7ee..8d2f901 100644 --- a/manifests/resource/up.pp +++ b/manifests/resource/up.pp @@ -19,18 +19,29 @@ define drbd::resource::up ( ], } + # Ensure DRBD metadata is clear + exec { "apply-al DRBD metadata for ${name}": + command => "drbdadm apply-al ${name}", + onlyif => "drbdadm dump-md ${name} 2>&1 | egrep 'please apply-al'", + before => Service['drbd'], + require => [ + Exec['modprobe drbd'] + ], + } + # create metadata on device, except if resource seems already initalized. # drbd is very tenacious about asking for aproval if there is data on the # volume already. exec { "initialize DRBD metadata for ${name}": command => "yes yes | drbdadm create-md ${name} -W--peer-max-bio-size=128k", - onlyif => "test -e ${disk}", + onlyif => "test -e ${disk} && ! drbdadm dstate ${name}", unless => "drbdadm dump-md ${name} || (drbdadm cstate ${name} | egrep -q '^(PausedSync|Sync|Connected|WFConnection|StandAlone|Verify)') || (drbdadm show-gi ${name} | grep 'meta-data: need apply-al')", before => Service['drbd'], require => [ Exec['modprobe drbd'], Exec["test disk by-path for ${name}"], Concat["/etc/drbd.d/${name}.res"], + Exec["apply-al DRBD metadata for ${name}"] ], notify => Service['drbd'], } -- 2.29.2