1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

F #2885: Split ZERO'ing configuration options for fs_lvm

This commit is contained in:
Ruben S. Montero 2019-02-04 16:14:42 +01:00
parent 29760a06ac
commit 5c1dbe9471
4 changed files with 13 additions and 9 deletions

View File

@ -130,7 +130,7 @@ CLONE_CMD=$(cat <<EOF
hostname -f >"${DST_DIR}/.host" || :
# zero trailing space
if [ -n "${ZERO_LVM}" ]; then
if [ -n "${ZERO_LVM_ON_CREATE}" ]; then
LVSIZE=\$(${SUDO} ${LVS} --nosuffix --noheadings --units B -o lv_size "${DEV}" | tr -d '[:blank:]')
${DD} if=/dev/zero of="${DEV}" bs=64k \
oflag=seek_bytes iflag=count_bytes \

View File

@ -78,7 +78,7 @@ EOF
if [ -n "${DS_SYS_ID}" ]; then
if [ -n "${ZERO_LVM}" ]; then
if [ -n "${ZERO_LVM_ON_DELETE}" ]; then
ssh_exec_and_log "$DST_HOST" "$ZERO_CMD" "Error cleaning $DST_PATH"
fi

View File

@ -14,8 +14,12 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
# Default ZERO'ing behavior for the driver. When this variable is set the driver
# will zero LVM space when volumes are allocated or resizes. This prevents data
# from previous allocation to be exposed in new volumes. However this will
# increase the VM allocation time.
ZERO_LVM=
# Default ZERO'ing behavior for the driver. When these variables are set the driver
# will zero LVM space. This prevents data from a previous allocation to be exposed
# in new volumes. However this will increase the VM allocation time.
#
# Zero LVM volumes on creation or resizing
ZERO_LVM_ON_CREATE=yes
# Zero LVM volumes on delete, when the VM disks are disposed
ZERO_LVM_ON_DELETE=yes

View File

@ -59,7 +59,7 @@ VG_NAME="vg-one-$DS_SYS_ID"
DEV="/dev/${VG_NAME}/${LV_NAME}"
# Get current LV size
if [ -n "${ZERO_LVM}" ]; then
if [ -n "${ZERO_LVM_ON_CREATE}" ]; then
LVSIZE_CMD=$(cat <<EOF
set -e -o pipefail
@ -91,7 +91,7 @@ exclusive "${LOCK}" 120 ssh_exec_and_log "$SRC_HOST" "$RESIZE_CMD" \
"Error resizing LV named $LV_NAME"
# Zero additional space
if [ -n "${ZERO_LVM}" ]; then
if [ -n "${ZERO_LVM_ON_CREATE}" ]; then
ZERO_CMD=$(cat <<EOF
set -e -o pipefail