X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=meta-starlingx%2Fmeta-stx-cloud%2Frecipes-support%2Fcluster-resource-agents%2Fresource-agents%2Fstx%2Flvm_vg_activation.patch;fp=meta-starlingx%2Fmeta-stx-cloud%2Frecipes-support%2Fcluster-resource-agents%2Fresource-agents%2Fstx%2Flvm_vg_activation.patch;h=0000000000000000000000000000000000000000;hb=6fc6934434f70595536a387ece31bc30141cafb5;hp=abb7c58436d5ecaf3c02235c1f975774fb2afd23;hpb=eb1e26510491ba49de693ab3b0498edcb06be6c5;p=pti%2Frtp.git diff --git a/meta-starlingx/meta-stx-cloud/recipes-support/cluster-resource-agents/resource-agents/stx/lvm_vg_activation.patch b/meta-starlingx/meta-stx-cloud/recipes-support/cluster-resource-agents/resource-agents/stx/lvm_vg_activation.patch deleted file mode 100644 index abb7c58..0000000 --- a/meta-starlingx/meta-stx-cloud/recipes-support/cluster-resource-agents/resource-agents/stx/lvm_vg_activation.patch +++ /dev/null @@ -1,150 +0,0 @@ -From 577055560d55b388d479ef398ffd839792dc1996 Mon Sep 17 00:00:00 2001 -From: Scott Little -Date: Mon, 2 Oct 2017 15:12:54 -0400 -Subject: [PATCH 06/13] WRS: Patch1110: lvm_vg_activation.patch - ---- - heartbeat/LVM | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++- - 1 file changed, 116 insertions(+), 1 deletion(-) - -diff --git a/heartbeat/LVM b/heartbeat/LVM -index b0ca87a..38092f9 100755 ---- a/heartbeat/LVM -+++ b/heartbeat/LVM -@@ -222,6 +222,81 @@ LVM_status() { - } - - # -+# Activate one volume explicitly. -+# -+activate_volume() { -+ ocf_run lvchange $1 /dev/${2}/$3 -+ if [ $? -eq 0 ] ; then -+ ocf_log info "Succesfully activated $LV." -+ else -+ ocf_log err "Problem activating $LV." -+ fi -+} -+ -+# -+# Kick off parallel activation of all volumes -+# -+activate_all_volumes() { -+ VG=$1 -+ shift -+ lvchange_args="$*" -+ -+ # Get the list of volumes, without the first line which is column headings. -+ VOLS=`lvs $VG |tail -n +2` -+ -+ while read -r LINE; do -+ # Convert the line into an array. -+ LINE_ARRAY=($LINE) -+ -+ # First array element is the volume/snapshot name. -+ LV=${LINE_ARRAY[0]} -+ -+ # Third array element is the attributes. -+ ATTR=${LINE_ARRAY[2]} -+ -+ # Fifth character in the attributes is "a" if it's active. -+ ACTIVE=${ATTR:4:1} -+ if [ "$ACTIVE" == "a" ]; then -+ ocf_log info "$LV is already active." -+ continue -+ fi -+ -+ SNAPSHOT_ORIGIN=${LINE_ARRAY[4]} -+ if [ "$SNAPSHOT_ORIGIN" != "" ] ; then -+ # If this is a snapshot, don't activate it. -+ continue -+ fi -+ -+ ( activate_volume "$*" $VG $LV ) & -+ done <<< "$VOLS" -+} -+ -+# -+# Scan for inactive volumes and log any that are found. -+# -+log_inactive_volumes() { -+ # Get the list of volumes, without the first line which is column headings. -+ VOLS=`lvs $1 |tail -n +2` -+ -+ while read -r LINE; do -+ # Convert the line into an array. -+ LINE_ARRAY=($LINE) -+ -+ # First array element is the volume/snapshot name. -+ LV=${LINE_ARRAY[0]} -+ -+ # Third array element is the attributes. -+ ATTR=${LINE_ARRAY[2]} -+ -+ # Fifth character in the attributes is "a" if it's active. -+ ACTIVE=${ATTR:4:1} -+ if [ "$ACTIVE" != "a" ]; then -+ ocf_log err "Volume $LV is not active after expiry of timeout." -+ fi -+ done <<< "$VOLS" -+} -+ -+# - # Enable LVM volume - # - LVM_start() { -@@ -241,10 +316,50 @@ LVM_start() { - ocf_run vgscan - fi - -+ # Kick off activation of all volumes. If it doesn't complete within -+ # the timeout period, then we'll log the not-yet-activated volumes and -+ # continue on. - lvm_pre_activate || exit -- ocf_run vgchange $vgchange_activate_options $vg -+ (ocf_run vgchange $vgchange_activate_options $1) & PID=$! - lvm_post_activate $? - -+ # Check every second for up to TIMEOUT seconds whether the vgchange has -+ # completed. -+ TIMEOUT=300 -+ TIMED_OUT=true -+ SECONDS=0; -+ PARALLEL_ACTIVATE_DELAY=10 -+ PARALLEL_ACTIVATE_DONE=false -+ while [ $SECONDS -lt $TIMEOUT ] ; do -+ kill -0 $PID &> /dev/null -+ if [ $? -eq 1 ] ; then -+ # process with pid of $PID doesn't exist, vgchange command completed -+ TIMED_OUT=false -+ break -+ fi -+ if [ $SECONDS -ge $PARALLEL_ACTIVATE_DELAY ] && \ -+ [ "$PARALLEL_ACTIVATE_DONE" != true ] && \ -+ [ "$1" == "cinder-volumes" ] ; then -+ # This will kick off parallel activation of all LVs in the VG. -+ # The delay is to ensure the VG is activated first. -+ PARALLEL_ACTIVATE_DONE=true -+ ocf_log info Explicitly activating all volumes in $1 with: $vgchange_activate_options -+ activate_all_volumes $1 $vgchange_activate_options -+ fi -+ sleep 1 -+ done -+ -+ if [ "$TIMED_OUT" = true ] ; then -+ ocf_log err "Timed out running ocf_run vgchange $vgchange_activate_options $1" -+ log_inactive_volumes $1 -+ else -+ # Child process completed, get its status. -+ wait $PID -+ if [ $? -ne 0 ] ; then -+ return $OCF_ERR_GENERIC -+ fi -+ fi -+ - if LVM_status $vg; then - : OK Volume $vg activated just fine! - return $OCF_SUCCESS --- -2.7.4 -