summaryrefslogtreecommitdiffstats
path: root/.gitreview
blob: 0998de97b37afb180d07adaa4a4fdf3dcedb6103 (plain)
1
2
3
4
5
6
[gerrit]
host=gerrit.opnfv.org
port=29418
project=releng.git
defaultbranch=master
/ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
partitions=\$(pvs --noheadings --separator :| cut -d: -f1,2)
vg_remove=0
remove_partitions=''
echo "partitions \$partitions" >> /tmp/post_partition.log

for partition in \$partitions; do
    partition_vg=(\${partition//:/ })
    partition=\${partition_vg[0]}
    vg=\${partition_vg[1]}
    if [[ "\$vg" == "reserved" ]]; then
        echo "prepare remove partition \$partition" >> /tmp/post_partition.log
        remove_partitions="\${remove_partitions} \$partition"
        vg_remove=1
    else
        echo "ignore \$vg since it is not reserved" >> /tmp/post_partition.log
    fi
done

if [[ "\${vg_remove}" != "0" ]]; then
    vgremove -f reserved
fi

for remove_partition in \${remove_partitions}; do
    echo "remove partition \${remove_partition}" >> /tmp/post_partition.log
    pvremove -ff -y \${remove_partition}
    set \$(echo \${remove_partition}  | sed -e 's/^\(.*\)\([0-9]\+\)\$/\1 \2/g')
    partition_disk=\$1
    partition_number=\$2
    if [ -z "\${partition_disk}" -o -z "\${partition_number}" ]; then
        continue
    fi
    parted \${partition_disk} --script -- rm \${partition_number}
done