main - vdo: fixes
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=1ae157a0f67e984ef30...
Commit: 1ae157a0f67e984ef3037d19d62b84a3b0201c84
Parent: 419c93c87358ad311aa78dcd6fd8298325356df4
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Aug 31 20:52:26 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Aug 31 22:05:47 2021 +0200
vdo: fixes
Better identify VDO device with major:minor.
Handle different LV name from originally converted origin LV.
Improve --dry-run handling.
---
WHATS_NEW | 4 +++
scripts/lvm_import_vdo.sh | 70 +++++++++++++++++++++++++++++++++++------------
test/shell/vdo-convert.sh | 28 ++++++++++++++-----
3 files changed, 78 insertions(+), 24 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index ea434e2c6..90fe1b676 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,9 @@
Version 2.03.14 -
==================================
+ Improve lvm_import_vdo script.
+ Support VDO LV with lvcreate -ky.
+ Fix lvconvert for VDO LV bigger then 2T.
+ Create VDO LVs automatically without zeroing.
Rename vdoimport to lvm_import_vdo.
Version 2.03.13 - 11th August 2021
diff --git a/scripts/lvm_import_vdo.sh b/scripts/lvm_import_vdo.sh
index 7e24b49d7..ae2892949 100755
--- a/scripts/lvm_import_vdo.sh
+++ b/scripts/lvm_import_vdo.sh
@@ -41,10 +41,15 @@ BLOCKDEV="blockdev"
READLINK="readlink"
READLINK_E="-e"
MKDIR="mkdir"
+DMSETUP="dmsetup"
TEMPDIR="${TMPDIR:-/tmp}/${TOOL}_${RANDOM}$$"
DM_DEV_DIR="${DM_DEV_DIR:-/dev}"
+DEVICENAME=""
+DEVMAJOR=0
+DEVMINOR=0
+
DRY=0
VERB=""
FORCE=""
@@ -147,8 +152,6 @@ get_largest_extent_size_() {
# dereference device name if it is symbolic link
detect_lv_() {
local DEVICE=$1
- local MAJOR
- local MINOR
local SYSVOLUME
local MAJORMINOR
@@ -161,17 +164,21 @@ detect_lv_() {
/dev/dm-[0-9]*)
read -r <"/sys/block/${RDEVICE#/dev/}/dm/name" SYSVOLUME 2>&1 && DEVICE="$DM_DEV_DIR/mapper/$SYSVOLUME"
read -r <"/sys/block/${RDEVICE#/dev/}/dev" MAJORMINOR 2>&1 || error "Cannot get major:minor for \"$DEVICE\"."
- MAJOR=${MAJORMINOR%%:*}
- MINOR=${MAJORMINOR##*:}
+ DEVMAJOR=${MAJORMINOR%%:*}
+ DEVMINOR=${MAJORMINOR##*:}
;;
*)
- STAT=$(stat --format "MAJOR=\$((0x%t)) MINOR=\$((0x%T))" "$RDEVICE")
+ STAT=$(stat --format "DEVMAJOR=\$((0x%t)) DEVMINOR=\$((0x%T))" "$RDEVICE")
test -n "$STAT" || error "Cannot get major:minor for \"$DEVICE\"."
eval "$STAT"
;;
esac
- eval "$(dmsetup info -c -j "$MAJOR" -m "$MINOR" -o uuid,name --noheadings --nameprefixes --separator ' ')"
+ DEV="$("$DMSETUP" info -c -j "$DEVMAJOR" -m "$DEVMINOR" -o uuid,name --noheadings --nameprefixes --separator ' ' 2>/dev/null)"
+ case "$DEV" in
+ Device*) ;; # no devices
+ *) eval "$DEV" ;;
+ esac
}
# parse yaml config files into 'prefix_yaml_part_names=("value")' strings
@@ -226,20 +233,26 @@ convert2lvm_() {
local TRVDONAME
local EXTENTSZ
local IS_LV=1
+ local FOUND=""
+ local MAJOR=0
+ local MINOR=0
+ local DM_VG_NAME
+ local DM_LV_NAME
DM_UUID=""
detect_lv_ "$DEVICE"
case "$DM_UUID" in
- LVM-*) eval "$(dmsetup splitname --nameprefixes --noheadings --separator ' ' "$DM_NAME")"
+ LVM-*) eval "$("$DMSETUP" splitname --nameprefixes --noheadings --separator ' ' "$DM_NAME")"
if [ -z "$VGNAME" ] || [ "$VGNAME" = "$LVNAME" ] ; then
VGNAME=$DM_VG_NAME
+ LVNAME=$DM_LV_NAME
elif test "$VGNAME" != "$DM_VG_NAME" ; then
error "Volume group name \"$VGNAME\" does not match name \"$DM_VG_NAME\" for device \"$DEVICE\"."
fi
;;
*) IS_LV=0
# Check $VGNANE does not already exists
- "$LVM" vgs "$VGNAME" && error "Cannot use already existing volume group name \"$VGNAME\"."
+ "$LVM" vgs "$VGNAME" >/dev/null 2>&1 && error "Cannot use already existing volume group name \"$VGNAME\"."
;;
esac
@@ -247,15 +260,37 @@ convert2lvm_() {
"$MKDIR" -p -m 0000 "$TEMPDIR" || error "Failed to create $TEMPDIR."
+ # TODO: might use directly /etc/vdoconf.yml (avoding need of 'vdo' manager)
verbose "Getting YAML VDO configuration."
"$VDO" printConfigFile $VDOCONF >"$TEMPDIR/vdoconf.yml"
- VDONAME=$(awk -v DNAME="$DEVICE" '/.*VDOService$/ {VNAME=substr($1, 0, length($1) - 1)} /[[:space:]]*device:/ { if ($2 ~ DNAME) {print VNAME}}' "$TEMPDIR/vdoconf.yml")
+ # Check list of devices in VDO configure file for their major:minor
+ # and match with given $DEVICE devmajor:devminor
+ for i in $(awk '/.*device:/ {print $2}' "$TEMPDIR/vdoconf.yml") ; do
+ local DEV
+ DEV=$("$READLINK" $READLINK_E "$i") || continue
+ STAT=$(stat --format "MAJOR=\$((0x%t)) MINOR=\$((0x%T))" "$DEV" 2>/dev/null) || continue
+ eval "$STAT"
+ test "$MAJOR" = "$DEVMAJOR" && test "$MINOR" = "$DEVMINOR" && {
+ test -z "$FOUND" || error "VDO configuration contains duplicate entries $FOUND and $i"
+ FOUND=$i
+ }
+ done
+
+ test -n "$FOUND" || error "Can't find matching device in vdo configuration file."
+ verbose "Found matching device $FOUND $MAJOR:$MINOR"
+
+ VDONAME=$(awk -v DNAME="$FOUND" '/.*VDOService$/ {VNAME=substr($1, 0, length($1) - 1)} /[[:space:]]*device:/ { if ($2 ~ DNAME) {print VNAME}}' "$TEMPDIR/vdoconf.yml")
TRVDONAME=$(echo "$VDONAME" | tr '-' '_')
# When VDO volume is 'active', check it's not mounted/being used
- eval "$(dmsetup info -c -o open "$VDONAME" --noheadings --nameprefixes || true)"
- test "${DM_OPEN:-0}" -eq 0 || error "Cannot converted VDO volume \"$VDONAME\" which is in use!"
+ DM_OPEN="$("$DMSETUP" info -c -o open "$VDONAME" --noheadings --nameprefixes 2>/dev/null || true)"
+ case "$DM_OPEN" in
+ Device*) ;; # no devices
+ *) eval "$DM_OPEN"
+ test "${DM_OPEN:-0}" -eq 0 || error "Cannot converted VDO volume \"$VDONAME\" which is in use!"
+ ;;
+ esac
#parse_yaml_ "$TEMPDIR/vdoconf.yml" _
eval "$(parse_yaml_ "$TEMPDIR/vdoconf.yml" _ | grep "$TRVDONAME" | sed -e "s/_config_vdos_$TRVDONAME/vdo/g")"
@@ -263,8 +298,7 @@ convert2lvm_() {
vdo_logicalSize=$(get_kb_size_with_unit_ "$vdo_logicalSize")
vdo_physicalSize=$(get_kb_size_with_unit_ "$vdo_physicalSize")
- verbose "Going to convert physical sized VDO device $vdo_physicalSize KiB."
- verbose "With logical volume of size $vdo_logicalSize KiB."
+ verbose "Converted VDO device has logical/physical size $vdo_logicalSize/$vdo_physicalSize KiB."
PARAMS=$(cat <<EOF
allocation {
@@ -313,7 +347,7 @@ EOF
pvfree=$(( pvfree / 1024 - 2048 )) # to KiB
else
- pvfree=$("$LVM" lvs -o size --units b --nosuffix --noheadings "$VGNAME/$LVNAME")
+ pvfree=$("$LVM" lvs -o size --units b --nosuffix --noheadings "$DM_VG_NAME/$DM_LV_NAME")
pvfree=$(( pvfree / 1024 )) # to KiB
fi
@@ -334,11 +368,11 @@ EOF
vg_extent_size=$(( vg_extent_size / 1024 ))
test "$vg_extent_size" -le "$EXTENTSZ" || {
- error "Please vgchange extent_size to at most $EXTENTSZ KiB or extend and align virtual size on $vg_extent_size KiB."
+ error "Please vgchange extent_size to at most $EXTENTSZ KiB or extend and align virtual size of VDO device on $vg_extent_size KiB."
}
verbose "Renaming existing LV to be used as _vdata volume for VDO pool LV."
- dry "$LVM" lvrename $YES $VERB "$VGNAME/$LVNAME" "$VGNAME/${LVNAME}_vpool" || {
- error "Rename of LV \"$VGNAME/$LVNAME\" failed, while VDO header has been already moved!"
+ dry "$LVM" lvrename $YES $VERB "$VGNAME/$DM_LV_NAME" "$VGNAME/${LVNAME}_vpool" || {
+ error "Rename of LV \"$VGNAME/$DM_LV_NAME\" failed, while VDO header has been already moved!"
}
fi
@@ -372,5 +406,7 @@ do
shift
done
+test -n "$DEVICENAME" || error "Device name is not specified. (see: $TOOL --help)"
+
# do conversion
convert2lvm_ "$DEVICENAME"
diff --git a/test/shell/vdo-convert.sh b/test/shell/vdo-convert.sh
index 2d16c973f..493f415d4 100644
--- a/test/shell/vdo-convert.sh
+++ b/test/shell/vdo-convert.sh
@@ -61,22 +61,36 @@ lvm_import_vdo --dry-run -y -v --name $lv1 "$DM_DEV_DIR/$vg/$lv1"
lvm_import_vdo -y --name $lv1 "$DM_DEV_DIR/$vg/$lv1"
-# ATM needed - since we do not call 'vdo convert' in this case
-vdo remove $VDOCONF --force --name "$VDONAME" || true
+# ensure VDO device is not left in config file
+vdo remove $VDOCONF --force --name "$VDONAME" 2>/dev/null || true
+
+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
+
+lvm_import_vdo -y --name $vg/$lv2 "$DM_DEV_DIR/$vg/$lv1"
+
+check lv_exists $vg $lv2
+check lv_not_exists $vg $lv1
vgremove -f $vg
+# ensure VDO device is not left in config file
+vdo remove $VDOCONF --force --name "$VDONAME" 2>/dev/null || true
+
aux wipefs_a "$dev1"
# prepare 'unused' $vg2
vgcreate $vg2 "$dev2"
#
-# Check conversion of VDO volume on non-LV device
+# Check conversion of VDO volume on non-LV device and with >2T size
#
-vdo create $VDOCONF --name "$VDONAME" --device="$dev1" --vdoLogicalSize=31G
-
-mkfs -E nodiscard "$DM_DEV_DIR/mapper/$VDONAME"
+vdo create $VDOCONF --name "$VDONAME" --device="$dev1" --vdoLogicalSize=3T
# Fail with an already existing volume group $vg2
not lvm_import_vdo --dry-run -y -v --name $vg2/$lv1 "$dev1" |& tee err
@@ -87,7 +101,7 @@ vdo stop $VDOCONF --name "$VDONAME"
lvm_import_vdo -y -v --name $vg/$lv1 "$dev1"
-fsck -n "$DM_DEV_DIR/$vg/$lv1"
+check lv_field $vg/$lv1 size "3.00t"
vgremove -f $vg
2 years, 2 months
main - vdo: support lvcreate with skipped activation
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=419c93c87358ad311aa...
Commit: 419c93c87358ad311aa78dcd6fd8298325356df4
Parent: 4afe872fd6c43fcfcd519c862574d010cdbda653
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Aug 31 21:34:06 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Aug 31 22:05:47 2021 +0200
vdo: support lvcreate with skipped activation
Support creation of VDO LV for 'lvcreate -ky...'.
---
lib/metadata/lv_manip.c | 14 ++++++++++++++
test/shell/lvcreate-vdo.sh | 2 +-
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 730e3f0df..4bfedbe6e 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -8721,6 +8721,14 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
goto revert_new_lv;
}
lv->status &= ~LV_TEMPORARY;
+ } else if (seg_is_vdo_pool(lp)) {
+ lv->status |= LV_TEMPORARY;
+ if (!activate_lv(cmd, lv)) {
+ log_error("Aborting. Failed to activate temporary "
+ "volume for VDO pool creation.");
+ goto revert_new_lv;
+ }
+ lv->status &= ~LV_TEMPORARY;
} else if (!lv_active_change(cmd, lv, lp->activate)) {
log_error("Failed to activate new LV %s.", display_lvname(lv));
goto deactivate_and_revert_new_lv;
@@ -8747,6 +8755,12 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
stack;
goto deactivate_and_revert_new_lv;
}
+ if ((lv->status & LV_ACTIVATION_SKIP) &&
+ !deactivate_lv(cmd, lv)) {
+ log_error("Aborting. Couldn't deactivate VDO LV %s with skipped activation.",
+ display_lvname(lv));
+ return NULL; /* Let's retry on error path */
+ }
} else if (seg_is_cache(lp) || (origin_lv && lv_is_cache_pool(lv))) {
/* Finish cache conversion magic */
if (origin_lv) {
diff --git a/test/shell/lvcreate-vdo.sh b/test/shell/lvcreate-vdo.sh
index d66e35390..9fb2959db 100644
--- a/test/shell/lvcreate-vdo.sh
+++ b/test/shell/lvcreate-vdo.sh
@@ -79,7 +79,7 @@ not fsck -n "$DM_DEV_DIR/mapper/$vg-${lv2}"
lvremove -ff $vg
-lvcreate --type vdo -L10G -V1T -n $lv1 $vg
+lvcreate --type vdo -L10G -V1T -ky -n $lv1 $vg
lvs -a $vg
lvremove -ff $vg
2 years, 2 months
main - vdo: fix conversion of large virtual sizes
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=4afe872fd6c43fcfcd5...
Commit: 4afe872fd6c43fcfcd519c862574d010cdbda653
Parent: 88360b0c512d96dfe05c11362ff389ef6bfec6b4
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Aug 30 18:12:59 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Aug 31 22:05:47 2021 +0200
vdo: fix conversion of large virtual sizes
Properly accept virtual sizes above 2TiB.
---
tools/lvconvert.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 83dfe5c71..d73e16e3a 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -5428,7 +5428,7 @@ static int _lvconvert_to_vdopool_single(struct cmd_context *cmd,
return_0;
lvc.virtual_extents = extents_from_size(cmd,
- arg_uint_value(cmd, virtualsize_ARG, 0),
+ arg_uint64_value(cmd, virtualsize_ARG, UINT64_C(0)),
vg->extent_size);
if (!(lvc.segtype = get_segtype_from_string(cmd, SEG_TYPE_NAME_VDO)))
2 years, 2 months
main - vdo: skip zeroing for VDO LV
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=88360b0c512d96dfe05...
Commit: 88360b0c512d96dfe05c11362ff389ef6bfec6b4
Parent: 62c599f78151e65105c92c87ac406e3f3f360b1a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Aug 26 23:04:56 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Aug 31 22:05:47 2021 +0200
vdo: skip zeroing for VDO LV
Since VDO is always returns 'zero' on unprovisioned read
and every provisioned block is always 'zeroed' on partial writes,
we can avoid 'zeroing' of such LVs.
---
lib/metadata/lv_manip.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index a26d3d533..730e3f0df 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -8073,6 +8073,10 @@ static int _should_wipe_lv(struct lvcreate_params *lp,
first_seg(first_seg(lv)->pool_lv)->zero_new_blocks))
return 0;
+ /* VDO LV do not need to be zeroed */
+ if (lv_is_vdo(lv))
+ return 0;
+
if (warn && (lv_passes_readonly_filter(lv))) {
log_warn("WARNING: Read-only activated logical volume %s not zeroed.",
display_lvname(lv));
2 years, 2 months
main - cov: lvmlockd read_adopt_file free structs on error path
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=62c599f78151e65105c...
Commit: 62c599f78151e65105c92c87ac406e3f3f360b1a
Parent: 350f8845bd39dd7aaf5a52ad5deff6859fd06568
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Aug 30 13:48:42 2021 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Aug 30 13:48:42 2021 -0500
cov: lvmlockd read_adopt_file free structs on error path
---
daemons/lvmlockd/lvmlockd-core.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/daemons/lvmlockd/lvmlockd-core.c b/daemons/lvmlockd/lvmlockd-core.c
index fef9589b9..c570b9d14 100644
--- a/daemons/lvmlockd/lvmlockd-core.c
+++ b/daemons/lvmlockd/lvmlockd-core.c
@@ -965,13 +965,16 @@ static int read_adopt_file(struct list_head *vg_lockd)
if (sscanf(adopt_line, "VG: %63s %64s %15s %64s",
vg_uuid, ls->vg_name, lm_type_str, ls->vg_args) != 4) {
+ free(ls);
goto fail;
}
memcpy(ls->vg_uuid, vg_uuid, 64);
- if ((ls->lm_type = str_to_lm(lm_type_str)) < 0)
+ if ((ls->lm_type = str_to_lm(lm_type_str)) < 0) {
+ free(ls);
goto fail;
+ }
list_add(&ls->list, vg_lockd);
@@ -986,11 +989,14 @@ static int read_adopt_file(struct list_head *vg_lockd)
if (sscanf(adopt_line, "LV: %64s %64s %s %7s %u",
vg_uuid, r->name, r->lv_args, mode, &r->version) != 5) {
+ free_resource(r);
goto fail;
}
- if ((r->adopt_mode = str_to_mode(mode)) == LD_LK_IV)
+ if ((r->adopt_mode = str_to_mode(mode)) == LD_LK_IV) {
+ free_resource(r);
goto fail;
+ }
if (ls && !memcmp(ls->vg_uuid, vg_uuid, 64)) {
list_add(&r->list, &ls->resources);
@@ -1007,6 +1013,7 @@ static int read_adopt_file(struct list_head *vg_lockd)
if (r) {
log_error("No lockspace found for resource %s vg_uuid %s", r->name, vg_uuid);
+ free_resource(r);
goto fail;
}
}
2 years, 2 months
main - pvremove: apply devices file
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=350f8845bd39dd7aaf5...
Commit: 350f8845bd39dd7aaf5a52ad5deff6859fd06568
Parent: 12ba43ccd0cac480b4da0fb8457db83b4b50b722
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Aug 27 14:48:33 2021 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri Aug 27 14:48:33 2021 -0500
pvremove: apply devices file
pvremove was wrongly allowed to operate on a device
not listed in the devices file.
---
tools/toollib.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/toollib.c b/tools/toollib.c
index 6d61f49e6..9d488c5a7 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -5333,7 +5333,7 @@ int pvcreate_each_device(struct cmd_context *cmd,
cmd->use_full_md_check = 1;
- if (cmd->enable_devices_file)
+ if (cmd->enable_devices_file && !pp->is_remove)
cmd->filter_deviceid_skip = 1;
log_debug("Scanning and filtering device args (%u).", dm_list_size(&scan_devs));
@@ -5559,7 +5559,7 @@ do_command:
dm_list_iterate_items(devl, &rescan_devs)
cmd->filter->wipe(cmd, cmd->filter, devl->dev, NULL);
- if (cmd->enable_devices_file)
+ if (cmd->enable_devices_file && !pp->is_remove)
cmd->filter_deviceid_skip = 1;
log_debug("Rescanning and filtering device args with exclusive open");
2 years, 3 months
main - vdo: rename vdoimport to lvm_import_vdo
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=12ba43ccd0cac480b4d...
Commit: 12ba43ccd0cac480b4da0fb8457db83b4b50b722
Parent: 49822624e8b02bf108d79ac3ffd58a35c0c92c5e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Aug 23 14:02:42 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Aug 26 19:10:28 2021 +0200
vdo: rename vdoimport to lvm_import_vdo
Missed bits in previous rename commits.
---
configure | 26 +++++++++++++-------------
configure.ac | 18 +++++++++---------
include/configure.h.in | 6 +++---
man/Makefile.in | 8 ++++----
man/lvm_import_vdo.8_main | 1 -
scripts/Makefile.in | 4 ++--
scripts/lvm_import_vdo.sh | 6 +++---
7 files changed, 34 insertions(+), 35 deletions(-)
diff --git a/configure b/configure
index cd94cbca2..9b1508255 100755
--- a/configure
+++ b/configure
@@ -643,8 +643,6 @@ WRITE_INSTALL
WRITECACHE
VDO_LIB
VDO_INCLUDE
-VDOIMPORT_PATH
-VDOIMPORT
VDO
VALGRIND_POOL
USRSBINDIR
@@ -693,6 +691,8 @@ OCFDIR
OCF
MIRRORS
MANGLING
+LVMIMPORTVDO_PATH
+LVMIMPORTVDO
LVM_RELEASE_DATE
LVM_RELEASE
LVM_PATH
@@ -971,7 +971,7 @@ enable_dbus_service
enable_pkgconfig
enable_write_install
enable_fsadm
-enable_vdoimport
+enable_lvmimportvdo
enable_blkdeactivate
enable_dmeventd
enable_selinux
@@ -1710,7 +1710,7 @@ Optional Features:
--enable-pkgconfig install pkgconfig support
--enable-write_install install user writable files
--disable-fsadm disable fsadm
- --disable-vdoimport disable vdoimport
+ --disable-lvmimportvdo disable lvm_import_vdo
--disable-blkdeactivate disable blkdeactivate
--enable-dmeventd enable the device-mapper event daemon
--disable-selinux disable selinux support
@@ -3143,7 +3143,7 @@ case "$host_os" in
DM_IOCTLS=yes
SELINUX=yes
FSADM=yes
- VDOIMPORT=yes
+ LVMIMPORTVDO=yes
BLKDEACTIVATE=yes
;;
darwin*)
@@ -3157,7 +3157,7 @@ case "$host_os" in
DM_IOCTLS=no
SELINUX=no
FSADM=no
- VDOIMPORT=no
+ LVMIMPORTVDO=no
BLKDEACTIVATE=no
;;
*)
@@ -12554,13 +12554,13 @@ $as_echo "$FSADM" >&6; }
################################################################################
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to install lvm_import_vdo" >&5
$as_echo_n "checking whether to install lvm_import_vdo... " >&6; }
-# Check whether --enable-vdoimport was given.
-if test "${enable_vdoimport+set}" = set; then :
- enableval=$enable_vdoimport; VDOIMPORT=$enableval
+# Check whether --enable-lvmimportvdo was given.
+if test "${enable_lvmimportvdo+set}" = set; then :
+ enableval=$enable_lvmimportvdo; LVMIMPORTVDO=$enableval
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $VDOIMPORT" >&5
-$as_echo "$VDOIMPORT" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LVMIMPORTVDO" >&5
+$as_echo "$LVMIMPORTVDO" >&6; }
################################################################################
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to install blkdeactivate" >&5
@@ -14048,10 +14048,10 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
-VDOIMPORT_PATH="$SBINDIR/lvm_import_vdo"
+LVMIMPORTVDO_PATH="$SBINDIR/lvm_import_vdo"
cat >>confdefs.h <<_ACEOF
-#define VDOIMPORT_PATH "$VDOIMPORT_PATH"
+#define LVMIMPORTVDO_PATH "$LVMIMPORTVDO_PATH"
_ACEOF
diff --git a/configure.ac b/configure.ac
index 922a21265..a821edf2a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -46,7 +46,7 @@ case "$host_os" in
DM_IOCTLS=yes
SELINUX=yes
FSADM=yes
- VDOIMPORT=yes
+ LVMIMPORTVDO=yes
BLKDEACTIVATE=yes
;;
darwin*)
@@ -60,7 +60,7 @@ case "$host_os" in
DM_IOCTLS=no
SELINUX=no
FSADM=no
- VDOIMPORT=no
+ LVMIMPORTVDO=no
BLKDEACTIVATE=no
;;
*)
@@ -1317,9 +1317,9 @@ AC_MSG_RESULT($FSADM)
################################################################################
dnl -- Enable lvm_import_vdo
AC_MSG_CHECKING(whether to install lvm_import_vdo)
-AC_ARG_ENABLE(vdoimport, AC_HELP_STRING([--disable-vdoimport], [disable vdoimport]),
- VDOIMPORT=$enableval)
-AC_MSG_RESULT($VDOIMPORT)
+AC_ARG_ENABLE(lvmimportvdo, AC_HELP_STRING([--disable-lvmimportvdo], [disable lvm_import_vdo]),
+ LVMIMPORTVDO=$enableval)
+AC_MSG_RESULT($LVMIMPORTVDO)
################################################################################
dnl -- Enable blkdeactivate
@@ -1676,8 +1676,8 @@ USRSBINDIR="$(eval echo $(eval echo $usrsbindir))"
FSADM_PATH="$SBINDIR/fsadm"
AC_DEFINE_UNQUOTED(FSADM_PATH, ["$FSADM_PATH"], [Path to fsadm binary.])
-VDOIMPORT_PATH="$SBINDIR/lvm_import_vdo"
-AC_DEFINE_UNQUOTED(VDOIMPORT_PATH, ["$VDOIMPORT_PATH"], [Path to lvm_import_vdo binary.])
+LVMIMPORTVDO_PATH="$SBINDIR/lvm_import_vdo"
+AC_DEFINE_UNQUOTED(LVMIMPORTVDO_PATH, ["$LVMIMPORTVDO_PATH"], [Path to lvm_import_vdo script.])
################################################################################
dnl -- dmeventd pidfile and executable path
@@ -1855,6 +1855,8 @@ AC_SUBST(LVM_PATCHLEVEL)
AC_SUBST(LVM_PATH)
AC_SUBST(LVM_RELEASE)
AC_SUBST(LVM_RELEASE_DATE)
+AC_SUBST(LVMIMPORTVDO)
+AC_SUBST(LVMIMPORTVDO_PATH)
AC_SUBST(localedir)
AC_SUBST(MANGLING)
AC_SUBST(MIRRORS)
@@ -1915,8 +1917,6 @@ AC_SUBST(SILENT_RULES)
AC_SUBST(USRSBINDIR)
AC_SUBST(VALGRIND_POOL)
AC_SUBST(VDO)
-AC_SUBST(VDOIMPORT)
-AC_SUBST(VDOIMPORT_PATH)
AC_SUBST(VDO_FORMAT_CMD)
AC_SUBST(VDO_INCLUDE)
AC_SUBST(VDO_LIB)
diff --git a/include/configure.h.in b/include/configure.h.in
index cf0d7f223..8fb5ca9fe 100644
--- a/include/configure.h.in
+++ b/include/configure.h.in
@@ -571,6 +571,9 @@
/* Path to lvmconfig binary. */
#undef LVMCONFIG_PATH
+/* Path to lvm_import_vdo script. */
+#undef LVMIMPORTVDO_PATH
+
/* Path to lvmlockd pidfile. */
#undef LVMLOCKD_PIDFILE
@@ -687,9 +690,6 @@
/* Enable a valgrind aware build of pool */
#undef VALGRIND_POOL
-/* Path to lvm_import_vdo binary. */
-#undef VDOIMPORT_PATH
-
/* The path to 'vdoformat', if available. */
#undef VDO_FORMAT_CMD
diff --git a/man/Makefile.in b/man/Makefile.in
index 45ebf5446..40248d640 100644
--- a/man/Makefile.in
+++ b/man/Makefile.in
@@ -23,7 +23,7 @@ else
endif
FSADMMAN = fsadm.8
-VDOIMPORTMAN = lvm_import_vdo.8
+LVMIMPORTVDOMAN = lvm_import_vdo.8
BLKDEACTIVATEMAN = blkdeactivate.8
DMEVENTDMAN = dmeventd.8
DMFILEMAPDMAN = dmfilemapd.8
@@ -51,7 +51,7 @@ MAN8SYSTEMD_GENERATORS=lvm2-activation-generator.8
ifeq (,$(findstring $(MAKECMDGOALS), distclean all_man install_all_man))
MAN7 += lvmcache.7 lvmthin.7 lvmvdo.7
- MAN8+=$(FSADMMAN) $(LVMPOLLDMAN) $(LVMLOCKDMAN) $(LVMDBUSDMAN) $(VDOIMPORTMAN)
+ MAN8+=$(FSADMMAN) $(LVMPOLLDMAN) $(LVMLOCKDMAN) $(LVMDBUSDMAN) $(LVMIMPORTVDOMAN)
MAN8DM+=$(BLKDEACTIVATEMAN) $(DMEVENTDMAN) $(DMFILEMAPDMAN)
MAN8CLUSTER+=$(CMIRRORDMAN)
else
@@ -59,8 +59,8 @@ else
MAN8+=$(FSADMMAN)
endif
- ifeq ("@VDOIMPORT@", "yes")
- MAN8+=$(VDOIMPORTMAN)
+ ifeq ("@LVMIMPORTVDO@", "yes")
+ MAN8+=$(LVMIMPORTVDOMAN)
endif
ifeq ("@BUILD_LVMDBUSD@", "yes")
diff --git a/man/lvm_import_vdo.8_main b/man/lvm_import_vdo.8_main
index ee817a0cc..d970eeb40 100644
--- a/man/lvm_import_vdo.8_main
+++ b/man/lvm_import_vdo.8_main
@@ -89,4 +89,3 @@ Defaults to "\fI/dev\fP" and must be an absolute path.
.BR lvm.conf (5),
.P
.BR vdo (8),
-.BR vdo2lvm (8),
diff --git a/scripts/Makefile.in b/scripts/Makefile.in
index f16c37d81..ee0acb6f6 100644
--- a/scripts/Makefile.in
+++ b/scripts/Makefile.in
@@ -1,5 +1,5 @@
#
-# Copyright (C) 2006-2015 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2006-2021 Red Hat, Inc. All rights reserved.
#
# This file is part of LVM2.
#
@@ -31,7 +31,7 @@ ifeq ("@FSADM@", "yes")
LVM_SCRIPTS += fsadm.sh
endif
-ifeq ("@VDOIMPORT@", "yes")
+ifeq ("@LVMIMPORTVDO@", "yes")
LVM_SCRIPTS += lvm_import_vdo.sh
endif
diff --git a/scripts/lvm_import_vdo.sh b/scripts/lvm_import_vdo.sh
index 35140a07c..7e24b49d7 100755
--- a/scripts/lvm_import_vdo.sh
+++ b/scripts/lvm_import_vdo.sh
@@ -14,11 +14,11 @@
#
# Author: Zdenek Kabelac <zkabelac at redhat.com>
#
-# Script for converting VDO volumes to lvm2 VDO LVs
+# Script for importing VDO volumes to lvm2 managed VDO LVs
#
# Needed utilities:
# lvm, dmsetup,
-# vdo, vdo2lvm,
+# vdo,
# grep, awk, sed, blockdev, readlink, mkdir
#
# Conversion is using 'vdo convert' support from VDO manager to move
@@ -305,7 +305,7 @@ EOF
}
# Obtain free space in this new PV
- # after 'vdo convert/vdo2lvm' call there is +2M free space at the front of the device
+ # after 'vdo convert' call there is +2M free space at the front of the device
case "$DRY" in
0) pvfree=$("$LVM" pvs -o devsize --units b --nosuffix --noheadings "$DEVICE") ;;
*) pvfree=$("$BLOCKDEV" --getsize64 "$DEVICE") ;;
2 years, 3 months
main - spec: Rename vdoimport to lvm_import_vdo.
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=49822624e8b02bf108d...
Commit: 49822624e8b02bf108d79ac3ffd58a35c0c92c5e
Parent: bbbd4fed69d88e67678994cb611d082d27bb774b
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Thu Aug 26 16:54:26 2021 +0200
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Thu Aug 26 17:14:08 2021 +0200
spec: Rename vdoimport to lvm_import_vdo.
---
spec/packages.inc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/spec/packages.inc b/spec/packages.inc
index 700e77506..3f6e26d11 100644
--- a/spec/packages.inc
+++ b/spec/packages.inc
@@ -62,7 +62,7 @@ fi
%{_sbindir}/pvs
%{_sbindir}/pvscan
%if %{have_with vdo}
-%{_sbindir}/vdoimport
+%{_sbindir}/lvm_import_vdo
%endif
%{_sbindir}/vgcfgbackup
%{_sbindir}/vgcfgrestore
@@ -126,7 +126,7 @@ fi
%{_mandir}/man8/pvs.8.gz
%{_mandir}/man8/pvscan.8.gz
%if %{have_with vdo}
-%{_mandir}/man8/vdoimport.8.gz
+%{_mandir}/man8/lvm_import_vdo.8.gz
%endif
%{_mandir}/man8/vgcfgbackup.8.gz
%{_mandir}/man8/vgcfgrestore.8.gz
2 years, 3 months
main - vdo: Rename vdoimport to lvm_import_vdo.
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=bbbd4fed69d88e67678...
Commit: bbbd4fed69d88e67678994cb611d082d27bb774b
Parent: 0969e90d45932d2903d2822701b32edfb2cf31cf
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Thu Aug 26 16:53:33 2021 +0200
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Thu Aug 26 17:13:59 2021 +0200
vdo: Rename vdoimport to lvm_import_vdo.
---
WHATS_NEW | 1 +
configure | 6 +++---
configure.ac | 8 ++++----
include/configure.h.in | 2 +-
man/Makefile.in | 2 +-
man/{vdoimport.8_main => lvm_import_vdo.8_main} | 8 ++++----
scripts/Makefile.in | 2 +-
scripts/{vdoimport.sh => lvm_import_vdo.sh} | 2 +-
test/Makefile.in | 2 +-
test/shell/vdo-convert.sh | 12 ++++++------
10 files changed, 23 insertions(+), 22 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 09ee395b5..ea434e2c6 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.03.14 -
==================================
+ Rename vdoimport to lvm_import_vdo.
Version 2.03.13 - 11th August 2021
==================================
diff --git a/configure b/configure
index c2d2cff5b..cd94cbca2 100755
--- a/configure
+++ b/configure
@@ -12552,8 +12552,8 @@ $as_echo "$FSADM" >&6; }
################################################################################
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to install vdoimport" >&5
-$as_echo_n "checking whether to install vdoimport... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to install lvm_import_vdo" >&5
+$as_echo_n "checking whether to install lvm_import_vdo... " >&6; }
# Check whether --enable-vdoimport was given.
if test "${enable_vdoimport+set}" = set; then :
enableval=$enable_vdoimport; VDOIMPORT=$enableval
@@ -14048,7 +14048,7 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
-VDOIMPORT_PATH="$SBINDIR/vdoimport"
+VDOIMPORT_PATH="$SBINDIR/lvm_import_vdo"
cat >>confdefs.h <<_ACEOF
#define VDOIMPORT_PATH "$VDOIMPORT_PATH"
diff --git a/configure.ac b/configure.ac
index a20633e21..922a21265 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1315,8 +1315,8 @@ AC_MSG_RESULT($FSADM)
################################################################################
-dnl -- Enable vdoimport
-AC_MSG_CHECKING(whether to install vdoimport)
+dnl -- Enable lvm_import_vdo
+AC_MSG_CHECKING(whether to install lvm_import_vdo)
AC_ARG_ENABLE(vdoimport, AC_HELP_STRING([--disable-vdoimport], [disable vdoimport]),
VDOIMPORT=$enableval)
AC_MSG_RESULT($VDOIMPORT)
@@ -1676,8 +1676,8 @@ USRSBINDIR="$(eval echo $(eval echo $usrsbindir))"
FSADM_PATH="$SBINDIR/fsadm"
AC_DEFINE_UNQUOTED(FSADM_PATH, ["$FSADM_PATH"], [Path to fsadm binary.])
-VDOIMPORT_PATH="$SBINDIR/vdoimport"
-AC_DEFINE_UNQUOTED(VDOIMPORT_PATH, ["$VDOIMPORT_PATH"], [Path to vdoimport binary.])
+VDOIMPORT_PATH="$SBINDIR/lvm_import_vdo"
+AC_DEFINE_UNQUOTED(VDOIMPORT_PATH, ["$VDOIMPORT_PATH"], [Path to lvm_import_vdo binary.])
################################################################################
dnl -- dmeventd pidfile and executable path
diff --git a/include/configure.h.in b/include/configure.h.in
index 55d18bd4f..cf0d7f223 100644
--- a/include/configure.h.in
+++ b/include/configure.h.in
@@ -687,7 +687,7 @@
/* Enable a valgrind aware build of pool */
#undef VALGRIND_POOL
-/* Path to vdoimport binary. */
+/* Path to lvm_import_vdo binary. */
#undef VDOIMPORT_PATH
/* The path to 'vdoformat', if available. */
diff --git a/man/Makefile.in b/man/Makefile.in
index d60a92cde..45ebf5446 100644
--- a/man/Makefile.in
+++ b/man/Makefile.in
@@ -23,7 +23,7 @@ else
endif
FSADMMAN = fsadm.8
-VDOIMPORTMAN = vdoimport.8
+VDOIMPORTMAN = lvm_import_vdo.8
BLKDEACTIVATEMAN = blkdeactivate.8
DMEVENTDMAN = dmeventd.8
DMFILEMAPDMAN = dmfilemapd.8
diff --git a/man/vdoimport.8_main b/man/lvm_import_vdo.8_main
similarity index 88%
rename from man/vdoimport.8_main
rename to man/lvm_import_vdo.8_main
index 1f329099c..ee817a0cc 100644
--- a/man/vdoimport.8_main
+++ b/man/lvm_import_vdo.8_main
@@ -2,14 +2,14 @@
.
.SH "NAME"
.
-vdoimport \(em utility to import VDO volumes into a new volume group.
+lvm_import_vdo \(em utility to import VDO volumes into a new volume group.
.
.SH SYNOPSIS
.
.PD 0
.ad l
.TP 10
-.B vdoimport
+.B lvm_import_vdo
.RI [ options ]
.IR device
.
@@ -17,7 +17,7 @@ vdoimport \(em utility to import VDO volumes into a new volume group.
.
.SH DESCRIPTION
.
-vdoimport utility imports VDO volumes created and managed by
+lvm_import_vdo utility imports VDO volumes created and managed by
.BR vdo (8)
manager into
.BR lvm2 (8)
@@ -69,7 +69,7 @@ A status code of 1 is used for failure.
Convert VDO volume created by vdo manager into logical volume LV1 with within volume group VG1.
.P
#
-.B vdoimport --name VG1/LV1 /dev/mapper/vdo-volume
+.B lvm_import_vdo --name VG1/LV1 /dev/mapper/vdo-volume
.
.SH ENVIRONMENT VARIABLES
.
diff --git a/scripts/Makefile.in b/scripts/Makefile.in
index 1fe88ca90..f16c37d81 100644
--- a/scripts/Makefile.in
+++ b/scripts/Makefile.in
@@ -32,7 +32,7 @@ ifeq ("@FSADM@", "yes")
endif
ifeq ("@VDOIMPORT@", "yes")
- LVM_SCRIPTS += vdoimport.sh
+ LVM_SCRIPTS += lvm_import_vdo.sh
endif
ifeq ("@BLKDEACTIVATE@", "yes")
diff --git a/scripts/vdoimport.sh b/scripts/lvm_import_vdo.sh
similarity index 99%
rename from scripts/vdoimport.sh
rename to scripts/lvm_import_vdo.sh
index ef9659103..35140a07c 100755
--- a/scripts/vdoimport.sh
+++ b/scripts/lvm_import_vdo.sh
@@ -28,7 +28,7 @@
set -euE -o pipefail
-TOOL=vdoimport
+TOOL=lvm_import_vdo
_SAVEPATH=$PATH
PATH="/sbin:/usr/sbin:/bin:/usr/sbin:$PATH"
diff --git a/test/Makefile.in b/test/Makefile.in
index 093054087..ecb9e4264 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -368,7 +368,7 @@ LIB = $(addprefix lib/, $(LIB_SECURETEST) $(LIB_DMSECURETEST) $(LIB_SHARED) $(LI
$(Q) $(LN_S) -f $(abs_top_srcdir)/conf/lvmdbusd.profile lib/
$(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/vdoimport.sh lib/vdoimport
+ $(Q) $(LN_S) -f $(abs_top_srcdir)/scripts/lvm_import_vdo.sh lib/lvm_import_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/shell/vdo-convert.sh b/test/shell/vdo-convert.sh
index 538147b8d..2d16c973f 100644
--- a/test/shell/vdo-convert.sh
+++ b/test/shell/vdo-convert.sh
@@ -54,12 +54,12 @@ vdo create $VDOCONF --name "$VDONAME" --device="$DM_DEV_DIR/$vg/$lv1" --vdoLogic
mkfs -E nodiscard "$DM_DEV_DIR/mapper/$VDONAME"
# Different VG name fails
-not vdoimport -y -v --name $vg1/$lv1 "$DM_DEV_DIR/$vg/$lv1"
+not lvm_import_vdo -y -v --name $vg1/$lv1 "$DM_DEV_DIR/$vg/$lv1"
# Try just dry run and observe logging
-vdoimport --dry-run -y -v --name $lv1 "$DM_DEV_DIR/$vg/$lv1"
+lvm_import_vdo --dry-run -y -v --name $lv1 "$DM_DEV_DIR/$vg/$lv1"
-vdoimport -y --name $lv1 "$DM_DEV_DIR/$vg/$lv1"
+lvm_import_vdo -y --name $lv1 "$DM_DEV_DIR/$vg/$lv1"
# ATM needed - since we do not call 'vdo convert' in this case
vdo remove $VDOCONF --force --name "$VDONAME" || true
@@ -79,13 +79,13 @@ vdo create $VDOCONF --name "$VDONAME" --device="$dev1" --vdoLogicalSize=31G
mkfs -E nodiscard "$DM_DEV_DIR/mapper/$VDONAME"
# Fail with an already existing volume group $vg2
-not vdoimport --dry-run -y -v --name $vg2/$lv1 "$dev1" |& tee err
+not lvm_import_vdo --dry-run -y -v --name $vg2/$lv1 "$dev1" |& tee err
grep "already existing volume group" err
# User can also convert already stopped VDO volume
vdo stop $VDOCONF --name "$VDONAME"
-vdoimport -y -v --name $vg/$lv1 "$dev1"
+lvm_import_vdo -y -v --name $vg/$lv1 "$dev1"
fsck -n "$DM_DEV_DIR/$vg/$lv1"
@@ -102,7 +102,7 @@ vdo create $VDOCONF --name "$VDONAME" --device="$dev1" --vdoLogicalSize=23G
mkfs -E nodiscard "$DM_DEV_DIR/mapper/$VDONAME"
-vdoimport -y -v --name $vg1/$lv2 "$dev1"
+lvm_import_vdo -y -v --name $vg1/$lv2 "$dev1"
fsck -n "$DM_DEV_DIR/$vg1/$lv2"
2 years, 3 months
main - devices: restrict device id types to specific major numbers
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0969e90d45932d2903d...
Commit: 0969e90d45932d2903d2822701b32edfb2cf31cf
Parent: a6a8443a07f891246fa68bda9cc8e3937b6ddbb6
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Aug 23 15:01:26 2021 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Aug 23 15:54:41 2021 -0500
devices: restrict device id types to specific major numbers
Some device id types can only be used with specific device major
numbers, so use this restriction to avoid some comparisions.
This is more efficient, and can avoid some incorrect matches.
---
lib/device/device_id.c | 53 +++++++++++++++++++++++++++++++++++++++++++++----
test/shell/lvm-on-md.sh | 21 +++++++++++++++-----
2 files changed, 65 insertions(+), 9 deletions(-)
diff --git a/lib/device/device_id.c b/lib/device/device_id.c
index 391309ccd..649c4bba9 100644
--- a/lib/device/device_id.c
+++ b/lib/device/device_id.c
@@ -321,17 +321,24 @@ const char *device_id_system_read(struct cmd_context *cmd, struct device *dev, u
else if (idtype == DEV_ID_TYPE_SYS_SERIAL)
read_sys_block(cmd, dev, "device/serial", sysbuf, sizeof(sysbuf));
- else if (idtype == DEV_ID_TYPE_MPATH_UUID)
+ else if (idtype == DEV_ID_TYPE_MPATH_UUID) {
read_sys_block(cmd, dev, "dm/uuid", sysbuf, sizeof(sysbuf));
+ /* if (strncmp(sysbuf, "mpath", 5)) sysbuf[0] = '\0'; */
+ }
- else if (idtype == DEV_ID_TYPE_CRYPT_UUID)
+ else if (idtype == DEV_ID_TYPE_CRYPT_UUID) {
read_sys_block(cmd, dev, "dm/uuid", sysbuf, sizeof(sysbuf));
+ /* if (strncmp(sysbuf, "CRYPT", 5)) sysbuf[0] = '\0'; */
+ }
- else if (idtype == DEV_ID_TYPE_LVMLV_UUID)
+ else if (idtype == DEV_ID_TYPE_LVMLV_UUID) {
read_sys_block(cmd, dev, "dm/uuid", sysbuf, sizeof(sysbuf));
+ /* if (strncmp(sysbuf, "LVM", 3)) sysbuf[0] = '\0'; */
+ }
- else if (idtype == DEV_ID_TYPE_MD_UUID)
+ else if (idtype == DEV_ID_TYPE_MD_UUID) {
read_sys_block(cmd, dev, "md/uuid", sysbuf, sizeof(sysbuf));
+ }
else if (idtype == DEV_ID_TYPE_LOOP_FILE) {
read_sys_block(cmd, dev, "loop/backing_file", sysbuf, sizeof(sysbuf));
@@ -1292,6 +1299,36 @@ void device_id_pvremove(struct cmd_context *cmd, struct device *dev)
}
}
+static int _idtype_compatible_with_major_number(struct cmd_context *cmd, int idtype, int major)
+{
+ if (idtype == DEV_ID_TYPE_MPATH_UUID ||
+ idtype == DEV_ID_TYPE_CRYPT_UUID ||
+ idtype == DEV_ID_TYPE_LVMLV_UUID)
+ return (major == cmd->dev_types->device_mapper_major);
+
+ if (idtype == DEV_ID_TYPE_MD_UUID)
+ return (major == cmd->dev_types->md_major);
+
+ if (idtype == DEV_ID_TYPE_LOOP_FILE)
+ return (major == cmd->dev_types->loop_major);
+
+ if (major == cmd->dev_types->device_mapper_major)
+ return (idtype == DEV_ID_TYPE_MPATH_UUID ||
+ idtype == DEV_ID_TYPE_CRYPT_UUID ||
+ idtype == DEV_ID_TYPE_LVMLV_UUID ||
+ idtype == DEV_ID_TYPE_DEVNAME);
+
+ if (major == cmd->dev_types->md_major)
+ return (idtype == DEV_ID_TYPE_MD_UUID ||
+ idtype == DEV_ID_TYPE_DEVNAME);
+
+ if (major == cmd->dev_types->loop_major)
+ return (idtype == DEV_ID_TYPE_LOOP_FILE ||
+ idtype == DEV_ID_TYPE_DEVNAME);
+
+ return 1;
+}
+
/*
* check for dev->ids entry with du->idtype, if found compare it,
* if not, system_read of this type and add entry to dev->ids, compare it.
@@ -1307,6 +1344,14 @@ static int _match_du_to_dev(struct cmd_context *cmd, struct dev_use *du, struct
if (!du->idname || !du->idtype)
return 0;
+ /*
+ * Some idtypes can only match devices with a specific major number,
+ * so we can skip trying to match certain du entries based simply on
+ * the major number of dev.
+ */
+ if (!_idtype_compatible_with_major_number(cmd, du->idtype, (int)MAJOR(dev->dev)))
+ return 0;
+
if (!dev_get_partition_number(dev, &part)) {
log_debug("compare %s failed to get dev partition", dev_name(dev));
return 0;
diff --git a/test/shell/lvm-on-md.sh b/test/shell/lvm-on-md.sh
index d2810b8cf..f932ca623 100644
--- a/test/shell/lvm-on-md.sh
+++ b/test/shell/lvm-on-md.sh
@@ -13,19 +13,23 @@
SKIP_WITH_LVMPOLLD=1
SKIP_WITH_LVMLOCKD=1
+. lib/inittest
+
RUNDIR="/run"
test -d "$RUNDIR" || RUNDIR="/var/run"
PVS_ONLINE_DIR="$RUNDIR/lvm/pvs_online"
VGS_ONLINE_DIR="$RUNDIR/lvm/vgs_online"
HINTS="$RUNDIR/lvm/hints"
+DFDIR="$LVM_SYSTEM_DIR/devices"
+DF="$DFDIR/system.devices"
+
_clear_online_files() {
# wait till udev is finished
aux udev_wait
rm -f "$PVS_ONLINE_DIR"/* "$VGS_ONLINE_DIR"/*
}
-. lib/inittest
# This stops lvm from taking advantage of hints which
# will have already excluded md components.
@@ -35,7 +39,8 @@ _clear_online_files() {
# want to rely on that ability in this test.
aux lvmconf "devices/md_component_detection = 1" \
"devices/hints = \"none\"" \
- "devices/obtain_device_list_from_udev = 0"
+ "devices/obtain_device_list_from_udev = 0" \
+ "devices/search_for_devnames = \"none\""
aux extend_filter_md "a|/dev/md|"
@@ -54,6 +59,9 @@ mddev=$(< MD_DEV)
vgcreate $vg "$mddev"
+lvmdevices || true
+pvs -o+deviceidtype,deviceid
+
PVIDMD=$(get pv_field "$mddev" uuid | tr -d - )
lvcreate -n $lv1 -l 2 $vg
@@ -158,7 +166,10 @@ done
# Repeat tests using the default config settings
aux lvmconf "devices/hints = \"all\"" \
- "devices/obtain_device_list_from_udev = 1"
+ "devices/obtain_device_list_from_udev = 1" \
+ "devices/search_for_devnames = \"none\""
+
+rm $DF || true
# create 2 disk MD raid0 array
# by default using metadata format 1.0 with data at the end of device
@@ -216,7 +227,7 @@ aux udev_wait
# duplicate PVs which are eventually recognized as md components
# and dropped.
pvs 2>&1|tee out1
-grep -v WARNING out1 > out2
+grep -v -e WARNING -e "Devices file PVID" out1 > out2
not grep "Not using device" out2
not grep "$mddev" out2
not grep "$dev1" out2
@@ -225,7 +236,7 @@ grep "$dev3" out2
cat "$HINTS"
pvs 2>&1|tee out1
-grep -v WARNING out1 > out2
+grep -v -e WARNING -e "Devices file PVID" out1 > out2
not grep "Not using device" out2
not grep "$mddev" out2
not grep "$dev1" out2
2 years, 3 months