Compare commits
No commits in common. "c8" and "c8-beta" have entirely different histories.
|
@ -1,35 +0,0 @@
|
|||
From c41468a8acff9fd71bf774c821ad7c92623889da Mon Sep 17 00:00:00 2001
|
||||
From: Andrew Walsh <awalsh@redhat.com>
|
||||
Date: Mon, 15 Nov 2021 10:49:06 -0500
|
||||
Subject: [PATCH 069/115] vdo: ensure VDO config is removed
|
||||
|
||||
Make sure to remove the VDO config after conversion
|
||||
of LVM-backed VDO.
|
||||
|
||||
Addresses point 3 in rhbz#1987024#c5
|
||||
|
||||
(cherry picked from commit 522561e64b5fe73cb9d01c2ee2d4b7624b0ddff4)
|
||||
---
|
||||
scripts/lvm_import_vdo.sh | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/scripts/lvm_import_vdo.sh b/scripts/lvm_import_vdo.sh
|
||||
index beb55dbdb..cc09187e9 100755
|
||||
--- a/scripts/lvm_import_vdo.sh
|
||||
+++ b/scripts/lvm_import_vdo.sh
|
||||
@@ -405,6 +405,12 @@ EOF
|
||||
verbose "Converting to VDO pool."
|
||||
dry "$LVM" lvconvert $YES $VERB $FORCE --config "$PARAMS" -Zn -V "${vdo_logicalSize}k" -n "$LVNAME" --type vdo-pool "$VGNAME/${LVNAME}_vpool"
|
||||
|
||||
+ # Note: that this is spelled OPPOSITE the other $IS_LV checks.
|
||||
+ if [ "$IS_LV" = "1" ]; then
|
||||
+ verbose "Removing now-unused VDO entry from VDO config."
|
||||
+ dry "$VDO" remove $VDOCONF --force --verbose --name "$VDONAME"
|
||||
+ fi
|
||||
+
|
||||
rm -fr "$TEMPDIR"
|
||||
}
|
||||
|
||||
--
|
||||
2.41.0
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
From a147a14813d576a11ed2f9ff08090fad874e418a Mon Sep 17 00:00:00 2001
|
||||
From: Zdenek Kabelac <zkabelac@redhat.com>
|
||||
Date: Tue, 31 May 2022 22:48:38 +0200
|
||||
Subject: [PATCH 070/115] vdo: fix conversion of vdo_slab_size_mb
|
||||
|
||||
When converting VDO volume, the parameter vdo_slabSize was
|
||||
incorrectly copied as vdo_blockMapCacheSize, however this parameter
|
||||
is then no longer used for any table line creation so the wrong
|
||||
value was only stored in metadata.
|
||||
|
||||
Also use just single get_kb_size_with_unit_ and remove it's duplicate
|
||||
functionality with get_mb_size_with_unit_.
|
||||
|
||||
Use $VERB for vdo remove call.
|
||||
|
||||
(cherry picked from commit 1b070f366ba57a6eb24df03241284732db5047e9)
|
||||
---
|
||||
WHATS_NEW | 3 ++-
|
||||
scripts/lvm_import_vdo.sh | 2 +-
|
||||
2 files changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/WHATS_NEW b/WHATS_NEW
|
||||
index bffd24648..705fbde74 100644
|
||||
--- a/WHATS_NEW
|
||||
+++ b/WHATS_NEW
|
||||
@@ -1,6 +1,7 @@
|
||||
Version 2.03.17 -
|
||||
===============================
|
||||
- Fix lvconvert --test --type vdo-pool execution.
|
||||
+ Fix lvconvert --test --type vdo-pool execution.
|
||||
+ Fix vdo_slab_size_mb value for converted VDO volume.
|
||||
|
||||
Version 2.03.16 -
|
||||
====================================
|
||||
diff --git a/scripts/lvm_import_vdo.sh b/scripts/lvm_import_vdo.sh
|
||||
index cc09187e9..c10b3b050 100755
|
||||
--- a/scripts/lvm_import_vdo.sh
|
||||
+++ b/scripts/lvm_import_vdo.sh
|
||||
@@ -408,7 +408,7 @@ EOF
|
||||
# Note: that this is spelled OPPOSITE the other $IS_LV checks.
|
||||
if [ "$IS_LV" = "1" ]; then
|
||||
verbose "Removing now-unused VDO entry from VDO config."
|
||||
- dry "$VDO" remove $VDOCONF --force --verbose --name "$VDONAME"
|
||||
+ dry "$VDO" remove $VDOCONF $VERB --force --name "$VDONAME"
|
||||
fi
|
||||
|
||||
rm -fr "$TEMPDIR"
|
||||
--
|
||||
2.41.0
|
||||
|
|
@ -1,396 +0,0 @@
|
|||
From 2456b39b345a589949528bd439052a776d274d63 Mon Sep 17 00:00:00 2001
|
||||
From: Zdenek Kabelac <zkabelac@redhat.com>
|
||||
Date: Tue, 31 May 2022 22:45:29 +0200
|
||||
Subject: [PATCH 071/115] tests: add lvm_vdo_wrapper
|
||||
|
||||
Introduce a replacement vdo manager wrapper for testing.
|
||||
When using test suite on a system without vdo manager (which has got
|
||||
deprecated) - we still need its functionality to prepare 'vdo volume'
|
||||
for testing lvm_import_vdo.
|
||||
|
||||
Wrapper currently need 2 binaries from older 'vdo 6.2' package -
|
||||
to be named:
|
||||
oldvdoformat - format VDO metadata with older format
|
||||
oldvdoprepareforlvm - shift vdo metadata by 1MiB
|
||||
|
||||
(cherry picked from commit 2ecfd503edadaf5d46115826c629754bf9fd573f)
|
||||
---
|
||||
test/Makefile.in | 1 +
|
||||
test/lib/lvm_vdo_wrapper.sh | 353 ++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 354 insertions(+)
|
||||
create mode 100755 test/lib/lvm_vdo_wrapper.sh
|
||||
|
||||
diff --git a/test/Makefile.in b/test/Makefile.in
|
||||
index ecb9e4264..f69dc97b6 100644
|
||||
--- a/test/Makefile.in
|
||||
+++ b/test/Makefile.in
|
||||
@@ -369,6 +369,7 @@ LIB = $(addprefix lib/, $(LIB_SECURETEST) $(LIB_DMSECURETEST) $(LIB_SHARED) $(LI
|
||||
$(Q) $(LN_S) -f $(abs_top_srcdir)/conf/thin-performance.profile lib/
|
||||
$(Q) $(LN_S) -f $(abs_top_srcdir)/scripts/fsadm.sh lib/fsadm
|
||||
$(Q) $(LN_S) -f $(abs_top_srcdir)/scripts/lvm_import_vdo.sh lib/lvm_import_vdo
|
||||
+ $(Q) which vdo || $(LN_S) -f $(abs_top_srcdir)/test/lib/lvm_vdo_wrapper.sh lib/vdo
|
||||
@test "$(srcdir)" = . || \
|
||||
for i in $(LIB_LVMLOCKD_CONF) $(LIB_MKE2FS_CONF); do \
|
||||
test -n "$(Q)" || echo "$(LN_S) -f $(abs_top_srcdir)/test/lib/$$i lib/"; \
|
||||
diff --git a/test/lib/lvm_vdo_wrapper.sh b/test/lib/lvm_vdo_wrapper.sh
|
||||
new file mode 100755
|
||||
index 000000000..d622d6456
|
||||
--- /dev/null
|
||||
+++ b/test/lib/lvm_vdo_wrapper.sh
|
||||
@@ -0,0 +1,353 @@
|
||||
+#!/bin/bash
|
||||
+#
|
||||
+# Wrapper script for 'naive' emulation of vdo manager tool for systems
|
||||
+# that no longer have this tool present
|
||||
+#
|
||||
+
|
||||
+set -euE -o pipefail
|
||||
+
|
||||
+# tool for formating 'old' VDO metadata format
|
||||
+LVM_VDO_FORMAT=${LVM_VDO_FORMAT-"oldvdoformat"}
|
||||
+# tool for shifting VDO metadata header by 2MiB
|
||||
+LVM_VDO_PREPARE=${LVM_VDO_PREPARE-"oldvdoprepareforlvm"}
|
||||
+# default vdo conf file
|
||||
+LVM_VDO_DEFAULT_CONF=${LVM_VDO_DEFAULT_CONF-"/tmp/vdoconf.yml"}
|
||||
+
|
||||
+vdo_die_() {
|
||||
+ echo -e "$@" >&2
|
||||
+ return 1
|
||||
+}
|
||||
+
|
||||
+vdo_verbose_() {
|
||||
+ test -z "$vdo_verbose" || echo "$0:" "$@"
|
||||
+}
|
||||
+
|
||||
+vdo_dry_() {
|
||||
+ if test -n "$vdo_dry"; then
|
||||
+ vdo_verbose_ "Dry execution" "$@"
|
||||
+ return 0
|
||||
+ fi
|
||||
+ vdo_verbose_ "Executing" "$@"
|
||||
+ "$@"
|
||||
+}
|
||||
+
|
||||
+vdo_get_kb_size_with_unit_() {
|
||||
+ local sz=${2-1} # 2nd. arg as unit - default 'k'
|
||||
+
|
||||
+ case "$sz" in
|
||||
+ [mM]) sz=1024 ;;
|
||||
+ esac
|
||||
+
|
||||
+ case "$1" in
|
||||
+ *[mM]) sz=1024 ;;
|
||||
+ *[gG]) sz=$(( 1024 * 1024 )) ;;
|
||||
+ *[tT]) sz=$(( 1024 * 1024 * 1024 )) ;;
|
||||
+ *[pP]) sz=$(( 1024 * 1024 * 1024 * 1024 )) ;;
|
||||
+ esac
|
||||
+
|
||||
+ echo $(( sz * ${1%[kKmMgGtTpP]} ))
|
||||
+}
|
||||
+
|
||||
+#
|
||||
+# Emulate functionality of deprecated 'vdo create'
|
||||
+#
|
||||
+vdo_create_() {
|
||||
+local cachesize=
|
||||
+local devsize=
|
||||
+local emulate512=disabled
|
||||
+local logicalsize=
|
||||
+local maxdiscardsize=
|
||||
+local slabbits=0 # 4k
|
||||
+local slabsize=
|
||||
+local sparse=
|
||||
+local table=
|
||||
+local vdo_compression_msg=
|
||||
+local vdo_dry=
|
||||
+local vdo_index_msg=
|
||||
+local vdo_logicalBlockSize=
|
||||
+local vdo_verbose=
|
||||
+
|
||||
+local vdo_ackThreads=${vdo_ackThreads-1}
|
||||
+local vdo_bioRotationInterval=${vdo_bioRotationInterval-64}
|
||||
+local vdo_bioThreads=${vdo_bioThreads-4}
|
||||
+local vdo_blockMapCacheSize=${vdo_blockMapCacheSize-128M}
|
||||
+local vdo_blockMapPeriod=${vdo_blockMapPeriod-16380}
|
||||
+local vdo_compression=${vdo_compression-enabled}
|
||||
+local vdo_confFile=$LVM_VDO_DEFAULT_CONF # place some file in /tmp
|
||||
+local vdo_cpuThreads=${vdo_cpuThreads-2}
|
||||
+local vdo_deduplication=${vdo_deduplication-enabled}
|
||||
+local vdo_hashZoneThreads=${vdo_hashZoneThreads-1}
|
||||
+local vdo_indexCfreq=${vdo_indexCfreq-0}
|
||||
+local vdo_indexMemory=${vdo_indexMemory-0.25}
|
||||
+local vdo_indexSparse=${vdo_indexSparse-disabled}
|
||||
+local vdo_indexThreads=${vdo_indexThreads-0}
|
||||
+local vdo_logicalSize=${vdo_logicalSize-0}
|
||||
+local vdo_logicalThreads=${vdo_logicalThreads-1}
|
||||
+local vdo_maxDiscardSize=${vdo_maxDiscardSize-4K}
|
||||
+local vdo_name=${vdo_name-VDONAME}
|
||||
+local vdo_physicalThreads=${vdo_physicalThreads-1}
|
||||
+local vdo_slabSize=${vdo_slabSize-2G}
|
||||
+local vdo_uuid="VDO-$(uuidgen || echo \"f7a3ecdc-40a0-4e43-814c-4a7039a75de4\")"
|
||||
+local vdo_writePolicy=${vdo_writePolicy-auto}
|
||||
+
|
||||
+while [ "$#" -ne 0 ]
|
||||
+do
|
||||
+ case "$1" in
|
||||
+ "--blockMapCacheSize") shift; vdo_blockMapCacheSize=$1 ;;
|
||||
+ "--blockMapPeriod") shift; vdo_blockMapPeriod=$1 ;;
|
||||
+ "--compression") shift; vdo_compression=$1 ;;
|
||||
+ "--confFile"|"-f") shift; vdo_confFile=$1 ;;
|
||||
+ "--deduplication") shift; vdo_deduplication=$1 ;;
|
||||
+ "--device") shift; vdo_device=$1 ;;
|
||||
+ "--emulate512") shift; emulate512=$1 ;;
|
||||
+ "--indexMem") shift; vdo_indexMemory=$1 ;;
|
||||
+ "--maxDiscardSize") shift; vdo_maxDiscardSize=$1 ;;
|
||||
+ "--name"|"-n") shift; vdo_name=$1 ;;
|
||||
+ "--sparseIndex") shift; vdo_indexSparse=$1 ;;
|
||||
+ "--uuid") shift ;; # ignored
|
||||
+ "--vdoAckThreads") shift; vdo_ackThreads=$1 ;;
|
||||
+ "--vdoBioRotationInterval") shift; vdo_bioRotationInterval=$1 ;;
|
||||
+ "--vdoBioThreads") shift; vdo_bioThreads=$1 ;;
|
||||
+ "--vdoCpuThreads") shift; vdo_cpuThreads=$1 ;;
|
||||
+ "--vdoHashZoneThreads") shift; vdo_hashZoneThreads=$1 ;;
|
||||
+ "--vdoLogicalSize") shift; vdo_logicalSize=$1 ;;
|
||||
+ "--vdoLogicalThreads") shift; vdo_logicalThreads=$1 ;;
|
||||
+ "--vdoLogLevel") shift ;; # ignored
|
||||
+ "--vdoPhysicalThreads") shift; vdo_physicalSize=$1 ;;
|
||||
+ "--vdoSlabSize") shift; vdo_slabSize=$1 ;;
|
||||
+ "--verbose"|"-d"|"--debug") vdo_verbose="-v" ;;
|
||||
+ "--writePolicy") shift; vdo_writePolicy=$1 ;;
|
||||
+ esac
|
||||
+ shift
|
||||
+done
|
||||
+
|
||||
+# Convert when set
|
||||
+case "$emulate512" in
|
||||
+ "enabled") vdo_logicalBlockSize=512 ;;
|
||||
+ "disabled") vdo_logicalBlockSize=4096 ;;
|
||||
+ *) vdo_die_ "Invalid emulate512 setting."
|
||||
+esac
|
||||
+
|
||||
+case "$vdo_deduplication" in
|
||||
+ "enabled") vdo_index_msg="index-enable" ;;
|
||||
+ "disabled") vdo_index_msg="index-disable";;
|
||||
+ *) vdo_die_ "Invalid deduplication setting."
|
||||
+esac
|
||||
+
|
||||
+case "$vdo_compression" in
|
||||
+ "enabled") vdo_compression_msg="compression on" ;;
|
||||
+ "disabled") vdo_compression_msg="compression off";;
|
||||
+ *) vdo_die_ "Invalid compression setting."
|
||||
+esac
|
||||
+
|
||||
+test -n "${vdo_device-}" || vdo_die_ "VDO device is missing"
|
||||
+
|
||||
+blkid -s UUID -o value "${vdo_device}" || true
|
||||
+
|
||||
+devsize=$(blockdev --getsize64 "$vdo_device")
|
||||
+devsize=$(( devsize / 4096 )) # convert to 4KiB units
|
||||
+
|
||||
+logicalsize=$(vdo_get_kb_size_with_unit_ "$vdo_logicalSize" M)
|
||||
+logicalsize=$(( logicalsize * 2 )) # 512B units
|
||||
+
|
||||
+cachesize=$(vdo_get_kb_size_with_unit_ "$vdo_blockMapCacheSize" M)
|
||||
+cachesize=$(( cachesize / 4 )) # 4KiB units
|
||||
+
|
||||
+maxdiscardsize=$(vdo_get_kb_size_with_unit_ "$vdo_maxDiscardSize" M)
|
||||
+maxdiscardsize=$(( maxdiscardsize / 4 )) # 4KiB units
|
||||
+
|
||||
+test -e "$vdo_confFile" || {
|
||||
+ cat > "$vdo_confFile" <<EOF
|
||||
+####################################################################
|
||||
+# THIS FILE IS MACHINE GENERATED. DO NOT EDIT THIS FILE BY HAND.
|
||||
+####################################################################
|
||||
+config: !Configuration
|
||||
+ vdos:
|
||||
+EOF
|
||||
+}
|
||||
+
|
||||
+cat >> "$vdo_confFile" <<EOF
|
||||
+ $vdo_name: !VDOService
|
||||
+ _operationState: finished
|
||||
+ ackThreads: $vdo_ackThreads
|
||||
+ activated: enabled
|
||||
+ bioRotationInterval: $vdo_bioRotationInterval
|
||||
+ bioThreads: $vdo_bioThreads
|
||||
+ blockMapCacheSize: $(( cachesize * 4 ))K
|
||||
+ blockMapPeriod: $vdo_blockMapPeriod
|
||||
+ compression: $vdo_compression
|
||||
+ cpuThreads: $vdo_cpuThreads
|
||||
+ deduplication: $vdo_deduplication
|
||||
+ device: $vdo_device
|
||||
+ hashZoneThreads: $vdo_hashZoneThreads
|
||||
+ indexCfreq: $vdo_indexCfreq
|
||||
+ indexMemory: $vdo_indexMemory
|
||||
+ indexSparse: $vdo_indexSparse
|
||||
+ indexThreads: $vdo_indexThreads
|
||||
+ logicalBlockSize: $vdo_logicalBlockSize
|
||||
+ logicalSize: $(( logicalsize / 2 ))K
|
||||
+ logicalThreads: $vdo_logicalThreads
|
||||
+ maxDiscardSize: $(( maxdiscardsize * 4 ))K
|
||||
+ name: $vdo_name
|
||||
+ physicalSize: $(( devsize * 4 ))K
|
||||
+ physicalThreads: $vdo_physicalThreads
|
||||
+ slabSize: $vdo_slabSize
|
||||
+ uuid: $vdo_uuid
|
||||
+ writePolicy: $vdo_writePolicy
|
||||
+ version: 538380551
|
||||
+EOF
|
||||
+
|
||||
+slabsize=$(vdo_get_kb_size_with_unit_ "$vdo_slabSize")
|
||||
+while test "$slabsize" -gt 4 ; do
|
||||
+ slabbits=$(( slabbits + 1 ))
|
||||
+ slabsize=$(( slabsize / 2 ))
|
||||
+done
|
||||
+
|
||||
+case "$vdo_indexSparse" in
|
||||
+ "enabled") sparse="--uds-sparse" ;;
|
||||
+esac
|
||||
+
|
||||
+vdo_dry_ "$LVM_VDO_FORMAT" $vdo_verbose $sparse\
|
||||
+ --logical-size "$vdo_logicalSize" --slab-bits "$slabbits"\
|
||||
+ --uds-checkpoint-frequency "$vdo_indexCfreq"\
|
||||
+ --uds-memory-size "$vdo_indexMemory" "$vdo_device"
|
||||
+
|
||||
+# V2 format
|
||||
+table="0 $logicalsize vdo V2 $vdo_device\
|
||||
+ $devsize\
|
||||
+ $vdo_logicalBlockSize\
|
||||
+ $cachesize\
|
||||
+ $vdo_blockMapPeriod\
|
||||
+ on\
|
||||
+ $vdo_writePolicy\
|
||||
+ $vdo_name\
|
||||
+ maxDiscard $maxdiscardsize\
|
||||
+ ack $vdo_ackThreads\
|
||||
+ bio $vdo_bioThreads\
|
||||
+ bioRotationInterval $vdo_bioRotationInterval\
|
||||
+ cpu $vdo_cpuThreads\
|
||||
+ hash $vdo_hashZoneThreads\
|
||||
+ logical $vdo_logicalThreads\
|
||||
+ physical $vdo_physicalThreads"
|
||||
+
|
||||
+vdo_dry_ dmsetup create "$vdo_name" --uuid "$vdo_uuid" --table "$table"
|
||||
+vdo_dry_ dmsetup message "$vdo_name" 0 "$vdo_index_msg"
|
||||
+vdo_dry_ dmsetup message "$vdo_name" 0 "$vdo_compression_msg"
|
||||
+}
|
||||
+
|
||||
+#
|
||||
+# vdo stop
|
||||
+#
|
||||
+vdo_stop_() {
|
||||
+local vdo_confFile=$LVM_VDO_DEFAULT_CONF
|
||||
+local vdo_dry=
|
||||
+local vdo_force=
|
||||
+local vdo_name=
|
||||
+local vdo_verbose=
|
||||
+
|
||||
+while [ "$#" -ne 0 ]
|
||||
+do
|
||||
+ case "$1" in
|
||||
+ "--confFile"|"-f") shift; vdo_confFile=$1 ;;
|
||||
+ "--name"|"-n") shift; vdo_name=$1 ;;
|
||||
+ "--verbose"|"-d"|"--debug") vdo_verbose="-v" ;;
|
||||
+ "--force") vdo_force="--force" ;;
|
||||
+ esac
|
||||
+ shift
|
||||
+done
|
||||
+
|
||||
+vdo_dry_ dmsetup status --target vdo "$vdo_name" 2>/dev/null || return 0
|
||||
+vdo_dry_ dmsetup remove $vdo_force "$vdo_name" || true
|
||||
+}
|
||||
+
|
||||
+#
|
||||
+# vdo remove
|
||||
+#
|
||||
+vdo_remove_() {
|
||||
+local vdo_confFile=$LVM_VDO_DEFAULT_CONF
|
||||
+local vdo_name=
|
||||
+
|
||||
+vdo_stop_ "$@"
|
||||
+while [ "$#" -ne 0 ]
|
||||
+do
|
||||
+ case "$1" in
|
||||
+ "--confFile"|"-f") shift; vdo_confFile=$1 ;;
|
||||
+ "--name"|"-n") shift; vdo_name=$1 ;;
|
||||
+ esac
|
||||
+ shift
|
||||
+done
|
||||
+
|
||||
+# remove entry from conf file
|
||||
+awk -v vdovolname="$vdo_name" 'BEGIN { have=0 }
|
||||
+ $0 ~ "!VDOService" { have=0 }
|
||||
+ $0 ~ vdovolname":" { have=1 }
|
||||
+ { if (have==0) { print } ;}
|
||||
+ ' "$vdo_confFile" >"${vdo_confFile}.new"
|
||||
+
|
||||
+mv "${vdo_confFile}.new" "$vdo_confFile"
|
||||
+grep "!VDOService" "$vdo_confFile" || rm -f "$vdo_confFile"
|
||||
+}
|
||||
+
|
||||
+
|
||||
+#
|
||||
+# print_config_file
|
||||
+#
|
||||
+vdo_print_config_file_() {
|
||||
+local vdo_confFile=$LVM_VDO_DEFAULT_CONF
|
||||
+
|
||||
+while [ "$#" -ne 0 ]
|
||||
+do
|
||||
+ case "$1" in
|
||||
+ "--confFile"|"-f") shift; vdo_confFile=$1 ;;
|
||||
+ "--verbose"|"-d"|"--debug") ;;
|
||||
+ "--logfile") shift ;; # ignore
|
||||
+ esac
|
||||
+ shift
|
||||
+done
|
||||
+
|
||||
+cat "$vdo_confFile"
|
||||
+}
|
||||
+
|
||||
+#
|
||||
+# vdo convert
|
||||
+#
|
||||
+vdo_convert_() {
|
||||
+local vdo_confFile=$LVM_VDO_DEFAULT_CONF
|
||||
+local vdo_dry=
|
||||
+local vdo_force=
|
||||
+local vdo_name=
|
||||
+local vdo_verbose=
|
||||
+local vdo_device=
|
||||
+
|
||||
+while [ "$#" -ne 0 ]
|
||||
+do
|
||||
+ case "$1" in
|
||||
+ "--confFile"|"-f") shift; vdo_confFile=$1 ;;
|
||||
+ "--name"|"-n") shift; vdo_name=$1 ;;
|
||||
+ "--verbose"|"-d"|"--debug") vdo_verbose="-v" ;;
|
||||
+ "--force") vdo_force="--force" ;;
|
||||
+ esac
|
||||
+ shift
|
||||
+done
|
||||
+
|
||||
+vdo_device=$(awk -v vdovolname="$vdo_name" 'BEGIN { have=0 }
|
||||
+ $0 ~ "!VDOService" { have=0 }
|
||||
+ $0 ~ vdovolname":" { have=1 }
|
||||
+ { if (have==1 && $0 ~ "device:" ) { print $2 } ;}'\
|
||||
+ "$vdo_confFile")
|
||||
+
|
||||
+#dmsetup status --target vdo "$vdo_name" || true
|
||||
+vdo_dry_ "$LVM_VDO_PREPARE" "$vdo_device"
|
||||
+vdo_dry_ vdo_remove_ -f "$vdo_confFile" -n "$vdo_name" || true
|
||||
+}
|
||||
+
|
||||
+#
|
||||
+# MAIN
|
||||
+#
|
||||
+case "$1" in
|
||||
+ "create") shift; vdo_create_ "$@" ;;
|
||||
+ "remove") shift; vdo_remove_ "$@" ;;
|
||||
+ "stop") shift; vdo_stop_ "$@" ;;
|
||||
+ "convert") shift; vdo_convert_ "$@" ;;
|
||||
+ "printConfigFile") shift; vdo_print_config_file_ "$@" ;;
|
||||
+esac
|
||||
--
|
||||
2.41.0
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
From 64a78a2904c0481de8c1f9894cedcbd5f6525287 Mon Sep 17 00:00:00 2001
|
||||
From: Zdenek Kabelac <zkabelac@redhat.com>
|
||||
Date: Tue, 7 Jun 2022 16:52:30 +0200
|
||||
Subject: [PATCH 072/115] tests: update for wrapper
|
||||
|
||||
Update calling vdo manager since our vdo wrapper has a simple shell
|
||||
arg parser so it needs args without '='
|
||||
|
||||
Also correct using DM_DEV_DIR for 'pvcreate'
|
||||
|
||||
(cherry picked from commit 4a498512077b4fe5cf6b806a91228bd23e513123)
|
||||
---
|
||||
test/shell/vdo-convert.sh | 13 +++++++------
|
||||
1 file changed, 7 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/test/shell/vdo-convert.sh b/test/shell/vdo-convert.sh
|
||||
index 2a2026c2e..8b03344a7 100644
|
||||
--- a/test/shell/vdo-convert.sh
|
||||
+++ b/test/shell/vdo-convert.sh
|
||||
@@ -54,7 +54,7 @@ vgcreate $vg "$dev1"
|
||||
|
||||
lvcreate -L5G -n $lv1 $vg
|
||||
|
||||
-vdo create $VDOCONF --name "$VDONAME" --device="$DM_DEV_DIR/$vg/$lv1" --vdoLogicalSize=10G
|
||||
+vdo create $VDOCONF --name "$VDONAME" --device "$DM_DEV_DIR/$vg/$lv1" --vdoSlabSize 128M --vdoLogicalSize 10G
|
||||
|
||||
mkfs -E nodiscard "$DM_DEV_DIR/mapper/$VDONAME"
|
||||
|
||||
@@ -75,7 +75,7 @@ lvremove -f $vg
|
||||
# Test user can specify different VDO LV name (so the original LV is renamed)
|
||||
lvcreate -y -L5G -n $lv1 $vg
|
||||
|
||||
-vdo create $VDOCONF --name "$VDONAME" --device="$DM_DEV_DIR/$vg/$lv1" --vdoLogicalSize=10G
|
||||
+vdo create $VDOCONF --name "$VDONAME" --device "$DM_DEV_DIR/$vg/$lv1" --vdoSlabSize 128M --vdoLogicalSize 10G
|
||||
|
||||
lvm_import_vdo -y --name $vg/$lv2 "$DM_DEV_DIR/$vg/$lv1"
|
||||
|
||||
@@ -95,7 +95,7 @@ vgcreate $vg2 "$dev2"
|
||||
#
|
||||
# Check conversion of VDO volume on non-LV device and with >2T size
|
||||
#
|
||||
-vdo create $VDOCONF --name "$VDONAME" --device="$dev1" --vdoLogicalSize=3T
|
||||
+vdo create $VDOCONF --name "$VDONAME" --device "$dev1" --vdoSlabSize 128M --vdoLogicalSize 3T
|
||||
|
||||
# Fail with an already existing volume group $vg2
|
||||
not lvm_import_vdo --dry-run -y -v --name $vg2/$lv1 "$dev1" |& tee err
|
||||
@@ -117,7 +117,7 @@ vgremove -f $vg
|
||||
aux teardown_devs
|
||||
aux prepare_devs 1 23456
|
||||
|
||||
-vdo create $VDOCONF --name "$VDONAME" --device="$dev1" --vdoLogicalSize=23G
|
||||
+vdo create $VDOCONF --name "$VDONAME" --device "$dev1" --vdoSlabSize 128M --vdoLogicalSize 23G
|
||||
|
||||
mkfs -E nodiscard "$DM_DEV_DIR/mapper/$VDONAME"
|
||||
|
||||
@@ -137,6 +137,7 @@ aux prepare_loop 60000 || skip
|
||||
|
||||
test -f LOOP
|
||||
LOOP=$(< LOOP)
|
||||
+LOOP="${DM_DEV_DIR}/${LOOP##/dev/}"
|
||||
|
||||
aux extend_filter "a|$LOOP|"
|
||||
aux extend_devices "$LOOP"
|
||||
@@ -155,7 +156,7 @@ aux extend_devices "$LOOP"
|
||||
#
|
||||
# automate...
|
||||
#
|
||||
-vdo create $VDOCONF --name "$VDONAME" --device="$LOOP" --vdoLogicalSize=23G \
|
||||
+vdo create $VDOCONF --name "$VDONAME" --device "$LOOP" --vdoSlabSize 128M --vdoLogicalSize 23G\
|
||||
--blockMapCacheSize 192 \
|
||||
--blockMapPeriod 2048 \
|
||||
--emulate512 disabled \
|
||||
@@ -173,7 +174,7 @@ vdo create $VDOCONF --name "$VDONAME" --device="$LOOP" --vdoLogicalSize=23G \
|
||||
# Get VDO table line
|
||||
dmsetup table "$VDONAME" | tr " " "\n" | sed -e '5,6d' -e '12d' | tee vdo-orig
|
||||
|
||||
-DM_DEV_DIR="" lvm_import_vdo -y --name $vg/$lv "$LOOP"
|
||||
+lvm_import_vdo -y --name $vg/$lv "$LOOP"
|
||||
lvs -a $vg
|
||||
|
||||
dmsetup table "$vg-${lv}_vpool-vpool" | tr " " "\n" | sed -e '5,6d' -e '12d' | tee new-vdo-lv
|
||||
--
|
||||
2.41.0
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
From 8702e97022753c9f21c85af6deecea76b179911d Mon Sep 17 00:00:00 2001
|
||||
From: Tony Asleson <tasleson@redhat.com>
|
||||
Date: Wed, 25 May 2022 16:03:27 -0500
|
||||
Subject: [PATCH 073/115] lvmdbusd: Change unit test vdo minimum size
|
||||
|
||||
(cherry picked from commit 47c61907b4adbdead50f5bb5ac95c0f5d0fe263e)
|
||||
---
|
||||
test/dbus/lvmdbustest.py | 14 +++++++++-----
|
||||
1 file changed, 9 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/test/dbus/lvmdbustest.py b/test/dbus/lvmdbustest.py
|
||||
index 6d692223f..3eef77fd7 100755
|
||||
--- a/test/dbus/lvmdbustest.py
|
||||
+++ b/test/dbus/lvmdbustest.py
|
||||
@@ -23,6 +23,9 @@ import os
|
||||
|
||||
g_tmo = 0
|
||||
|
||||
+# Approx. min size
|
||||
+VDO_MIN_SIZE = mib(8192)
|
||||
+
|
||||
# Prefix on created objects to enable easier clean-up
|
||||
g_prefix = os.getenv('PREFIX', '')
|
||||
|
||||
@@ -1155,7 +1158,7 @@ class TestDbusService(unittest.TestCase):
|
||||
return
|
||||
|
||||
# This may not pass
|
||||
- for i in [48, 64, 128]:
|
||||
+ for i in [64, 128]:
|
||||
yes = self._test_expired_timer(i)
|
||||
if yes:
|
||||
break
|
||||
@@ -1907,8 +1910,8 @@ class TestDbusService(unittest.TestCase):
|
||||
vdo_pool_object_path = self.handle_return(
|
||||
vg_proxy.VgVdo.CreateVdoPoolandLv(
|
||||
pool_name, lv_name,
|
||||
- dbus.UInt64(mib(4096)), # Appears to be minimum size
|
||||
- dbus.UInt64(mib(8192)),
|
||||
+ dbus.UInt64(VDO_MIN_SIZE),
|
||||
+ dbus.UInt64(VDO_MIN_SIZE * 2),
|
||||
dbus.Int32(g_tmo),
|
||||
EOD))
|
||||
|
||||
@@ -1950,7 +1953,7 @@ class TestDbusService(unittest.TestCase):
|
||||
vg_proxy = self._vg_create(vg_prefix="vdo_conv_")
|
||||
lv = self._test_lv_create(
|
||||
vg_proxy.Vg.LvCreate,
|
||||
- (dbus.String(pool_name), dbus.UInt64(mib(4096)),
|
||||
+ (dbus.String(pool_name), dbus.UInt64(VDO_MIN_SIZE),
|
||||
dbus.Array([], signature='(ott)'), dbus.Int32(g_tmo),
|
||||
EOD), vg_proxy.Vg, LV_BASE_INT)
|
||||
lv_obj_path = self._lookup("%s/%s" % (vg_proxy.Vg.Name, pool_name))
|
||||
@@ -1959,7 +1962,7 @@ class TestDbusService(unittest.TestCase):
|
||||
vdo_pool_path = self.handle_return(
|
||||
vg_proxy.VgVdo.CreateVdoPool(
|
||||
dbus.ObjectPath(lv.object_path), lv_name,
|
||||
- dbus.UInt64(mib(8192)),
|
||||
+ dbus.UInt64(VDO_MIN_SIZE),
|
||||
dbus.Int32(g_tmo),
|
||||
EOD))
|
||||
|
||||
@@ -2083,6 +2086,7 @@ if __name__ == '__main__':
|
||||
std_err_print('\n*** Testing only lvm shell mode ***\n')
|
||||
|
||||
for g_tmo in [0, 15]:
|
||||
+ std_err_print('Testing TMO=%d\n' % g_tmo)
|
||||
if mode == 0:
|
||||
if set_execution(False, r):
|
||||
r.register_result(unittest.main(exit=False))
|
||||
--
|
||||
2.41.0
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
From e82e23447f830bd6c38bbefa600212e84cdb0f27 Mon Sep 17 00:00:00 2001
|
||||
From: Zdenek Kabelac <zkabelac@redhat.com>
|
||||
Date: Mon, 11 Jul 2022 01:07:24 +0200
|
||||
Subject: [PATCH 074/115] vdo: fix conversion of vdo_slab_size_mb 2nd
|
||||
|
||||
Patch 1b070f366ba57a6eb24df03241284732db5047e9 should have
|
||||
been already fixing this issue but since it the incorrect
|
||||
patch rebasing the change to vdo_slabSize got lost.
|
||||
So again now with explicit one-line patch.
|
||||
|
||||
(cherry picked from commit d2667bc25bccaf0f70cc2ded0fd3f25a79cb4f6c)
|
||||
---
|
||||
scripts/lvm_import_vdo.sh | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/scripts/lvm_import_vdo.sh b/scripts/lvm_import_vdo.sh
|
||||
index c10b3b050..c4c1d152e 100755
|
||||
--- a/scripts/lvm_import_vdo.sh
|
||||
+++ b/scripts/lvm_import_vdo.sh
|
||||
@@ -324,7 +324,7 @@ allocation {
|
||||
vdo_check_point_frequency = $vdo_indexCfreq
|
||||
vdo_use_sparse_index = $(get_enabled_value_ "$vdo_indexSparse")
|
||||
vdo_index_memory_size_mb = $(awk "BEGIN {print $vdo_indexMemory * 1024}")
|
||||
- vdo_slab_size_mb = $(( $(get_kb_size_with_unit_ "$vdo_blockMapCacheSize") / 1024 ))
|
||||
+ vdo_slab_size_mb = $(( $(get_kb_size_with_unit_ "$vdo_slabSize") / 1024 ))
|
||||
vdo_ack_threads = $vdo_ackThreads
|
||||
vdo_bio_threads = $vdo_bioThreads
|
||||
vdo_bio_rotation = $vdo_bioRotationInterval
|
||||
--
|
||||
2.41.0
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
From 1a39e0c2c24c7c505753658f9a74bf962fdf013b Mon Sep 17 00:00:00 2001
|
||||
From: Zdenek Kabelac <zkabelac@redhat.com>
|
||||
Date: Mon, 4 Jul 2022 15:00:26 +0200
|
||||
Subject: [PATCH 075/115] vdo: update info about memory
|
||||
|
||||
Add more info about kernel target memory allocation associated with
|
||||
VDO pool usage.
|
||||
|
||||
(cherry picked from commit f445624c339a5c1436a47d2b51046869f183eb03)
|
||||
---
|
||||
man/lvmvdo.7_main | 15 ++++++++++++---
|
||||
1 file changed, 12 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/man/lvmvdo.7_main b/man/lvmvdo.7_main
|
||||
index 14bd640b5..8c3e3eeaa 100644
|
||||
--- a/man/lvmvdo.7_main
|
||||
+++ b/man/lvmvdo.7_main
|
||||
@@ -12,7 +12,7 @@ for primary storage.
|
||||
.P
|
||||
Deduplication is a technique for reducing the consumption of storage
|
||||
resources by eliminating multiple copies of duplicate blocks. Compression
|
||||
-takes the individual unique blocks and shrinks them.
|
||||
+takes the individual unique blocks and shrinks them.
|
||||
These reduced blocks are then efficiently packed together into
|
||||
physical blocks. Thin provisioning manages the mapping from logical blocks
|
||||
presented by VDO to where the data has actually been physically stored,
|
||||
@@ -358,8 +358,17 @@ take otherwise as device is already expected to be empty.
|
||||
.
|
||||
.SS \n+[step]. Memory usage
|
||||
.
|
||||
-The VDO target requires 370 MiB of RAM plus an additional 268 MiB
|
||||
-per each 1 TiB of physical storage managed by the volume.
|
||||
+The VDO target requires 38 MiB of RAM and several variable amounts:
|
||||
+.IP \(bu 2
|
||||
+1.15 MiB of RAM for each 1 MiB of configured block map cache size.
|
||||
+The block map cache requires a minimum of 150 MiB RAM.
|
||||
+.br
|
||||
+.IP \(bu
|
||||
+1.6 MiB of RAM for each 1 TiB of logical space.
|
||||
+.br
|
||||
+.IP \(bu
|
||||
+268 MiB of RAM for each 1 TiB of physical storage managed by the volume.
|
||||
+.br
|
||||
.P
|
||||
UDS requires a minimum of 250 MiB of RAM,
|
||||
which is also the default amount that deduplication uses.
|
||||
--
|
||||
2.41.0
|
||||
|
|
@ -1,246 +0,0 @@
|
|||
From 783213e4da16a70f5e3d5efae2d409b92d899fc9 Mon Sep 17 00:00:00 2001
|
||||
From: Zdenek Kabelac <zkabelac@redhat.com>
|
||||
Date: Fri, 8 Jul 2022 23:33:29 +0200
|
||||
Subject: [PATCH 076/115] vdo: check vdo memory constrains
|
||||
|
||||
Add function to check for avaialble memory for particular VDO
|
||||
configuration - to avoid unnecessary machine swapping for configs
|
||||
that will not fit into memory (possibly in locked section).
|
||||
|
||||
Formula tries to estimate RAM size machine can use also with
|
||||
swapping for kernel target - but still leaving some amount of
|
||||
usable RAM.
|
||||
|
||||
Estimation is based on documented RAM usage of VDO target.
|
||||
|
||||
If the /proc/meminfo would be theoretically unavailable, try to use
|
||||
'sysinfo()' function, however this is giving only free RAM without
|
||||
the knowledge about how much RAM could be eventually swapped.
|
||||
|
||||
TODO: move _get_memory_info() into generic lvm2 API function used
|
||||
by other targets with non-trivial memory requirements.
|
||||
|
||||
(cherry picked from commit ebad057579aeff0980a1b8af7eaacd56e62ed0c9)
|
||||
---
|
||||
lib/metadata/metadata-exported.h | 2 +
|
||||
lib/metadata/vdo_manip.c | 144 +++++++++++++++++++++++++++++++
|
||||
lib/vdo/vdo.c | 8 +-
|
||||
tools/lvcreate.c | 4 +
|
||||
4 files changed, 156 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
|
||||
index 7bac5b900..449c8d014 100644
|
||||
--- a/lib/metadata/metadata-exported.h
|
||||
+++ b/lib/metadata/metadata-exported.h
|
||||
@@ -1377,6 +1377,8 @@ int fill_vdo_target_params(struct cmd_context *cmd,
|
||||
struct dm_vdo_target_params *vtp,
|
||||
uint64_t *vdo_pool_header_size,
|
||||
struct profile *profile);
|
||||
+int check_vdo_constrains(struct cmd_context *cmd, uint64_t physical_size,
|
||||
+ uint64_t virtual_size, struct dm_vdo_target_params *vtp);
|
||||
/* -- metadata/vdo_manip.c */
|
||||
|
||||
struct logical_volume *find_pvmove_lv(struct volume_group *vg,
|
||||
diff --git a/lib/metadata/vdo_manip.c b/lib/metadata/vdo_manip.c
|
||||
index 11a119a68..9f449ef8b 100644
|
||||
--- a/lib/metadata/vdo_manip.c
|
||||
+++ b/lib/metadata/vdo_manip.c
|
||||
@@ -23,6 +23,8 @@
|
||||
#include "lib/config/defaults.h"
|
||||
#include "lib/misc/lvm-exec.h"
|
||||
|
||||
+#include <sys/sysinfo.h> // sysinfo
|
||||
+
|
||||
const char *get_vdo_compression_state_name(enum dm_vdo_compression_state state)
|
||||
{
|
||||
switch (state) {
|
||||
@@ -516,3 +518,145 @@ int fill_vdo_target_params(struct cmd_context *cmd,
|
||||
|
||||
return 1;
|
||||
}
|
||||
+
|
||||
+static int _get_sysinfo_memory(uint64_t *total_mb, uint64_t *available_mb)
|
||||
+{
|
||||
+ struct sysinfo si = { 0 };
|
||||
+
|
||||
+ *total_mb = *available_mb = UINT64_MAX;
|
||||
+
|
||||
+ if (sysinfo(&si) != 0)
|
||||
+ return 0;
|
||||
+
|
||||
+ log_debug("Sysinfo free:%lu bufferram:%lu sharedram:%lu freehigh:%lu unit:%u.",
|
||||
+ si.freeram >> 20, si.bufferram >> 20, si.sharedram >> 20,
|
||||
+ si.freehigh >> 20, si.mem_unit);
|
||||
+
|
||||
+ *available_mb = ((uint64_t)(si.freeram + si.bufferram) * si.mem_unit) >> 30;
|
||||
+ *total_mb = si.totalram >> 30;
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+typedef struct mem_table_s {
|
||||
+ const char *name;
|
||||
+ uint64_t *value;
|
||||
+} mem_table_t;
|
||||
+
|
||||
+static int _compare_mem_table_s(const void *a, const void *b){
|
||||
+ return strcmp(((const mem_table_t*)a)->name, ((const mem_table_t*)b)->name);
|
||||
+}
|
||||
+
|
||||
+static int _get_memory_info(uint64_t *total_mb, uint64_t *available_mb)
|
||||
+{
|
||||
+ uint64_t anon_pages, mem_available, mem_free, mem_total, shmem, swap_free;
|
||||
+ uint64_t can_swap;
|
||||
+ mem_table_t mt[] = {
|
||||
+ { "AnonPages", &anon_pages },
|
||||
+ { "MemAvailable", &mem_available },
|
||||
+ { "MemFree", &mem_free },
|
||||
+ { "MemTotal", &mem_total },
|
||||
+ { "Shmem", &shmem },
|
||||
+ { "SwapFree", &swap_free },
|
||||
+ };
|
||||
+
|
||||
+ char line[128], namebuf[32], *e, *tail;
|
||||
+ FILE *fp;
|
||||
+ mem_table_t findme = { namebuf, NULL };
|
||||
+ mem_table_t *found;
|
||||
+
|
||||
+ if (!(fp = fopen("/proc/meminfo", "r")))
|
||||
+ return _get_sysinfo_memory(total_mb, available_mb);
|
||||
+
|
||||
+ while (fgets(line, sizeof(line), fp)) {
|
||||
+ if (!(e = strchr(line, ':')))
|
||||
+ break;
|
||||
+
|
||||
+ if ((++e - line) > sizeof(namebuf))
|
||||
+ continue; // something too long
|
||||
+
|
||||
+ (void)dm_strncpy((char*)findme.name, line, e - line);
|
||||
+
|
||||
+ found = bsearch(&findme, mt, DM_ARRAY_SIZE(mt), sizeof(mem_table_t),
|
||||
+ _compare_mem_table_s);
|
||||
+ if (!found)
|
||||
+ continue; // not interesting
|
||||
+
|
||||
+ *(found->value) = (uint64_t) strtoull(e, &tail, 10);
|
||||
+
|
||||
+ if ((e == tail) || errno)
|
||||
+ log_debug("Failing to parse value from %s.", line);
|
||||
+ else
|
||||
+ log_debug("Parsed %s = " FMTu64 " KiB.", found->name, *(found->value));
|
||||
+ }
|
||||
+ (void)fclose(fp);
|
||||
+
|
||||
+ // use at most 2/3 of swap space to keep machine usable
|
||||
+ can_swap = (anon_pages + shmem) * 2 / 3;
|
||||
+ swap_free = swap_free * 2 / 3;
|
||||
+
|
||||
+ if (can_swap > swap_free)
|
||||
+ can_swap = swap_free;
|
||||
+
|
||||
+ // TODO: add more constrains, i.e. 3/4 of physical RAM...
|
||||
+
|
||||
+ *total_mb = mem_total >> 10;
|
||||
+ *available_mb = (mem_available + can_swap) >> 10;
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+static uint64_t _round_1024(uint64_t s)
|
||||
+{
|
||||
+ return (s + ((1 << 10) - 1)) >> 10;
|
||||
+}
|
||||
+
|
||||
+static uint64_t _round_sectors_to_tib(uint64_t s)
|
||||
+{
|
||||
+ return (s + ((UINT64_C(1) << (40 - SECTOR_SHIFT)) - 1)) >> (40 - SECTOR_SHIFT);
|
||||
+}
|
||||
+
|
||||
+int check_vdo_constrains(struct cmd_context *cmd, uint64_t physical_size,
|
||||
+ uint64_t virtual_size, struct dm_vdo_target_params *vtp)
|
||||
+{
|
||||
+ uint64_t req_mb, total_mb, available_mb;
|
||||
+ uint64_t phy_mb = _round_sectors_to_tib(UINT64_C(268) * physical_size); // 268 MiB per 1 TiB of physical size
|
||||
+ uint64_t virt_mb = _round_1024(UINT64_C(1638) * _round_sectors_to_tib(virtual_size)); // 1.6 MiB per 1 TiB
|
||||
+ uint64_t cache_mb = _round_1024(UINT64_C(1177) * vtp->block_map_cache_size_mb); // 1.15 MiB per 1 MiB cache size
|
||||
+ char msg[512];
|
||||
+
|
||||
+ if (cache_mb < 150)
|
||||
+ cache_mb = 150; // always at least 150 MiB for block map
|
||||
+
|
||||
+ // total required memory for VDO target
|
||||
+ req_mb = 38 + vtp->index_memory_size_mb + virt_mb + phy_mb + cache_mb;
|
||||
+
|
||||
+ _get_memory_info(&total_mb, &available_mb);
|
||||
+
|
||||
+ (void)snprintf(msg, sizeof(msg), "VDO configuration needs %s RAM for physical volume size %s, "
|
||||
+ "%s RAM for virtual volume size %s, %s RAM for block map cache size %s and "
|
||||
+ "%s RAM for index memory.",
|
||||
+ display_size(cmd, phy_mb << (20 - SECTOR_SHIFT)),
|
||||
+ display_size(cmd, physical_size),
|
||||
+ display_size(cmd, virt_mb << (20 - SECTOR_SHIFT)),
|
||||
+ display_size(cmd, virtual_size),
|
||||
+ display_size(cmd, cache_mb << (20 - SECTOR_SHIFT)),
|
||||
+ display_size(cmd, ((uint64_t)vtp->block_map_cache_size_mb) << (20 - SECTOR_SHIFT)),
|
||||
+ display_size(cmd, ((uint64_t)vtp->index_memory_size_mb) << (20 - SECTOR_SHIFT)));
|
||||
+
|
||||
+ if (req_mb > available_mb) {
|
||||
+ log_error("Not enough free memory for VDO target. %s RAM is required, but only %s RAM is available.",
|
||||
+ display_size(cmd, req_mb << (20 - SECTOR_SHIFT)),
|
||||
+ display_size(cmd, available_mb << (20 - SECTOR_SHIFT)));
|
||||
+ log_print_unless_silent("%s", msg);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ log_debug("VDO requires %s RAM, currently available %s RAM.",
|
||||
+ display_size(cmd, req_mb << (20 - SECTOR_SHIFT)),
|
||||
+ display_size(cmd, available_mb << (20 - SECTOR_SHIFT)));
|
||||
+
|
||||
+ log_verbose("%s", msg);
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
diff --git a/lib/vdo/vdo.c b/lib/vdo/vdo.c
|
||||
index 52e9443ea..b9bcc044f 100644
|
||||
--- a/lib/vdo/vdo.c
|
||||
+++ b/lib/vdo/vdo.c
|
||||
@@ -355,8 +355,8 @@ static int _vdo_pool_target_status_compatible(const char *type)
|
||||
}
|
||||
|
||||
static int _vdo_pool_add_target_line(struct dev_manager *dm,
|
||||
- struct dm_pool *mem __attribute__((unused)),
|
||||
- struct cmd_context *cmd __attribute__((unused)),
|
||||
+ struct dm_pool *mem,
|
||||
+ struct cmd_context *cmd,
|
||||
void **target_state __attribute__((unused)),
|
||||
struct lv_segment *seg,
|
||||
const struct lv_activate_opts *laopts __attribute__((unused)),
|
||||
@@ -369,6 +369,10 @@ static int _vdo_pool_add_target_line(struct dev_manager *dm,
|
||||
log_error(INTERNAL_ERROR "Passed segment is not VDO pool.");
|
||||
return 0;
|
||||
}
|
||||
+
|
||||
+ if (!check_vdo_constrains(cmd, seg->lv->size, seg_lv(seg, 0)->size, &seg->vdo_params))
|
||||
+ return_0;
|
||||
+
|
||||
if (!(vdo_pool_name = dm_build_dm_name(mem, seg->lv->vg->name, seg->lv->name, lv_layer(seg->lv))))
|
||||
return_0;
|
||||
|
||||
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
|
||||
index 8de6f3408..fb57d84bd 100644
|
||||
--- a/tools/lvcreate.c
|
||||
+++ b/tools/lvcreate.c
|
||||
@@ -1729,6 +1729,10 @@ static int _lvcreate_single(struct cmd_context *cmd, const char *vg_name,
|
||||
if (!_update_extents_params(vg, lp, lcp))
|
||||
goto_out;
|
||||
|
||||
+ if (seg_is_vdo(lp) && !check_vdo_constrains(cmd, (uint64_t)lp->extents * vg->extent_size,
|
||||
+ lcp->virtual_size, &lp->vdo_params))
|
||||
+ return_0;
|
||||
+
|
||||
if (seg_is_thin(lp) && !_validate_internal_thin_processing(lp))
|
||||
goto_out;
|
||||
|
||||
--
|
||||
2.41.0
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
From d2a2720ccb88d99c76423ebd5c3bb1f13dc60ab1 Mon Sep 17 00:00:00 2001
|
||||
From: Zdenek Kabelac <zkabelac@redhat.com>
|
||||
Date: Sat, 9 Jul 2022 00:42:01 +0200
|
||||
Subject: [PATCH 077/115] vdo: add reformating to extent size aligned virtual
|
||||
size
|
||||
|
||||
Newer VDO kernel target require to have matching virtual size - this
|
||||
however cause incompatiblity when lvcreate is let to format VDO data
|
||||
device and read the usable size from vdoformat.
|
||||
Altough this is a kernel regression and will likely get fixed,
|
||||
lvm2 can actually reformat VDO device to use properly aligned VDO LV
|
||||
size to make this problem disappear.
|
||||
|
||||
(cherry picked from commit a477490e812639fed3be495f215fcf1a7b65b7ee)
|
||||
---
|
||||
lib/metadata/vdo_manip.c | 22 +++++++++++++++++++---
|
||||
1 file changed, 19 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/lib/metadata/vdo_manip.c b/lib/metadata/vdo_manip.c
|
||||
index 9f449ef8b..f3a4a9534 100644
|
||||
--- a/lib/metadata/vdo_manip.c
|
||||
+++ b/lib/metadata/vdo_manip.c
|
||||
@@ -227,10 +227,11 @@ static int _format_vdo_pool_data_lv(struct logical_volume *data_lv,
|
||||
const struct dm_vdo_target_params *vtp,
|
||||
uint64_t *logical_size)
|
||||
{
|
||||
- char *dpath;
|
||||
+ char *dpath, *c;
|
||||
const struct dm_config_node *cn;
|
||||
const struct dm_config_value *cv;
|
||||
struct pipe_data pdata;
|
||||
+ uint64_t logical_size_aligned = 1;
|
||||
FILE *f;
|
||||
uint64_t lb;
|
||||
unsigned slabbits;
|
||||
@@ -247,7 +248,9 @@ static int _format_vdo_pool_data_lv(struct logical_volume *data_lv,
|
||||
return 0;
|
||||
}
|
||||
|
||||
+reformat:
|
||||
if (*logical_size) {
|
||||
+ logical_size_aligned = 0;
|
||||
if (dm_snprintf(buf_args[args], sizeof(buf_args[0]), "--logical-size=" FMTu64 "K",
|
||||
(*logical_size / 2)) < 0)
|
||||
return_0;
|
||||
@@ -332,8 +335,8 @@ static int _format_vdo_pool_data_lv(struct logical_volume *data_lv,
|
||||
log_verbose("Available VDO logical blocks " FMTu64 " (%s).",
|
||||
lb, display_size(data_lv->vg->cmd, *logical_size));
|
||||
}
|
||||
- if ((dpath = strchr(buf, '\n')))
|
||||
- *dpath = 0; /* cut last '\n' away */
|
||||
+ if ((c = strchr(buf, '\n')))
|
||||
+ *c = 0; /* cut last '\n' away */
|
||||
if (buf[0])
|
||||
log_print(" %s", buf); /* Print vdo_format messages */
|
||||
}
|
||||
@@ -348,6 +351,19 @@ static int _format_vdo_pool_data_lv(struct logical_volume *data_lv,
|
||||
return 0;
|
||||
}
|
||||
|
||||
+ if (logical_size_aligned) {
|
||||
+ // align obtained size to extent size
|
||||
+ logical_size_aligned = *logical_size / data_lv->vg->extent_size * data_lv->vg->extent_size;
|
||||
+ if (*logical_size != logical_size_aligned) {
|
||||
+ *logical_size = logical_size_aligned;
|
||||
+ argv[1] = (char*) "--force";
|
||||
+ args = 2;
|
||||
+ log_verbose("Reformating VDO to align virtual size %s by extent size.",
|
||||
+ display_size(data_lv->vg->cmd, *logical_size));
|
||||
+ goto reformat;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
return 1;
|
||||
}
|
||||
|
||||
--
|
||||
2.41.0
|
||||
|
|
@ -1,172 +0,0 @@
|
|||
From c160f54ec5cc26b78db38058f1a8bd63da9e225d Mon Sep 17 00:00:00 2001
|
||||
From: Zdenek Kabelac <zkabelac@redhat.com>
|
||||
Date: Fri, 8 Jul 2022 23:35:06 +0200
|
||||
Subject: [PATCH 078/115] vdo: support v4 kernel target line
|
||||
|
||||
Check and use new available table line v4, if kernel supports it.
|
||||
|
||||
(cherry picked from commit 1c18ed3b4ab2f2d5a15995b8f0a18d7d1c4d60ca)
|
||||
---
|
||||
device_mapper/all.h | 1 +
|
||||
device_mapper/libdm-deptree.c | 37 +++++++++++++++++++++++------------
|
||||
lib/metadata/segtype.h | 1 +
|
||||
lib/vdo/vdo.c | 10 ++++++++--
|
||||
test/shell/vdo-convert.sh | 2 ++
|
||||
5 files changed, 37 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/device_mapper/all.h b/device_mapper/all.h
|
||||
index 17f78d989..e45f5923a 100644
|
||||
--- a/device_mapper/all.h
|
||||
+++ b/device_mapper/all.h
|
||||
@@ -1020,6 +1020,7 @@ int dm_tree_node_add_integrity_target(struct dm_tree_node *node,
|
||||
*/
|
||||
int dm_tree_node_add_vdo_target(struct dm_tree_node *node,
|
||||
uint64_t size,
|
||||
+ uint32_t vdo_version,
|
||||
const char *vdo_pool_name,
|
||||
const char *data_uuid,
|
||||
uint64_t data_size,
|
||||
diff --git a/device_mapper/libdm-deptree.c b/device_mapper/libdm-deptree.c
|
||||
index e4bf4c814..2d382037c 100644
|
||||
--- a/device_mapper/libdm-deptree.c
|
||||
+++ b/device_mapper/libdm-deptree.c
|
||||
@@ -214,6 +214,7 @@ struct load_segment {
|
||||
uint32_t device_id; /* Thin */
|
||||
|
||||
// VDO params
|
||||
+ uint32_t vdo_version; /* VDO - version of target table line */
|
||||
struct dm_tree_node *vdo_data; /* VDO */
|
||||
struct dm_vdo_target_params vdo_params; /* VDO */
|
||||
const char *vdo_name; /* VDO - device name is ALSO passed as table arg */
|
||||
@@ -2865,18 +2866,28 @@ static int _vdo_emit_segment_line(struct dm_task *dmt,
|
||||
return 0;
|
||||
}
|
||||
|
||||
- EMIT_PARAMS(pos, "V2 %s " FMTu64 " %u " FMTu64 " %u %s %s %s "
|
||||
- "maxDiscard %u ack %u bio %u bioRotationInterval %u cpu %u hash %u logical %u physical %u",
|
||||
- data_dev,
|
||||
- seg->vdo_data_size / 8, // this parameter is in 4K units
|
||||
- seg->vdo_params.minimum_io_size * UINT32_C(512), // sector to byte units
|
||||
- seg->vdo_params.block_map_cache_size_mb * UINT64_C(256), // 1MiB -> 4KiB units
|
||||
- seg->vdo_params.block_map_era_length,
|
||||
- seg->vdo_params.use_metadata_hints ? "on" : "off" ,
|
||||
- (seg->vdo_params.write_policy == DM_VDO_WRITE_POLICY_SYNC) ? "sync" :
|
||||
- (seg->vdo_params.write_policy == DM_VDO_WRITE_POLICY_ASYNC) ? "async" :
|
||||
- (seg->vdo_params.write_policy == DM_VDO_WRITE_POLICY_ASYNC_UNSAFE) ? "async-unsafe" : "auto", // policy
|
||||
- seg->vdo_name,
|
||||
+ if (seg->vdo_version < 4) {
|
||||
+ EMIT_PARAMS(pos, "V2 %s " FMTu64 " %u " FMTu64 " %u %s %s %s ",
|
||||
+ data_dev,
|
||||
+ seg->vdo_data_size / 8, // this parameter is in 4K units
|
||||
+ seg->vdo_params.minimum_io_size * UINT32_C(512), // sector to byte units
|
||||
+ seg->vdo_params.block_map_cache_size_mb * UINT64_C(256), // 1MiB -> 4KiB units
|
||||
+ seg->vdo_params.block_map_era_length,
|
||||
+ seg->vdo_params.use_metadata_hints ? "on" : "off" ,
|
||||
+ (seg->vdo_params.write_policy == DM_VDO_WRITE_POLICY_SYNC) ? "sync" :
|
||||
+ (seg->vdo_params.write_policy == DM_VDO_WRITE_POLICY_ASYNC) ? "async" :
|
||||
+ (seg->vdo_params.write_policy == DM_VDO_WRITE_POLICY_ASYNC_UNSAFE) ? "async-unsafe" : "auto", // policy
|
||||
+ seg->vdo_name);
|
||||
+ } else {
|
||||
+ EMIT_PARAMS(pos, "V4 %s " FMTu64 " %u " FMTu64 " %u ",
|
||||
+ data_dev,
|
||||
+ seg->vdo_data_size / 8, // this parameter is in 4K units
|
||||
+ seg->vdo_params.minimum_io_size * UINT32_C(512), // sector to byte units
|
||||
+ seg->vdo_params.block_map_cache_size_mb * UINT64_C(256), // 1MiB -> 4KiB units
|
||||
+ seg->vdo_params.block_map_era_length);
|
||||
+ }
|
||||
+
|
||||
+ EMIT_PARAMS(pos, "maxDiscard %u ack %u bio %u bioRotationInterval %u cpu %u hash %u logical %u physical %u",
|
||||
seg->vdo_params.max_discard,
|
||||
seg->vdo_params.ack_threads,
|
||||
seg->vdo_params.bio_threads,
|
||||
@@ -4323,6 +4334,7 @@ void dm_tree_node_set_callback(struct dm_tree_node *dnode,
|
||||
|
||||
int dm_tree_node_add_vdo_target(struct dm_tree_node *node,
|
||||
uint64_t size,
|
||||
+ uint32_t vdo_version,
|
||||
const char *vdo_pool_name,
|
||||
const char *data_uuid,
|
||||
uint64_t data_size,
|
||||
@@ -4344,6 +4356,7 @@ int dm_tree_node_add_vdo_target(struct dm_tree_node *node,
|
||||
if (!_link_tree_nodes(node, seg->vdo_data))
|
||||
return_0;
|
||||
|
||||
+ seg->vdo_version = vdo_version;
|
||||
seg->vdo_params = *vtp;
|
||||
seg->vdo_name = vdo_pool_name;
|
||||
seg->vdo_data_size = data_size;
|
||||
diff --git a/lib/metadata/segtype.h b/lib/metadata/segtype.h
|
||||
index 2f4949267..3e52f04a1 100644
|
||||
--- a/lib/metadata/segtype.h
|
||||
+++ b/lib/metadata/segtype.h
|
||||
@@ -353,6 +353,7 @@ int init_vdo_segtypes(struct cmd_context *cmd, struct segtype_library *seglib);
|
||||
#endif
|
||||
|
||||
#define VDO_FEATURE_ONLINE_RENAME (1U << 0) /* version 6.2.3 */
|
||||
+#define VDO_FEATURE_VERSION4 (1U << 1) /* version 8.2.0 */
|
||||
|
||||
int init_writecache_segtypes(struct cmd_context *cmd, struct segtype_library *seglib);
|
||||
|
||||
diff --git a/lib/vdo/vdo.c b/lib/vdo/vdo.c
|
||||
index b9bcc044f..9efb424f0 100644
|
||||
--- a/lib/vdo/vdo.c
|
||||
+++ b/lib/vdo/vdo.c
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (C) 2018-2019 Red Hat, Inc. All rights reserved.
|
||||
+ * Copyright (C) 2018-2022 Red Hat, Inc. All rights reserved.
|
||||
*
|
||||
* This file is part of LVM2.
|
||||
*
|
||||
@@ -364,6 +364,10 @@ static int _vdo_pool_add_target_line(struct dev_manager *dm,
|
||||
uint32_t *pvmove_mirror_count __attribute__((unused)))
|
||||
{
|
||||
char *vdo_pool_name, *data_uuid;
|
||||
+ unsigned attrs = 0;
|
||||
+
|
||||
+ if (seg->segtype->ops->target_present)
|
||||
+ seg->segtype->ops->target_present(cmd, NULL, &attrs);
|
||||
|
||||
if (!seg_is_vdo_pool(seg)) {
|
||||
log_error(INTERNAL_ERROR "Passed segment is not VDO pool.");
|
||||
@@ -381,6 +385,7 @@ static int _vdo_pool_add_target_line(struct dev_manager *dm,
|
||||
|
||||
/* VDO uses virtual size instead of its physical size */
|
||||
if (!dm_tree_node_add_vdo_target(node, get_vdo_pool_virtual_size(seg),
|
||||
+ !(attrs & VDO_FEATURE_VERSION4) ? 2 : 4,
|
||||
vdo_pool_name, data_uuid, seg_lv(seg, 0)->size,
|
||||
&seg->vdo_params))
|
||||
return_0;
|
||||
@@ -390,7 +395,7 @@ static int _vdo_pool_add_target_line(struct dev_manager *dm,
|
||||
|
||||
static int _vdo_target_present(struct cmd_context *cmd,
|
||||
const struct lv_segment *seg __attribute__((unused)),
|
||||
- unsigned *attributes __attribute__((unused)))
|
||||
+ unsigned *attributes)
|
||||
{
|
||||
/* List of features with their kernel target version */
|
||||
static const struct feature {
|
||||
@@ -401,6 +406,7 @@ static int _vdo_target_present(struct cmd_context *cmd,
|
||||
const char *feature;
|
||||
} _features[] = {
|
||||
{ 6, 2, 3, VDO_FEATURE_ONLINE_RENAME, "online_rename" },
|
||||
+ { 8, 2, 0, VDO_FEATURE_VERSION4, "version4" },
|
||||
};
|
||||
static const char _lvmconf[] = "global/vdo_disabled_features";
|
||||
static int _vdo_checked = 0;
|
||||
diff --git a/test/shell/vdo-convert.sh b/test/shell/vdo-convert.sh
|
||||
index 8b03344a7..f1d04d596 100644
|
||||
--- a/test/shell/vdo-convert.sh
|
||||
+++ b/test/shell/vdo-convert.sh
|
||||
@@ -174,6 +174,8 @@ vdo create $VDOCONF --name "$VDONAME" --device "$LOOP" --vdoSlabSize 128M --vdoL
|
||||
# Get VDO table line
|
||||
dmsetup table "$VDONAME" | tr " " "\n" | sed -e '5,6d' -e '12d' | tee vdo-orig
|
||||
|
||||
+aux lvmconf 'global/vdo_disabled_features = [ "version4" ]'
|
||||
+
|
||||
lvm_import_vdo -y --name $vg/$lv "$LOOP"
|
||||
lvs -a $vg
|
||||
|
||||
--
|
||||
2.41.0
|
||||
|
|
@ -1,171 +0,0 @@
|
|||
From aa75359c7c1baae43349416f3761754507cd5c1a Mon Sep 17 00:00:00 2001
|
||||
From: Zdenek Kabelac <zkabelac@redhat.com>
|
||||
Date: Fri, 8 Jul 2022 23:38:34 +0200
|
||||
Subject: [PATCH 079/115] vdo: enhance lvcreate validation
|
||||
|
||||
When creating VDO pool based of % values, lvm2 is now more clever
|
||||
and avoids to create 'unsupportable' sizes of physical backend
|
||||
volumes as 16TiB is maximum size supported by VDO target
|
||||
(and also limited by maximum supportable slabs (8192) based on slab
|
||||
size.
|
||||
|
||||
If the requested virtual size is approaching max supported size 4PiB,
|
||||
switch header size to 0.
|
||||
|
||||
(cherry picked from commit e2e31d9acf1b96ab741c22dc0a2fefd672996d3a)
|
||||
---
|
||||
lib/metadata/metadata-exported.h | 2 ++
|
||||
lib/metadata/vdo_manip.c | 14 ++++++++++
|
||||
tools/lvcreate.c | 48 ++++++++++++++++++++++++++------
|
||||
3 files changed, 56 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
|
||||
index 449c8d014..f735baa55 100644
|
||||
--- a/lib/metadata/metadata-exported.h
|
||||
+++ b/lib/metadata/metadata-exported.h
|
||||
@@ -1364,6 +1364,8 @@ const char *get_vdo_operating_mode_name(enum dm_vdo_operating_mode mode);
|
||||
const char *get_vdo_write_policy_name(enum dm_vdo_write_policy policy);
|
||||
uint64_t get_vdo_pool_virtual_size(const struct lv_segment *vdo_pool_seg);
|
||||
int update_vdo_pool_virtual_size(struct lv_segment *vdo_pool_seg);
|
||||
+uint32_t get_vdo_pool_max_extents(const struct dm_vdo_target_params *vtp,
|
||||
+ uint32_t extent_size);
|
||||
int parse_vdo_pool_status(struct dm_pool *mem, const struct logical_volume *vdo_pool_lv,
|
||||
const char *params, const struct dm_info *dminfo,
|
||||
struct lv_status_vdo *status);
|
||||
diff --git a/lib/metadata/vdo_manip.c b/lib/metadata/vdo_manip.c
|
||||
index f3a4a9534..4ccde40b1 100644
|
||||
--- a/lib/metadata/vdo_manip.c
|
||||
+++ b/lib/metadata/vdo_manip.c
|
||||
@@ -127,6 +127,20 @@ int update_vdo_pool_virtual_size(struct lv_segment *vdo_pool_seg)
|
||||
return 1;
|
||||
}
|
||||
|
||||
+uint32_t get_vdo_pool_max_extents(const struct dm_vdo_target_params *vtp,
|
||||
+ uint32_t extent_size)
|
||||
+{
|
||||
+ uint64_t max_extents = (DM_VDO_PHYSICAL_SIZE_MAXIMUM + extent_size - 1) / extent_size;
|
||||
+ uint64_t max_slab_extents = ((extent_size - 1 + DM_VDO_SLABS_MAXIMUM *
|
||||
+ ((uint64_t)vtp->slab_size_mb << (20 - SECTOR_SHIFT))) /
|
||||
+ extent_size);
|
||||
+
|
||||
+ max_extents = (max_slab_extents < max_extents) ? max_slab_extents : max_extents;
|
||||
+
|
||||
+ return (max_extents > UINT32_MAX) ? UINT32_MAX : (uint32_t)max_extents;
|
||||
+}
|
||||
+
|
||||
+
|
||||
static int _sysfs_get_kvdo_value(const char *dm_name, const struct dm_info *dminfo,
|
||||
const char *vdo_param, uint64_t *value)
|
||||
{
|
||||
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
|
||||
index fb57d84bd..3eee5de90 100644
|
||||
--- a/tools/lvcreate.c
|
||||
+++ b/tools/lvcreate.c
|
||||
@@ -253,6 +253,7 @@ static int _update_extents_params(struct volume_group *vg,
|
||||
uint32_t stripesize_extents;
|
||||
uint32_t extents;
|
||||
uint32_t base_calc_extents;
|
||||
+ uint32_t vdo_pool_max_extents;
|
||||
|
||||
if (lcp->size &&
|
||||
!(lp->extents = extents_from_size(vg->cmd, lcp->size,
|
||||
@@ -322,6 +323,23 @@ static int _update_extents_params(struct volume_group *vg,
|
||||
return 0;
|
||||
}
|
||||
|
||||
+ if (seg_is_vdo(lp)) {
|
||||
+ vdo_pool_max_extents = get_vdo_pool_max_extents(&lp->vdo_params, vg->extent_size);
|
||||
+ if (extents > vdo_pool_max_extents) {
|
||||
+ if (lcp->percent == PERCENT_NONE) {
|
||||
+ log_error("Can't use %s size. Maximal supported VDO POOL volume size with slab size %s is %s.",
|
||||
+ display_size(vg->cmd, (uint64_t)vg->extent_size * extents),
|
||||
+ display_size(vg->cmd, (uint64_t)lp->vdo_params.slab_size_mb << (20 - SECTOR_SHIFT)),
|
||||
+ display_size(vg->cmd, (uint64_t)vg->extent_size * vdo_pool_max_extents));
|
||||
+ return 0;
|
||||
+ }
|
||||
+ extents = vdo_pool_max_extents;
|
||||
+ log_verbose("Using maximal supported VDO POOL volume size %s (with slab size %s).",
|
||||
+ display_size(vg->cmd, (uint64_t)vg->extent_size * extents),
|
||||
+ display_size(vg->cmd, (uint64_t)lp->vdo_params.slab_size_mb << (20 - SECTOR_SHIFT)));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if (lcp->percent != PERCENT_NONE) {
|
||||
/* FIXME Don't do the adjustment for parallel allocation with PERCENT_ORIGIN! */
|
||||
lp->approx_alloc = 1;
|
||||
@@ -699,15 +717,23 @@ static int _read_cache_params(struct cmd_context *cmd,
|
||||
}
|
||||
|
||||
static int _read_vdo_params(struct cmd_context *cmd,
|
||||
- struct lvcreate_params *lp)
|
||||
+ struct lvcreate_params *lp,
|
||||
+ struct lvcreate_cmdline_params *lcp)
|
||||
{
|
||||
if (!seg_is_vdo(lp))
|
||||
return 1;
|
||||
|
||||
// prefiling settings here
|
||||
- if (!fill_vdo_target_params(cmd, &lp->vdo_params, &lp->vdo_pool_header_size, NULL))
|
||||
+ if (!fill_vdo_target_params(cmd, &lp->vdo_params, &lp->vdo_pool_header_size, NULL))
|
||||
return_0;
|
||||
|
||||
+ if ((lcp->virtual_size <= DM_VDO_LOGICAL_SIZE_MAXIMUM) &&
|
||||
+ ((lcp->virtual_size + lp->vdo_pool_header_size) > DM_VDO_LOGICAL_SIZE_MAXIMUM)) {
|
||||
+ log_verbose("Dropping VDO pool header size to 0 to support maximal size %s.",
|
||||
+ display_size(cmd, DM_VDO_LOGICAL_SIZE_MAXIMUM));
|
||||
+ lp->vdo_pool_header_size = 0;
|
||||
+ }
|
||||
+
|
||||
// override with optional vdo settings
|
||||
if (!get_vdo_settings(cmd, &lp->vdo_params, NULL))
|
||||
return_0;
|
||||
@@ -1203,7 +1229,7 @@ static int _lvcreate_params(struct cmd_context *cmd,
|
||||
&lp->pool_metadata_size, &lp->pool_metadata_spare,
|
||||
&lp->chunk_size, &lp->discards, &lp->zero_new_blocks)) ||
|
||||
!_read_cache_params(cmd, lp) ||
|
||||
- !_read_vdo_params(cmd, lp) ||
|
||||
+ !_read_vdo_params(cmd, lp, lcp) ||
|
||||
!_read_mirror_and_raid_params(cmd, lp))
|
||||
return_0;
|
||||
|
||||
@@ -1589,13 +1615,19 @@ static int _check_pool_parameters(struct cmd_context *cmd,
|
||||
}
|
||||
|
||||
static int _check_vdo_parameters(struct volume_group *vg, struct lvcreate_params *lp,
|
||||
- struct lvcreate_cmdline_params *lcp)
|
||||
+ struct lvcreate_cmdline_params *lcp)
|
||||
{
|
||||
- if (seg_is_vdo(lp) && lp->snapshot) {
|
||||
+ if (lp->snapshot) {
|
||||
log_error("Please either create VDO or snapshot.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
+ if (lcp->virtual_size > DM_VDO_LOGICAL_SIZE_MAXIMUM) {
|
||||
+ log_error("Maximal supported VDO virtual size is %s.",
|
||||
+ display_size(vg->cmd, DM_VDO_LOGICAL_SIZE_MAXIMUM));
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1716,12 +1748,12 @@ static int _lvcreate_single(struct cmd_context *cmd, const char *vg_name,
|
||||
if (seg_is_thin(lp) && !_check_thin_parameters(vg, lp, lcp))
|
||||
goto_out;
|
||||
|
||||
- if (!_check_pool_parameters(cmd, vg, lp, lcp))
|
||||
- goto_out;
|
||||
-
|
||||
if (seg_is_vdo(lp) && !_check_vdo_parameters(vg, lp, lcp))
|
||||
return_0;
|
||||
|
||||
+ if (!_check_pool_parameters(cmd, vg, lp, lcp))
|
||||
+ goto_out;
|
||||
+
|
||||
/* All types are checked */
|
||||
if (!_check_zero_parameters(cmd, lp))
|
||||
return_0;
|
||||
--
|
||||
2.41.0
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
From f5c194afc5d904e3a936dc167ac14b204c049969 Mon Sep 17 00:00:00 2001
|
||||
From: Zdenek Kabelac <zkabelac@redhat.com>
|
||||
Date: Sat, 9 Jul 2022 21:33:57 +0200
|
||||
Subject: [PATCH 080/115] vdo: suffle code for better error path handling
|
||||
|
||||
For failing dm_ no need to report 2nd. error,
|
||||
but we missed to report error with 'updated==NULL'.
|
||||
|
||||
(cherry picked from commit 493acb9195cef185b38ae4e4ffb84b984e5cc08c)
|
||||
---
|
||||
tools/toollib.c | 28 ++++++++++++++--------------
|
||||
1 file changed, 14 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/tools/toollib.c b/tools/toollib.c
|
||||
index d9a1a92ec..71bf26d39 100644
|
||||
--- a/tools/toollib.c
|
||||
+++ b/tools/toollib.c
|
||||
@@ -1343,23 +1343,23 @@ int get_vdo_settings(struct cmd_context *cmd,
|
||||
u |= VDO_CHANGE_ONLINE;
|
||||
}
|
||||
|
||||
- if (updated) {
|
||||
- // validation of updated VDO option
|
||||
- if (!dm_vdo_validate_target_params(vtp, 0 /* vdo_size */)) {
|
||||
-err:
|
||||
- if (is_lvchange)
|
||||
- log_error("Cannot change VDO setting \"vdo_%s\" in existing VDO pool.",
|
||||
- option);
|
||||
- else
|
||||
- log_error("Invalid argument for VDO setting \"vdo_%s\".",
|
||||
- option);
|
||||
- goto out;
|
||||
- }
|
||||
+ // validation of updated VDO option
|
||||
+ if (!dm_vdo_validate_target_params(vtp, 0 /* vdo_size */))
|
||||
+ goto_out;
|
||||
|
||||
+ if (updated)
|
||||
*updated = u;
|
||||
- }
|
||||
|
||||
- r = 1;
|
||||
+ r = 1; // success
|
||||
+ goto out;
|
||||
+err:
|
||||
+ if (is_lvchange)
|
||||
+ log_error("Cannot change VDO setting \"vdo_%s\" in existing VDO pool.",
|
||||
+ option);
|
||||
+ else
|
||||
+ log_error("Invalid argument for VDO setting \"vdo_%s\".",
|
||||
+ option);
|
||||
+
|
||||
out:
|
||||
if (result)
|
||||
dm_config_destroy(result);
|
||||
--
|
||||
2.41.0
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
From fee817aff4bbd4a8dad7ceae7da179997dc7d359 Mon Sep 17 00:00:00 2001
|
||||
From: Zdenek Kabelac <zkabelac@redhat.com>
|
||||
Date: Mon, 15 Aug 2022 13:08:59 +0200
|
||||
Subject: [PATCH 081/115] vdo: use only verbose log level for reformating
|
||||
|
||||
When lvcreate is makeing VDO pool and user has not specified -V size,
|
||||
ATM we actually run 'vdoformat' twice to get properly 'extent' aligned
|
||||
size matching lvm2 properties - so the 2nd. run of vdoformat actually
|
||||
can stay with 'log_verbose()' so the standard printed result
|
||||
is not showing confusing info (which is now also correctly using
|
||||
print_unless_silent)
|
||||
|
||||
(cherry picked from commit fc5bc5985d03aef5846cb98882d17815fc00ca15)
|
||||
---
|
||||
lib/metadata/vdo_manip.c | 10 ++++++++--
|
||||
1 file changed, 8 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/lib/metadata/vdo_manip.c b/lib/metadata/vdo_manip.c
|
||||
index 4ccde40b1..637fd1e5d 100644
|
||||
--- a/lib/metadata/vdo_manip.c
|
||||
+++ b/lib/metadata/vdo_manip.c
|
||||
@@ -249,6 +249,7 @@ static int _format_vdo_pool_data_lv(struct logical_volume *data_lv,
|
||||
FILE *f;
|
||||
uint64_t lb;
|
||||
unsigned slabbits;
|
||||
+ unsigned reformating = 0;
|
||||
int args = 1;
|
||||
char buf_args[5][128];
|
||||
char buf[256]; /* buffer for short disk header (64B) */
|
||||
@@ -351,8 +352,12 @@ reformat:
|
||||
}
|
||||
if ((c = strchr(buf, '\n')))
|
||||
*c = 0; /* cut last '\n' away */
|
||||
- if (buf[0])
|
||||
- log_print(" %s", buf); /* Print vdo_format messages */
|
||||
+ if (buf[0]) {
|
||||
+ if (reformating)
|
||||
+ log_verbose(" %s", buf); /* Print vdo_format messages */
|
||||
+ else
|
||||
+ log_print_unless_silent(" %s", buf); /* Print vdo_format messages */
|
||||
+ }
|
||||
}
|
||||
|
||||
if (!pipe_close(&pdata)) {
|
||||
@@ -372,6 +377,7 @@ reformat:
|
||||
*logical_size = logical_size_aligned;
|
||||
argv[1] = (char*) "--force";
|
||||
args = 2;
|
||||
+ reformating = 1;
|
||||
log_verbose("Reformating VDO to align virtual size %s by extent size.",
|
||||
display_size(data_lv->vg->cmd, *logical_size));
|
||||
goto reformat;
|
||||
--
|
||||
2.41.0
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
From a4f39c5bbff286cc1323f799d269e35bf8e615b6 Mon Sep 17 00:00:00 2001
|
||||
From: Zdenek Kabelac <zkabelac@redhat.com>
|
||||
Date: Thu, 18 Aug 2022 13:55:29 +0200
|
||||
Subject: [PATCH 082/115] vdo: reset errno before strtoull
|
||||
|
||||
Missed errno reset in commit ebad057579aeff0980a1b8af7eaacd56e62ed0c9.
|
||||
|
||||
(cherry picked from commit 309df239e3ee474f3a5337f8fa3c0a1f7b0a89e5)
|
||||
---
|
||||
lib/metadata/vdo_manip.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/lib/metadata/vdo_manip.c b/lib/metadata/vdo_manip.c
|
||||
index 637fd1e5d..0db401537 100644
|
||||
--- a/lib/metadata/vdo_manip.c
|
||||
+++ b/lib/metadata/vdo_manip.c
|
||||
@@ -618,6 +618,7 @@ static int _get_memory_info(uint64_t *total_mb, uint64_t *available_mb)
|
||||
if (!found)
|
||||
continue; // not interesting
|
||||
|
||||
+ errno = 0;
|
||||
*(found->value) = (uint64_t) strtoull(e, &tail, 10);
|
||||
|
||||
if ((e == tail) || errno)
|
||||
--
|
||||
2.41.0
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
From c3d533a0ea20aa26868c55959365a52f3eaf34d1 Mon Sep 17 00:00:00 2001
|
||||
From: Zdenek Kabelac <zkabelac@redhat.com>
|
||||
Date: Fri, 19 Aug 2022 14:48:01 +0200
|
||||
Subject: [PATCH 083/115] vdo: extend volume and pool without flush
|
||||
|
||||
When the volume size is extended, there is no need to flush
|
||||
IO operations (nothing can be targeting new space yet).
|
||||
VDO target is supported as target that can safely work with
|
||||
this condition.
|
||||
|
||||
Such support is also needed, when extending VDOPOOL size
|
||||
while the pool is reaching its capacity - since this allows
|
||||
to continue working without reaching 'out-of-space' condition
|
||||
due to flushing of all in flight IO.
|
||||
|
||||
(cherry picked from commit e26c21cb8d5841141dcfdfc77f46da1108a81255)
|
||||
---
|
||||
WHATS_NEW | 1 +
|
||||
lib/activate/activate.c | 6 +++++-
|
||||
lib/activate/dev_manager.c | 2 ++
|
||||
3 files changed, 8 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/WHATS_NEW b/WHATS_NEW
|
||||
index 705fbde74..48b1d7d86 100644
|
||||
--- a/WHATS_NEW
|
||||
+++ b/WHATS_NEW
|
||||
@@ -1,5 +1,6 @@
|
||||
Version 2.03.17 -
|
||||
===============================
|
||||
+ Extend VDO and VDOPOOL without flushing and locking fs.
|
||||
Fix lvconvert --test --type vdo-pool execution.
|
||||
Fix vdo_slab_size_mb value for converted VDO volume.
|
||||
|
||||
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
|
||||
index 727bd2386..76740bb2b 100644
|
||||
--- a/lib/activate/activate.c
|
||||
+++ b/lib/activate/activate.c
|
||||
@@ -2124,7 +2124,11 @@ static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s,
|
||||
* TODO: Relax this limiting condition further */
|
||||
if (!flush_required &&
|
||||
(lv_is_pvmove(lv) || pvmove_lv ||
|
||||
- (!lv_is_mirror(lv) && !lv_is_thin_pool(lv) && !lv_is_thin_volume(lv)))) {
|
||||
+ (!lv_is_mirror(lv) &&
|
||||
+ !lv_is_thin_volume(lv) &&
|
||||
+ !lv_is_thin_pool(lv) &&
|
||||
+ !lv_is_vdo(lv) &&
|
||||
+ !lv_is_vdo_pool(lv)))) {
|
||||
log_debug("Requiring flush for LV %s.", display_lvname(lv));
|
||||
flush_required = 1;
|
||||
}
|
||||
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
|
||||
index 284254d68..9058510e4 100644
|
||||
--- a/lib/activate/dev_manager.c
|
||||
+++ b/lib/activate/dev_manager.c
|
||||
@@ -3826,6 +3826,8 @@ static int _tree_action(struct dev_manager *dm, const struct logical_volume *lv,
|
||||
* non 'thin pool/volume' and size increase */
|
||||
else if (!lv_is_thin_volume(lv) &&
|
||||
!lv_is_thin_pool(lv) &&
|
||||
+ !lv_is_vdo(lv) &&
|
||||
+ !lv_is_vdo_pool(lv) &&
|
||||
dm_tree_node_size_changed(root))
|
||||
dm->flush_required = 1;
|
||||
|
||||
--
|
||||
2.41.0
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
From fc1c105c75b81b4cecf24e7924605abcceb91d67 Mon Sep 17 00:00:00 2001
|
||||
From: Zdenek Kabelac <zkabelac@redhat.com>
|
||||
Date: Tue, 6 Sep 2022 16:44:24 +0200
|
||||
Subject: [PATCH 084/115] tests: vdo emulation without vdo binary
|
||||
|
||||
Avoid inserting 'vdo' binary into path - and use
|
||||
alias and VDO_BINARY shell vars for emulation.
|
||||
|
||||
(cherry picked from commit 15ad2b8e5585b89bc3f09a53567f17eb70f45714)
|
||||
---
|
||||
test/lib/lvm_vdo_wrapper.sh | 2 +-
|
||||
test/shell/vdo-convert.sh | 11 ++++++++++-
|
||||
2 files changed, 11 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/test/lib/lvm_vdo_wrapper.sh b/test/lib/lvm_vdo_wrapper.sh
|
||||
index d622d6456..90d0b2ce8 100755
|
||||
--- a/test/lib/lvm_vdo_wrapper.sh
|
||||
+++ b/test/lib/lvm_vdo_wrapper.sh
|
||||
@@ -344,7 +344,7 @@ vdo_dry_ vdo_remove_ -f "$vdo_confFile" -n "$vdo_name" || true
|
||||
#
|
||||
# MAIN
|
||||
#
|
||||
-case "$1" in
|
||||
+case "${1-}" in
|
||||
"create") shift; vdo_create_ "$@" ;;
|
||||
"remove") shift; vdo_remove_ "$@" ;;
|
||||
"stop") shift; vdo_stop_ "$@" ;;
|
||||
diff --git a/test/shell/vdo-convert.sh b/test/shell/vdo-convert.sh
|
||||
index f1d04d596..5bf53d081 100644
|
||||
--- a/test/shell/vdo-convert.sh
|
||||
+++ b/test/shell/vdo-convert.sh
|
||||
@@ -29,7 +29,16 @@ aux prepare_dmeventd
|
||||
#
|
||||
# Main
|
||||
#
|
||||
-which vdo || skip
|
||||
+if not which vdo ; then
|
||||
+ which lvm_vdo_wrapper || skip "Missing 'lvm_vdo_wrapper'."
|
||||
+ which oldvdoformat || skip "Emulation of vdo manager 'oldvdoformat' missing."
|
||||
+ which oldvdoprepareforlvm || skip "Emulation of vdo manager 'oldvdoprepareforlvm' missing."
|
||||
+ # enable expansion of aliasis within script itself
|
||||
+ shopt -s expand_aliases
|
||||
+ alias vdo='lvm_vdo_wrapper'
|
||||
+ export VDO_BINARY=lvm_vdo_wrapper
|
||||
+ echo "Using 'lvm_vdo_wrapper' emulation of 'vdo' manager."
|
||||
+fi
|
||||
which mkfs.ext4 || skip
|
||||
export MKE2FS_CONFIG="$TESTDIR/lib/mke2fs.conf"
|
||||
|
||||
--
|
||||
2.41.0
|
||||
|
|
@ -1,373 +0,0 @@
|
|||
From fd16a667a985ef116f3deed1910b99aa0859f244 Mon Sep 17 00:00:00 2001
|
||||
From: Zdenek Kabelac <zkabelac@redhat.com>
|
||||
Date: Wed, 26 Oct 2022 14:33:09 +0200
|
||||
Subject: [PATCH 085/115] device_mapper: add parser for vdo metadata
|
||||
|
||||
Add very simplistic parser of vdo metadata to be able to obtain
|
||||
logical_blocks stored within vdo metadata - as lvm2 may
|
||||
submit smaller value due to internal aligment rules.
|
||||
|
||||
To avoid creation of mismatching table line - use this number
|
||||
instead the one provided by lvm2.
|
||||
|
||||
(cherry picked from commit 829ab017082eaad253ebd28ad7d7ae7f3936dbcb)
|
||||
---
|
||||
device_mapper/Makefile | 3 +-
|
||||
device_mapper/libdm-deptree.c | 15 ++
|
||||
device_mapper/vdo/target.h | 2 +
|
||||
device_mapper/vdo/vd |