diff --git a/SOURCES/lvm2-2_03_13-device_id-handle-scsi_debug-wwid.patch b/SOURCES/lvm2-2_03_13-device_id-handle-scsi_debug-wwid.patch new file mode 100644 index 0000000..84cc940 --- /dev/null +++ b/SOURCES/lvm2-2_03_13-device_id-handle-scsi_debug-wwid.patch @@ -0,0 +1,18 @@ + lib/device/device_id.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/lib/device/device_id.c b/lib/device/device_id.c +index f158e4f..9cc82f1 100644 +--- a/lib/device/device_id.c ++++ b/lib/device/device_id.c +@@ -308,6 +308,10 @@ const char *device_id_system_read(struct cmd_context *cmd, struct device *dev, u + + if (!sysbuf[0]) + _read_sys_block(cmd, dev, "wwid", sysbuf, sizeof(sysbuf)); ++ ++ /* scsi_debug wwid begins "t10.Linux scsi_debug ..." */ ++ if (strstr(sysbuf, "scsi_debug")) ++ sysbuf[0] = '\0'; + } + + else if (idtype == DEV_ID_TYPE_SYS_SERIAL) diff --git a/SOURCES/lvm2-2_03_13-devices-don-t-use-deleted-loop-backing-file-for-devi.patch b/SOURCES/lvm2-2_03_13-devices-don-t-use-deleted-loop-backing-file-for-devi.patch new file mode 100644 index 0000000..6de11be --- /dev/null +++ b/SOURCES/lvm2-2_03_13-devices-don-t-use-deleted-loop-backing-file-for-devi.patch @@ -0,0 +1,21 @@ + lib/device/device_id.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/lib/device/device_id.c b/lib/device/device_id.c +index 67f72e5..1b98487 100644 +--- a/lib/device/device_id.c ++++ b/lib/device/device_id.c +@@ -325,8 +325,12 @@ const char *device_id_system_read(struct cmd_context *cmd, struct device *dev, u + 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) ++ else if (idtype == DEV_ID_TYPE_LOOP_FILE) { + _read_sys_block(cmd, dev, "loop/backing_file", sysbuf, sizeof(sysbuf)); ++ /* if backing file is deleted, fall back to devname */ ++ if (strstr(sysbuf, "(deleted)")) ++ sysbuf[0] = '\0'; ++ } + + else if (idtype == DEV_ID_TYPE_DEVNAME) { + if (!(idname = strdup(dev_name(dev)))) diff --git a/SOURCES/lvm2-2_03_13-lvconvert-allow-writecache-with-other-thinpool-comma.patch b/SOURCES/lvm2-2_03_13-lvconvert-allow-writecache-with-other-thinpool-comma.patch new file mode 100644 index 0000000..2875b22 --- /dev/null +++ b/SOURCES/lvm2-2_03_13-lvconvert-allow-writecache-with-other-thinpool-comma.patch @@ -0,0 +1,16 @@ + tools/lvconvert.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/lvconvert.c b/tools/lvconvert.c +index 8dd8a15..6066d1f 100644 +--- a/tools/lvconvert.c ++++ b/tools/lvconvert.c +@@ -4803,7 +4803,7 @@ static int _lvconvert_to_pool_or_swap_metadata_single(struct cmd_context *cmd, + + switch (cmd->command->command_enum) { + case lvconvert_to_thinpool_or_swap_metadata_CMD: +- if (lv_is_cache(lv)) ++ if (lv_is_cache(lv) || lv_is_writecache(lv)) + /* For cached LV check the cache origin LV type */ + lvt_enum = get_lvt_enum(seg_lv(first_seg(lv), 0)); + to_thinpool = 1; diff --git a/SOURCES/lvm2-2_03_13-lvconvert-fix-vdo-virtual-size-when-specified.patch b/SOURCES/lvm2-2_03_13-lvconvert-fix-vdo-virtual-size-when-specified.patch new file mode 100644 index 0000000..7758cca --- /dev/null +++ b/SOURCES/lvm2-2_03_13-lvconvert-fix-vdo-virtual-size-when-specified.patch @@ -0,0 +1,17 @@ + lib/metadata/vdo_manip.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/lib/metadata/vdo_manip.c b/lib/metadata/vdo_manip.c +index 7d5a2cb..afc513a 100644 +--- a/lib/metadata/vdo_manip.c ++++ b/lib/metadata/vdo_manip.c +@@ -393,7 +393,8 @@ struct logical_volume *convert_vdo_pool_lv(struct logical_volume *data_lv, + } else { + log_verbose("Skiping VDO formating %s.", display_lvname(data_lv)); + /* TODO: parse existing VDO data and retrieve vdo_logical_size */ +- vdo_logical_size = data_lv->size; ++ if (!*virtual_extents) ++ vdo_logical_size = data_lv->size; + } + + if (!deactivate_lv(data_lv->vg->cmd, data_lv)) { diff --git a/SOURCES/lvm2-2_03_13-lvmdevices-add-deviceidtype-option.patch b/SOURCES/lvm2-2_03_13-lvmdevices-add-deviceidtype-option.patch new file mode 100644 index 0000000..6d4e6bf --- /dev/null +++ b/SOURCES/lvm2-2_03_13-lvmdevices-add-deviceidtype-option.patch @@ -0,0 +1,211 @@ + lib/device/device_id.c | 32 ++++++++++++++---------- + man/lvmdevices.8_des | 68 +++++++++++++++++++++++++++++++++++++++----------- + tools/args.h | 5 ++++ + tools/command-lines.in | 1 + + tools/lvmdevices.c | 7 ++++-- + 5 files changed, 84 insertions(+), 29 deletions(-) + +diff --git a/lib/device/device_id.c b/lib/device/device_id.c +index 1b98487..f158e4f 100644 +--- a/lib/device/device_id.c ++++ b/lib/device/device_id.c +@@ -931,6 +931,7 @@ int device_id_add(struct cmd_context *cmd, struct device *dev, const char *pvid_ + /* + * Choose the device_id type for the device being added. + * ++ * 0. use an idtype specified by the user + * 1. use an idtype specific to a special/virtual device type + * e.g. loop, mpath, crypt, lvmlv, md, etc. + * 2. use an idtype specified by user option. +@@ -939,6 +940,24 @@ int device_id_add(struct cmd_context *cmd, struct device *dev, const char *pvid_ + * 5. use devname as the last resort. + */ + ++ if (idtype_arg) { ++ if (!(idtype = idtype_from_str(idtype_arg))) ++ log_warn("WARNING: ignoring unknown device_id type %s.", idtype_arg); ++ else { ++ if (id_arg) { ++ if ((idname = strdup(id_arg))) ++ goto id_done; ++ log_warn("WARNING: ignoring device_id name %s.", id_arg); ++ } ++ ++ if ((idname = device_id_system_read(cmd, dev, idtype))) ++ goto id_done; ++ ++ log_warn("WARNING: ignoring deviceidtype %s which is not available for device.", idtype_arg); ++ idtype = 0; ++ } ++ } ++ + if (MAJOR(dev->dev) == cmd->dev_types->device_mapper_major) { + if (_dev_has_mpath_uuid(cmd, dev, &idname)) { + idtype = DEV_ID_TYPE_MPATH_UUID; +@@ -972,19 +991,6 @@ int device_id_add(struct cmd_context *cmd, struct device *dev, const char *pvid_ + log_warn("Missing support for DRBD idtype"); + } + +- if (idtype_arg) { +- if (!(idtype = idtype_from_str(idtype_arg))) +- log_warn("WARNING: ignoring unknown device_id type %s.", idtype_arg); +- else { +- if (id_arg) { +- if (!(idname = strdup(id_arg))) +- stack; +- goto id_done; +- } +- goto id_name; +- } +- } +- + /* + * No device-specific, existing, or user-specified idtypes, + * so use first available of sys_wwid / sys_serial / devname. +diff --git a/man/lvmdevices.8_des b/man/lvmdevices.8_des +index 015aa11..2335456 100644 +--- a/man/lvmdevices.8_des ++++ b/man/lvmdevices.8_des +@@ -9,18 +9,18 @@ remove it from the devices file with lvmdevices --deldev. The + vgimportdevices(8) command adds all PVs from a VG to the devices file, + and updates the VG metadata to include device IDs of the PVs. + .P +-Commands adding new devices to the devices file necessarily look outside +-the existing devices file to find the devices to add. pvcreate, vgcreate, +-and vgextend also look outside the devices file to create new PVs and add +-them to the devices file. ++Commands that add new devices to the devices file necessarily look outside ++the existing devices file to find the devices being added. pvcreate, ++vgcreate, and vgextend also look outside the devices file to create new ++PVs and add those PVs to the devices file. + .P + LVM records devices in the devices file using hardware-specific IDs, such + as the WWID, and attempts to use subsystem-specific IDs for virtual device +-types (which also aim to be as unique and stable as possible.) +-These device IDs are also written in the VG metadata. When no hardware or ++types (which also aim to be as unique and stable as possible.) These ++device IDs are also written in the VG metadata. When no hardware or + virtual ID is available, lvm falls back using the unstable device name as +-the device ID. When devnames are used, lvm performs extra scanning to +-find devices if their devname changes, e.g. after reboot. ++the device ID. When devnames are used as IDs, lvm performs extra scanning ++to find devices if their devname changes, e.g. after reboot. + .P + When proper device IDs are used, an lvm command will not look at devices + outside the devices file, but when devnames are used as a fallback, lvm +@@ -34,12 +34,13 @@ overriding the devices file. The listed devices act as a sort of devices + file in terms of limiting which devices lvm will see and use. Devices + that are not listed will appear to be missing to the lvm command. + .P +-Multiple devices files can be kept in \fI#DEFAULT_SYS_DIR#/devices\fP, which allows lvm +-to be used with different sets of devices, e.g. system devices do not need +-to be exposed to a specific application, and the application can use lvm on +-its own devices that are not exposed to the system. The option +---devicesfile is used to select the devices file to use with the +-command. Without the option set, the default system devices file is used. ++Multiple devices files can be kept \fI#DEFAULT_SYS_DIR#/devices\fP, which ++allows lvm to be used with different sets of devices. For example, system ++devices do not need to be exposed to a specific application, and the ++application can use lvm on its own devices that are not exposed to the ++system. The option --devicesfile is used to select the devices ++file to use with the command. Without the option set, the default system ++devices file is used. + .P + Setting --devicesfile "" causes lvm to not use a devices file. + .P +@@ -59,3 +60,42 @@ if it does not yet exist. + .P + It is recommended to use lvm commands to make changes to the devices file to + ensure proper updates. ++.P ++The device ID and device ID type are included in the VG metadata and can ++be reported with pvs -o deviceid,deviceidtype. (Note that the lvmdevices ++command does not update VG metadata, but subsequent lvm commands modifying ++the metadata will include the device ID.) ++.P ++Possible device ID types are: ++.br ++.IP \[bu] 2 ++.B sys_wwid ++uses the wwid reported by sysfs. This is the first choice for non-virtual ++devices. ++.IP \[bu] 2 ++.B sys_serial ++uses the serial number reported by sysfs. This is the second choice for ++non-virtual devices. ++.IP \[bu] 2 ++.B mpath_uuid ++is used for dm multipath devices, reported by sysfs. ++.IP \[bu] 2 ++.B crypt_uuid ++is used for dm crypt devices, reported by sysfs. ++.IP \[bu] 2 ++.B md_uuid ++is used for md devices, reported by sysfs. ++.B lvmlv_uuid ++is used if a PV is placed on top of an lvm LV, reported by sysfs. ++.IP \[bu] 2 ++.B loop_file ++is used for loop devices, the backing file name repored by sysfs. ++.IP \[bu] 2 ++.B devname ++the device name is used if no other type applies. ++.P ++ ++The default choice for device ID type can be overriden using lvmdevices ++--addev --deviceidtype . If the specified type is available for the ++device it will be used, otherwise the device will be added using the type ++that would otherwise be chosen. +diff --git a/tools/args.h b/tools/args.h +index 741c82b..d4f23f8 100644 +--- a/tools/args.h ++++ b/tools/args.h +@@ -228,6 +228,11 @@ arg(detachprofile_ARG, '\0', "detachprofile", 0, 0, 0, + "Detaches a metadata profile from a VG or LV.\n" + "See \\fBlvm.conf\\fP(5) for more information about profiles.\n") + ++arg(deviceidtype_ARG, '\0', "deviceidtype", string_VAL, 0, 0, ++ "The type of device ID to use for the device.\n" ++ "If the specified type is available for the device,\n" ++ "then it will override the default type that lvm would use.\n") ++ + arg(devices_ARG, '\0', "devices", pv_VAL, ARG_GROUPABLE, 0, + "Devices that the command can use. This option can be repeated\n" + "or accepts a comma separated list of devices. This overrides\n" +diff --git a/tools/command-lines.in b/tools/command-lines.in +index 67c37ff..8607305 100644 +--- a/tools/command-lines.in ++++ b/tools/command-lines.in +@@ -1430,6 +1430,7 @@ ID: lvmdevices_update + DESC: Update the devices file to fix incorrect values. + + lvmdevices --adddev PV ++OO: --deviceidtype String + ID: lvmdevices_edit + DESC: Add a device to the devices file. + +diff --git a/tools/lvmdevices.c b/tools/lvmdevices.c +index 6b3e056..3448bdd 100644 +--- a/tools/lvmdevices.c ++++ b/tools/lvmdevices.c +@@ -265,6 +265,7 @@ int lvmdevices(struct cmd_context *cmd, int argc, char **argv) + + if (arg_is_set(cmd, adddev_ARG)) { + const char *devname; ++ const char *deviceidtype; + + if (!(devname = arg_str_value(cmd, adddev_ARG, NULL))) + goto_bad; +@@ -311,8 +312,10 @@ int lvmdevices(struct cmd_context *cmd, int argc, char **argv) + dev_name(dev), dev_filtered_reason(dev)); + } + +- /* allow deviceidtype_ARG/deviceid_ARG ? */ +- if (!device_id_add(cmd, dev, dev->pvid, NULL, NULL)) ++ /* also allow deviceid_ARG ? */ ++ deviceidtype = arg_str_value(cmd, deviceidtype_ARG, NULL); ++ ++ if (!device_id_add(cmd, dev, dev->pvid, deviceidtype, NULL)) + goto_bad; + if (!device_ids_write(cmd)) + goto_bad; diff --git a/SOURCES/lvm2-2_03_13-man-vdoimport-page.patch b/SOURCES/lvm2-2_03_13-man-vdoimport-page.patch new file mode 100644 index 0000000..fe6032c --- /dev/null +++ b/SOURCES/lvm2-2_03_13-man-vdoimport-page.patch @@ -0,0 +1,102 @@ + man/vdoimport.8_main | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 92 insertions(+) + create mode 100644 man/vdoimport.8_main + +diff --git a/man/vdoimport.8_main b/man/vdoimport.8_main +new file mode 100644 +index 0000000..1f32909 +--- /dev/null ++++ b/man/vdoimport.8_main +@@ -0,0 +1,92 @@ ++.TH "FSADM" "8" "LVM TOOLS #VERSION#" "Red Hat, Inc" "\"" ++. ++.SH "NAME" ++. ++vdoimport \(em utility to import VDO volumes into a new volume group. ++. ++.SH SYNOPSIS ++. ++.PD 0 ++.ad l ++.TP 10 ++.B vdoimport ++.RI [ options ] ++.IR device ++. ++.PD ++. ++.SH DESCRIPTION ++. ++vdoimport utility imports VDO volumes created and managed by ++.BR vdo (8) ++manager into ++.BR lvm2 (8) ++managed VDO LV. This is realized by moving VDO superblock by 2MiB ++and creating lvm2 metadata at the front of this device. The operation is not reversible, ++thus after conversion to lvm2 the access to VDO data is only possible with ++.BR lvm2 (8) ++commands, ++.BR vdo (8) ++manager no longer control such volume. ++. ++.SH OPTIONS ++. ++.TP ++.BR -f | --force ++Bypass some sanity checks. ++. ++.TP ++.BR -h | --help ++Display the help text. ++. ++.TP ++.BR -n | --name ++Specifies the name of converted VDO LV. When the name is not specified, ++some automatic name is selected. In case the converted VDO volume is ++already using LV a backend device, the name of this LV is used for VDO LV. ++In this case also the of volume group must stay same. ++. ++.TP ++.BR -v | --verbose ++Be more verbose. ++. ++.TP ++.BR -y | --yes ++Answer "yes" at any prompts. ++. ++.TP ++.BR --dry-run ++Print commands without running them. ++. ++. ++.SH DIAGNOSTICS ++. ++On successful completion, the status code is 0. ++A status code of 1 is used for failure. ++. ++.SH EXAMPLES ++. ++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 ++. ++.SH ENVIRONMENT VARIABLES ++. ++.TP ++.B TMPDIR ++The temporary directory name for mount points. Defaults to "\fI/tmp\fP". ++.TP ++.B DM_DEV_DIR ++The device directory name. ++Defaults to "\fI/dev\fP" and must be an absolute path. ++. ++.SH SEE ALSO ++. ++.nh ++.ad l ++.BR lvm (8), ++.BR lvm.conf (5), ++.P ++.BR vdo (8), ++.BR vdo2lvm (8), diff --git a/SOURCES/lvm2-2_03_13-vdo-add-vdoimport-support.patch b/SOURCES/lvm2-2_03_13-vdo-add-vdoimport-support.patch new file mode 100644 index 0000000..aed2254 --- /dev/null +++ b/SOURCES/lvm2-2_03_13-vdo-add-vdoimport-support.patch @@ -0,0 +1,729 @@ + WHATS_NEW | 3 + + configure | 25 +++ + configure.ac | 15 ++ + include/configure.h.in | 3 + + man/Makefile.in | 7 +- + scripts/Makefile.in | 4 + + scripts/vdoimport.sh | 376 ++++++++++++++++++++++++++++++++++++++++++++++ + test/Makefile.in | 1 + + test/shell/vdo-convert.sh | 110 ++++++++++++++ + 9 files changed, 543 insertions(+), 1 deletion(-) + create mode 100755 scripts/vdoimport.sh + create mode 100644 test/shell/vdo-convert.sh + +diff --git a/WHATS_NEW b/WHATS_NEW +index 04c6dcd..5806ecb 100644 +--- a/WHATS_NEW ++++ b/WHATS_NEW +@@ -1,5 +1,8 @@ + Version 2.03.13 - + =============================== ++ Add vdoimport tool to support conversion of VDO volumes. ++ Support configurable allocation/vdo_pool_header_size. ++ Fix handling of lvconvert --type vdo-pool --virtualsize. + Fix load of kvdo target when it is not present in memory (2.03.12). + + Version 2.03.12 - 07th May 2021 +diff --git a/configure b/configure +index 7c6bd48..661702d 100755 +--- a/configure ++++ b/configure +@@ -643,6 +643,8 @@ WRITE_INSTALL + WRITECACHE + VDO_LIB + VDO_INCLUDE ++VDOIMPORT_PATH ++VDOIMPORT + VDO + VALGRIND_POOL + USRSBINDIR +@@ -966,6 +968,7 @@ enable_dbus_service + enable_pkgconfig + enable_write_install + enable_fsadm ++enable_vdoimport + enable_blkdeactivate + enable_dmeventd + enable_selinux +@@ -1701,6 +1704,7 @@ Optional Features: + --enable-pkgconfig install pkgconfig support + --enable-write_install install user writable files + --disable-fsadm disable fsadm ++ --disable-vdoimport disable vdoimport + --disable-blkdeactivate disable blkdeactivate + --enable-dmeventd enable the device-mapper event daemon + --disable-selinux disable selinux support +@@ -3128,6 +3132,7 @@ case "$host_os" in + DM_IOCTLS=yes + SELINUX=yes + FSADM=yes ++ VDOIMPORT=yes + BLKDEACTIVATE=yes + ;; + darwin*) +@@ -3141,6 +3146,7 @@ case "$host_os" in + DM_IOCTLS=no + SELINUX=no + FSADM=no ++ VDOIMPORT=no + BLKDEACTIVATE=no + ;; + *) +@@ -12371,6 +12377,18 @@ fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FSADM" >&5 + $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; } ++# Check whether --enable-vdoimport was given. ++if test "${enable_vdoimport+set}" = set; then : ++ enableval=$enable_vdoimport; VDOIMPORT=$enableval ++fi ++ ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $VDOIMPORT" >&5 ++$as_echo "$VDOIMPORT" >&6; } ++ + ################################################################################ + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to install blkdeactivate" >&5 + $as_echo_n "checking whether to install blkdeactivate... " >&6; } +@@ -13857,6 +13875,13 @@ cat >>confdefs.h <<_ACEOF + _ACEOF + + ++VDOIMPORT_PATH="$SBINDIR/vdoimport" ++ ++cat >>confdefs.h <<_ACEOF ++#define VDOIMPORT_PATH "$VDOIMPORT_PATH" ++_ACEOF ++ ++ + ################################################################################ + if test "$BUILD_DMEVENTD" = yes; then + +diff --git a/configure.ac b/configure.ac +index 1a49e7f..5a8b486 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -45,6 +45,7 @@ case "$host_os" in + DM_IOCTLS=yes + SELINUX=yes + FSADM=yes ++ VDOIMPORT=yes + BLKDEACTIVATE=yes + ;; + darwin*) +@@ -58,6 +59,7 @@ case "$host_os" in + DM_IOCTLS=no + SELINUX=no + FSADM=no ++ VDOIMPORT=no + BLKDEACTIVATE=no + ;; + *) +@@ -1291,6 +1293,14 @@ AC_ARG_ENABLE(fsadm, AC_HELP_STRING([--disable-fsadm], [disable fsadm]), + FSADM=$enableval) + AC_MSG_RESULT($FSADM) + ++ ++################################################################################ ++dnl -- Enable vdoimport ++AC_MSG_CHECKING(whether to install vdoimport) ++AC_ARG_ENABLE(vdoimport, AC_HELP_STRING([--disable-vdoimport], [disable vdoimport]), ++ VDOIMPORT=$enableval) ++AC_MSG_RESULT($VDOIMPORT) ++ + ################################################################################ + dnl -- Enable blkdeactivate + AC_MSG_CHECKING(whether to install blkdeactivate) +@@ -1646,6 +1656,9 @@ 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.]) ++ + ################################################################################ + dnl -- dmeventd pidfile and executable path + if test "$BUILD_DMEVENTD" = yes; then +@@ -1882,6 +1895,8 @@ 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 671d201..6df8d89 100644 +--- a/include/configure.h.in ++++ b/include/configure.h.in +@@ -684,6 +684,9 @@ + /* Enable a valgrind aware build of pool */ + #undef VALGRIND_POOL + ++/* Path to vdoimport 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 29afc77..d60a92c 100644 +--- a/man/Makefile.in ++++ b/man/Makefile.in +@@ -23,6 +23,7 @@ else + endif + + FSADMMAN = fsadm.8 ++VDOIMPORTMAN = vdoimport.8 + BLKDEACTIVATEMAN = blkdeactivate.8 + DMEVENTDMAN = dmeventd.8 + DMFILEMAPDMAN = dmfilemapd.8 +@@ -50,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) ++ MAN8+=$(FSADMMAN) $(LVMPOLLDMAN) $(LVMLOCKDMAN) $(LVMDBUSDMAN) $(VDOIMPORTMAN) + MAN8DM+=$(BLKDEACTIVATEMAN) $(DMEVENTDMAN) $(DMFILEMAPDMAN) + MAN8CLUSTER+=$(CMIRRORDMAN) + else +@@ -58,6 +59,10 @@ else + MAN8+=$(FSADMMAN) + endif + ++ ifeq ("@VDOIMPORT@", "yes") ++ MAN8+=$(VDOIMPORTMAN) ++ endif ++ + ifeq ("@BUILD_LVMDBUSD@", "yes") + MAN8+=$(LVMDBUSDMAN) + endif +diff --git a/scripts/Makefile.in b/scripts/Makefile.in +index e8f6742..1fe88ca 100644 +--- a/scripts/Makefile.in ++++ b/scripts/Makefile.in +@@ -31,6 +31,10 @@ ifeq ("@FSADM@", "yes") + LVM_SCRIPTS += fsadm.sh + endif + ++ifeq ("@VDOIMPORT@", "yes") ++ LVM_SCRIPTS += vdoimport.sh ++endif ++ + ifeq ("@BLKDEACTIVATE@", "yes") + DM_SCRIPTS += blkdeactivate.sh + endif +diff --git a/scripts/vdoimport.sh b/scripts/vdoimport.sh +new file mode 100755 +index 0000000..ef96591 +--- /dev/null ++++ b/scripts/vdoimport.sh +@@ -0,0 +1,376 @@ ++#!/bin/bash ++# ++# Copyright (C) 2021 Red Hat, Inc. All rights reserved. ++# ++# This file is part of LVM2. ++# ++# This copyrighted material is made available to anyone wishing to use, ++# modify, copy, or redistribute it subject to the terms and conditions ++# of the GNU General Public License v.2. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software Foundation, ++# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++# ++# Author: Zdenek Kabelac ++# ++# Script for converting VDO volumes to lvm2 VDO LVs ++# ++# Needed utilities: ++# lvm, dmsetup, ++# vdo, vdo2lvm, ++# grep, awk, sed, blockdev, readlink, mkdir ++# ++# Conversion is using 'vdo convert' support from VDO manager to move ++# existing VDO header by 2M which makes space to place in PV header ++# and VG metadata area, and then create VDOPOOL LV and VDO LV in such VG. ++# ++ ++set -euE -o pipefail ++ ++TOOL=vdoimport ++ ++_SAVEPATH=$PATH ++PATH="/sbin:/usr/sbin:/bin:/usr/sbin:$PATH" ++ ++# user may override lvm location by setting LVM_BINARY ++LVM=${LVM_BINARY:-lvm} ++VDO=${VDO_BINARY:-vdo} ++VDOCONF=${VDOCONF:-} ++BLOCKDEV="blockdev" ++READLINK="readlink" ++READLINK_E="-e" ++MKDIR="mkdir" ++ ++TEMPDIR="${TMPDIR:-/tmp}/${TOOL}_${RANDOM}$$" ++DM_DEV_DIR="${DM_DEV_DIR:-/dev}" ++ ++DRY=0 ++VERB="" ++FORCE="" ++YES="" ++ ++# default name for converted VG and its VDO LV ++NAME="vdovg/vdolvol" ++ ++# help message ++tool_usage() { ++ echo "${TOOL}: Utility to convert VDO volume to VDO LV." ++ echo ++ echo " ${TOOL} [options] " ++ echo ++ echo " Options:" ++ echo " -f | --force Bypass sanity checks" ++ echo " -h | --help Show this help message" ++ echo " -n | --name Specifies VG/LV name for converted VDO volume" ++ echo " -v | --verbose Be verbose" ++ echo " -y | --yes Answer \"yes\" at any prompts" ++ echo " --dry-run Print commands without running them" ++ ++ exit ++} ++ ++verbose() { ++ test -z "$VERB" || echo "$TOOL:" "$@" ++} ++ ++# Support multi-line error messages ++error() { ++ for i in "$@" ; do ++ echo "$TOOL: $i" >&2 ++ done ++ cleanup 1 ++} ++ ++dry() { ++ if [ "$DRY" -ne 0 ]; then ++ verbose "Dry execution" "$@" ++ return 0 ++ fi ++ verbose "Executing" "$@" ++ "$@" ++} ++ ++cleanup() { ++ trap '' 2 ++ ++ rm -rf "$TEMPDIR" ++ # error exit status for break ++ exit "${1:-1}" ++} ++ ++get_enabled_value_() { ++ case "$1" in ++ enabled) echo "1" ;; ++ *) echo "0" ;; ++ esac ++} ++ ++get_kb_size_with_unit_() { ++ case "$1" in ++ *[kK]) echo $(( ${1%[kK]} )) ;; ++ *[mM]) echo $(( ${1%[mM]} * 1024 )) ;; ++ *[gG]) echo $(( ${1%[gG]} * 1024 * 1024 )) ;; ++ *[tT]) echo $(( ${1%[tT]} * 1024 * 1024 * 1024 )) ;; ++ *[pP]) echo $(( ${1%[pP]} * 1024 * 1024 * 1024 * 1024 )) ;; ++ esac ++} ++ ++get_mb_size_with_unit_() { ++ case "$1" in ++ *[mM]) echo $(( ${1%[mM]} )) ;; ++ *[gG]) echo $(( ${1%[gG]} * 1024 )) ;; ++ *[tT]) echo $(( ${1%[tT]} * 1024 * 1024 )) ;; ++ *[pP]) echo $(( ${1%[pP]} * 1024 * 1024 * 1024 )) ;; ++ esac ++} ++ ++# Figure out largest possible extent size usable for VG ++# $1 physical size ++# $2 logical size ++get_largest_extent_size_() { ++ local max=4 ++ local i ++ local d ++ ++ for i in 8 16 32 64 128 256 512 1024 2048 4096 ; do ++ d=$(( $1 / i )) ++ test $(( d * i )) -eq "$1" || break ++ d=$(( $2 / i )) ++ test $(( d * i )) -eq "$2" || break ++ max=$i ++ done ++ echo "$max" ++} ++ ++# detect LV on the given device ++# dereference device name if it is symbolic link ++detect_lv_() { ++ local DEVICE=$1 ++ local MAJOR ++ local MINOR ++ local SYSVOLUME ++ local MAJORMINOR ++ ++ DEVICE=${1/#"${DM_DEV_DIR}/"/} ++ DEVICE=$("$READLINK" $READLINK_E "$DM_DEV_DIR/$DEVICE") ++ test -n "$DEVICE" || error "Cannot get readlink \"$1\"." ++ RDEVICE=$DEVICE ++ case "$RDEVICE" in ++ # hardcoded /dev since udev does not create these entries elsewhere ++ /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##*:} ++ ;; ++ *) ++ STAT=$(stat --format "MAJOR=\$((0x%t)) MINOR=\$((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 ' ')" ++} ++ ++# parse yaml config files into 'prefix_yaml_part_names=("value")' strings ++parse_yaml_() { ++ local yaml_file=$1 ++ local prefix=$2 ++ local s ++ local w ++ local fs ++ ++ s='[[:space:]]*' ++ w='[a-zA-Z0-9_.-]*' ++ fs="$(echo @|tr @ '\034')" ++ ++ ( ++ sed -ne '/^--/s|--||g; s|\"|\\\"|g; s/[[:space:]]*$//g;' \ ++ -e 's/\$/\\\$/g' \ ++ -e "/#.*[\"\']/!s| #.*||g; /^#/s|#.*||g;" \ ++ -e "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \ ++ -e "s|^\($s\)\($w\)${s}[:-]$s\(.*\)$s\$|\1$fs\2$fs\3|p" | ++ ++ awk -F"$fs" '{ ++ indent = length($1)/2; ++ if (length($2) == 0) { conj[indent]="+";} else {conj[indent]="";} ++ vname[indent] = $2; ++ for (i in vname) {if (i > indent) {delete vname[i]}} ++ if (length($3) > 0) { ++ vn=""; for (i=0; i"$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") ++ 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!" ++ ++ #parse_yaml_ "$TEMPDIR/vdoconf.yml" _ ++ eval "$(parse_yaml_ "$TEMPDIR/vdoconf.yml" _ | grep "$TRVDONAME" | sed -e "s/_config_vdos_$TRVDONAME/vdo/g")" ++ ++ 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." ++ ++ PARAMS=$(cat <vg; + struct logical_volume *vdo_lv; + struct dm_vdo_target_params vdo_params; /* vdo */ +@@ -5497,12 +5497,12 @@ static int _lvconvert_to_vdopool_single(struct cmd_context *cmd, + goto out; + } + +- zero_vdopool = arg_int_value(cmd, zero_ARG, 1); ++ vdo_pool_zero = arg_int_value(cmd, zero_ARG, 1); + + log_warn("WARNING: Converting logical volume %s to VDO pool volume %s formating.", +- display_lvname(lv), zero_vdopool ? "with" : "WITHOUT"); ++ display_lvname(lv), vdo_pool_zero ? "with" : "WITHOUT"); + +- if (zero_vdopool) ++ if (vdo_pool_zero) + log_warn("THIS WILL DESTROY CONTENT OF LOGICAL VOLUME (filesystem etc.)"); + else + log_warn("WARNING: Using invalid VDO pool data MAY DESTROY YOUR DATA!"); +@@ -5514,7 +5514,7 @@ static int _lvconvert_to_vdopool_single(struct cmd_context *cmd, + goto out; + } + +- if (zero_vdopool) { ++ if (vdo_pool_zero) { + if (!wipe_lv(lv, (struct wipe_params) { .do_zero = 1, .do_wipe_signatures = 1, + .yes = arg_count(cmd, yes_ARG), + .force = arg_count(cmd, force_ARG)})) { +@@ -5526,7 +5526,7 @@ static int _lvconvert_to_vdopool_single(struct cmd_context *cmd, + if (!archive(vg)) + goto_out; + +- if (!convert_vdo_pool_lv(lv, &vdo_params, &lvc.virtual_extents, zero_vdopool)) ++ if (!convert_vdo_pool_lv(lv, &vdo_params, &lvc.virtual_extents, vdo_pool_zero)) + goto_out; + + dm_list_init(&lvc.tags); diff --git a/SOURCES/lvm2-2_03_13-vdo-support-vdo_pool_header_size.patch b/SOURCES/lvm2-2_03_13-vdo-support-vdo_pool_header_size.patch new file mode 100644 index 0000000..63235b0 --- /dev/null +++ b/SOURCES/lvm2-2_03_13-vdo-support-vdo_pool_header_size.patch @@ -0,0 +1,197 @@ + conf/example.conf.in | 5 +++++ + lib/config/config_settings.h | 3 +++ + lib/config/defaults.h | 3 +-- + lib/metadata/lv_manip.c | 3 ++- + lib/metadata/metadata-exported.h | 5 ++++- + lib/metadata/vdo_manip.c | 13 ++++++++----- + tools/lvconvert.c | 6 ++++-- + tools/lvcreate.c | 2 +- + 8 files changed, 28 insertions(+), 12 deletions(-) + +diff --git a/conf/example.conf.in b/conf/example.conf.in +index aaf73a4..78547a6 100644 +--- a/conf/example.conf.in ++++ b/conf/example.conf.in +@@ -734,6 +734,11 @@ allocation { + # The default and minimum is 1. The maximum is UINT_MAX / 4096. + # This configuration option has an automatic default value. + # vdo_max_discard = 1 ++ ++ # Configuration option allocation/vdo_pool_header_size. ++ # Specified the emptry header size in KiB at the front and end of vdo pool device. ++ # This configuration option has an automatic default value. ++ # vdo_pool_header_size = 512 + } + + # Configuration section log. +diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h +index f5dac4d..5217da8 100644 +--- a/lib/config/config_settings.h ++++ b/lib/config/config_settings.h +@@ -816,6 +816,9 @@ cfg(allocation_vdo_max_discard_CFG, "vdo_max_discard", allocation_CFG_SECTION, C + "increased latency for the individual discard requests.\n" + "The default and minimum is 1. The maximum is UINT_MAX / 4096.\n") + ++cfg(allocation_vdo_pool_header_size_CFG, "vdo_pool_header_size", allocation_CFG_SECTION, CFG_PROFILABLE | CFG_PROFILABLE_METADATA | CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, DEFAULT_VDO_POOL_HEADER_SIZE_KB, vsn(2, 3, 12), NULL, 0, NULL, ++ "Specified the emptry header size in KiB at the front and end of vdo pool device.\n") ++ + cfg(log_report_command_log_CFG, "report_command_log", log_CFG_SECTION, CFG_PROFILABLE | CFG_DEFAULT_COMMENTED | CFG_DISALLOW_INTERACTIVE, CFG_TYPE_BOOL, DEFAULT_COMMAND_LOG_REPORT, vsn(2, 2, 158), NULL, 0, NULL, + "Enable or disable LVM log reporting.\n" + "If enabled, LVM will collect a log of operations, messages,\n" +diff --git a/lib/config/defaults.h b/lib/config/defaults.h +index 2870dee..d5e5b3b 100644 +--- a/lib/config/defaults.h ++++ b/lib/config/defaults.h +@@ -181,8 +181,7 @@ + * VDO pool will reverve some sectors in the front and the back of pool device to avoid + * seeing same device twice in the system. + */ +-#define DEFAULT_VDO_POOL_HEADER_SIZE (1024) // 512KiB +- ++#define DEFAULT_VDO_POOL_HEADER_SIZE_KB (512) + + + #define DEFAULT_FSADM_PATH FSADM_PATH +diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c +index 37dd361..43af474 100644 +--- a/lib/metadata/lv_manip.c ++++ b/lib/metadata/lv_manip.c +@@ -8766,7 +8766,8 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, + } + + if (seg_is_vdo_pool(lp)) { +- if (!convert_vdo_pool_lv(lv, &lp->vdo_params, &lp->virtual_extents, 1)) { ++ if (!convert_vdo_pool_lv(lv, &lp->vdo_params, &lp->virtual_extents, ++ 1, lp->vdo_pool_header_size)) { + stack; + goto deactivate_and_revert_new_lv; + } +diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h +index 54bc0d0..adbbe76 100644 +--- a/lib/metadata/metadata-exported.h ++++ b/lib/metadata/metadata-exported.h +@@ -1033,6 +1033,7 @@ struct lvcreate_params { + int approx_alloc; /* all */ + alloc_policy_t alloc; /* all */ + struct dm_vdo_target_params vdo_params; /* vdo */ ++ uint64_t vdo_pool_header_size; /* VDO */ + + int raidintegrity; + const char *raidintegritymode; +@@ -1367,10 +1368,12 @@ int parse_vdo_pool_status(struct dm_pool *mem, const struct logical_volume *vdo_ + struct logical_volume *convert_vdo_pool_lv(struct logical_volume *data_lv, + const struct dm_vdo_target_params *vtp, + uint32_t *virtual_extents, +- int format); ++ int format, ++ uint64_t vdo_pool_header_size); + int set_vdo_write_policy(enum dm_vdo_write_policy *vwp, const char *policy); + int fill_vdo_target_params(struct cmd_context *cmd, + struct dm_vdo_target_params *vtp, ++ uint64_t *vdo_pool_header_size, + struct profile *profile); + /* -- metadata/vdo_manip.c */ + +diff --git a/lib/metadata/vdo_manip.c b/lib/metadata/vdo_manip.c +index afc513a..3f2de1a 100644 +--- a/lib/metadata/vdo_manip.c ++++ b/lib/metadata/vdo_manip.c +@@ -356,9 +356,9 @@ static int _format_vdo_pool_data_lv(struct logical_volume *data_lv, + struct logical_volume *convert_vdo_pool_lv(struct logical_volume *data_lv, + const struct dm_vdo_target_params *vtp, + uint32_t *virtual_extents, +- int format) ++ int format, ++ uint64_t vdo_pool_header_size) + { +- const uint64_t header_size = DEFAULT_VDO_POOL_HEADER_SIZE; + const uint32_t extent_size = data_lv->vg->extent_size; + struct cmd_context *cmd = data_lv->vg->cmd; + struct logical_volume *vdo_pool_lv = data_lv; +@@ -379,7 +379,7 @@ struct logical_volume *convert_vdo_pool_lv(struct logical_volume *data_lv, + + if (*virtual_extents) + vdo_logical_size = +- _get_virtual_size(*virtual_extents, extent_size, header_size); ++ _get_virtual_size(*virtual_extents, extent_size, vdo_pool_header_size); + + if (!dm_vdo_validate_target_params(vtp, vdo_logical_size)) + return_0; +@@ -403,7 +403,7 @@ struct logical_volume *convert_vdo_pool_lv(struct logical_volume *data_lv, + return NULL; + } + +- vdo_logical_size -= 2 * header_size; ++ vdo_logical_size -= 2 * vdo_pool_header_size; + + if (vdo_logical_size < extent_size) { + if (!*virtual_extents) +@@ -426,7 +426,7 @@ struct logical_volume *convert_vdo_pool_lv(struct logical_volume *data_lv, + vdo_pool_seg = first_seg(vdo_pool_lv); + vdo_pool_seg->segtype = vdo_pool_segtype; + vdo_pool_seg->vdo_params = *vtp; +- vdo_pool_seg->vdo_pool_header_size = DEFAULT_VDO_POOL_HEADER_SIZE; ++ vdo_pool_seg->vdo_pool_header_size = vdo_pool_header_size; + vdo_pool_seg->vdo_pool_virtual_extents = *virtual_extents; + + vdo_pool_lv->status |= LV_VDO_POOL; +@@ -453,6 +453,7 @@ int set_vdo_write_policy(enum dm_vdo_write_policy *vwp, const char *policy) + + int fill_vdo_target_params(struct cmd_context *cmd, + struct dm_vdo_target_params *vtp, ++ uint64_t *vdo_pool_header_size, + struct profile *profile) + { + const char *policy; +@@ -501,5 +502,7 @@ int fill_vdo_target_params(struct cmd_context *cmd, + if (!set_vdo_write_policy(&vtp->write_policy, policy)) + return_0; + ++ *vdo_pool_header_size = 2 * find_config_tree_int64(cmd, allocation_vdo_pool_header_size_CFG, profile); ++ + return 1; + } +diff --git a/tools/lvconvert.c b/tools/lvconvert.c +index 8488596..f87ee78 100644 +--- a/tools/lvconvert.c ++++ b/tools/lvconvert.c +@@ -5439,6 +5439,7 @@ static int _lvconvert_to_vdopool_single(struct cmd_context *cmd, + { + const char *vg_name = NULL; + unsigned int vdo_pool_zero; ++ uint64_t vdo_pool_header_size; + struct volume_group *vg = lv->vg; + struct logical_volume *vdo_lv; + struct dm_vdo_target_params vdo_params; /* vdo */ +@@ -5481,7 +5482,7 @@ static int _lvconvert_to_vdopool_single(struct cmd_context *cmd, + goto out; + } + +- if (!fill_vdo_target_params(cmd, &vdo_params, vg->profile)) ++ if (!fill_vdo_target_params(cmd, &vdo_params, &vdo_pool_header_size, vg->profile)) + goto_out; + + if (arg_is_set(cmd, compression_ARG)) +@@ -5526,7 +5527,8 @@ static int _lvconvert_to_vdopool_single(struct cmd_context *cmd, + if (!archive(vg)) + goto_out; + +- if (!convert_vdo_pool_lv(lv, &vdo_params, &lvc.virtual_extents, vdo_pool_zero)) ++ if (!convert_vdo_pool_lv(lv, &vdo_params, &lvc.virtual_extents, ++ vdo_pool_zero, vdo_pool_header_size)) + goto_out; + + dm_list_init(&lvc.tags); +diff --git a/tools/lvcreate.c b/tools/lvcreate.c +index a28f093..0def236 100644 +--- a/tools/lvcreate.c ++++ b/tools/lvcreate.c +@@ -1097,7 +1097,7 @@ static int _lvcreate_params(struct cmd_context *cmd, + + // FIXME: prefiling here - this is wrong place + // but will work for this moment +- if (!fill_vdo_target_params(cmd, &lp->vdo_params, NULL)) ++ if (!fill_vdo_target_params(cmd, &lp->vdo_params, &lp->vdo_pool_header_size, NULL)) + return_0; + + if (arg_is_set(cmd, compression_ARG)) diff --git a/SOURCES/lvm2-make-generate.patch b/SOURCES/lvm2-make-generate.patch new file mode 100644 index 0000000..0b37216 --- /dev/null +++ b/SOURCES/lvm2-make-generate.patch @@ -0,0 +1,146 @@ + man/lvconvert.8_pregen | 2 +- + man/lvmdevices.8_pregen | 79 ++++++++++++++++++++++++++++++++++++++++--------- + 2 files changed, 66 insertions(+), 15 deletions(-) + +diff --git a/man/lvconvert.8_pregen b/man/lvconvert.8_pregen +index d733ab6..4fafe5d 100644 +--- a/man/lvconvert.8_pregen ++++ b/man/lvconvert.8_pregen +@@ -670,7 +670,7 @@ Convert LV to type thin-pool. + .RE + .P + .RS 4 +-LV1 types: linear striped cache raid error zero ++LV1 types: linear striped cache raid error zero writecache + .RE + .P + \(em +diff --git a/man/lvmdevices.8_pregen b/man/lvmdevices.8_pregen +index 267ce96..fa85362 100644 +--- a/man/lvmdevices.8_pregen ++++ b/man/lvmdevices.8_pregen +@@ -28,6 +28,8 @@ lvmdevices \(em Manage the devices file + .br + \fB--delpvid\fP \fIString\fP + .br ++ \fB--deviceidtype\fP \fIString\fP ++.br + \fB--devices\fP \fIPV\fP + .br + \fB--devicesfile\fP \fIString\fP +@@ -70,18 +72,18 @@ remove it from the devices file with lvmdevices --deldev. The + vgimportdevices(8) command adds all PVs from a VG to the devices file, + and updates the VG metadata to include device IDs of the PVs. + .P +-Commands adding new devices to the devices file necessarily look outside +-the existing devices file to find the devices to add. pvcreate, vgcreate, +-and vgextend also look outside the devices file to create new PVs and add +-them to the devices file. ++Commands that add new devices to the devices file necessarily look outside ++the existing devices file to find the devices being added. pvcreate, ++vgcreate, and vgextend also look outside the devices file to create new ++PVs and add those PVs to the devices file. + .P + LVM records devices in the devices file using hardware-specific IDs, such + as the WWID, and attempts to use subsystem-specific IDs for virtual device +-types (which also aim to be as unique and stable as possible.) +-These device IDs are also written in the VG metadata. When no hardware or ++types (which also aim to be as unique and stable as possible.) These ++device IDs are also written in the VG metadata. When no hardware or + virtual ID is available, lvm falls back using the unstable device name as +-the device ID. When devnames are used, lvm performs extra scanning to +-find devices if their devname changes, e.g. after reboot. ++the device ID. When devnames are used as IDs, lvm performs extra scanning ++to find devices if their devname changes, e.g. after reboot. + .P + When proper device IDs are used, an lvm command will not look at devices + outside the devices file, but when devnames are used as a fallback, lvm +@@ -95,12 +97,13 @@ overriding the devices file. The listed devices act as a sort of devices + file in terms of limiting which devices lvm will see and use. Devices + that are not listed will appear to be missing to the lvm command. + .P +-Multiple devices files can be kept in \fI#DEFAULT_SYS_DIR#/devices\fP, which allows lvm +-to be used with different sets of devices, e.g. system devices do not need +-to be exposed to a specific application, and the application can use lvm on +-its own devices that are not exposed to the system. The option +---devicesfile is used to select the devices file to use with the +-command. Without the option set, the default system devices file is used. ++Multiple devices files can be kept \fI#DEFAULT_SYS_DIR#/devices\fP, which ++allows lvm to be used with different sets of devices. For example, system ++devices do not need to be exposed to a specific application, and the ++application can use lvm on its own devices that are not exposed to the ++system. The option --devicesfile is used to select the devices ++file to use with the command. Without the option set, the default system ++devices file is used. + .P + Setting --devicesfile "" causes lvm to not use a devices file. + .P +@@ -120,6 +123,45 @@ if it does not yet exist. + .P + It is recommended to use lvm commands to make changes to the devices file to + ensure proper updates. ++.P ++The device ID and device ID type are included in the VG metadata and can ++be reported with pvs -o deviceid,deviceidtype. (Note that the lvmdevices ++command does not update VG metadata, but subsequent lvm commands modifying ++the metadata will include the device ID.) ++.P ++Possible device ID types are: ++.br ++.IP \[bu] 2 ++.B sys_wwid ++uses the wwid reported by sysfs. This is the first choice for non-virtual ++devices. ++.IP \[bu] 2 ++.B sys_serial ++uses the serial number reported by sysfs. This is the second choice for ++non-virtual devices. ++.IP \[bu] 2 ++.B mpath_uuid ++is used for dm multipath devices, reported by sysfs. ++.IP \[bu] 2 ++.B crypt_uuid ++is used for dm crypt devices, reported by sysfs. ++.IP \[bu] 2 ++.B md_uuid ++is used for md devices, reported by sysfs. ++.B lvmlv_uuid ++is used if a PV is placed on top of an lvm LV, reported by sysfs. ++.IP \[bu] 2 ++.B loop_file ++is used for loop devices, the backing file name repored by sysfs. ++.IP \[bu] 2 ++.B devname ++the device name is used if no other type applies. ++.P ++ ++The default choice for device ID type can be overriden using lvmdevices ++--addev --deviceidtype . If the specified type is available for the ++device it will be used, otherwise the device will be added using the type ++that would otherwise be chosen. + . + .SH USAGE + . +@@ -169,6 +211,8 @@ Add a device to the devices file. + .br + .RS 4 + .ad l ++[ \fB--deviceidtype\fP \fIString\fP ] ++.br + [ COMMON_OPTIONS ] + .ad b + .RE +@@ -308,6 +352,13 @@ Remove a device from the devices file. + Remove a device with the PVID from the devices file. + . + .HP ++\fB--deviceidtype\fP \fIString\fP ++.br ++The type of device ID to use for the device. ++If the specified type is available for the device, ++then it will override the default type that lvm would use. ++. ++.HP + \fB--devices\fP \fIPV\fP + .br + Devices that the command can use. This option can be repeated diff --git a/SPECS/lvm2.spec b/SPECS/lvm2.spec index ef6edec..fcd41d0 100644 --- a/SPECS/lvm2.spec +++ b/SPECS/lvm2.spec @@ -67,7 +67,7 @@ Version: 2.03.12 %if 0%{?from_snapshot} Release: 0.1.20210426git%{shortcommit}%{?dist}%{?rel_suffix} %else -Release: 3%{?dist}%{?rel_suffix} +Release: 5%{?dist}%{?rel_suffix} %endif License: GPLv2 URL: http://sourceware.org/lvm2 @@ -88,6 +88,20 @@ Patch5: lvm2-2_03_13-enable-command-syntax-for-thin-and-writecache.patch # BZ 1872903: Patch6: lvm2-2_03_13-writecache-fix-lv_on_pmem.patch Patch7: lvm2-2_03_13-writecache-don-t-pvmove-device-used-by-writecache.patch +# BZ 1957898: +Patch8: lvm2-2_03_13-lvconvert-allow-writecache-with-other-thinpool-comma.patch +# BZ 1922312: +Patch9: lvm2-2_03_13-devices-don-t-use-deleted-loop-backing-file-for-devi.patch +Patch10: lvm2-2_03_13-lvmdevices-add-deviceidtype-option.patch +# BZ 1974901: +Patch11: lvm2-2_03_13-device_id-handle-scsi_debug-wwid.patch +# BZ 1930261: +Patch12: lvm2-2_03_13-lvconvert-fix-vdo-virtual-size-when-specified.patch +Patch13: lvm2-2_03_13-vdo-rename-variable-vdo_pool_zero.patch +Patch14: lvm2-2_03_13-vdo-support-vdo_pool_header_size.patch +Patch15: lvm2-2_03_13-vdo-add-vdoimport-support.patch +Patch16: lvm2-2_03_13-man-vdoimport-page.patch +Patch17: lvm2-make-generate.patch BuildRequires: gcc %if %{enable_testsuite} @@ -155,6 +169,16 @@ or more physical volumes and creating one or more logical volumes %patch5 -p1 -b .backup5 %patch6 -p1 -b .backup6 %patch7 -p1 -b .backup7 +%patch8 -p1 -b .backup8 +%patch9 -p1 -b .backup9 +%patch10 -p1 -b .backup10 +%patch11 -p1 -b .backup11 +%patch12 -p1 -b .backup12 +%patch13 -p1 -b .backup13 +%patch14 -p1 -b .backup14 +%patch15 -p1 -b .backup15 +%patch16 -p1 -b .backup16 +%patch17 -p1 -b .backup17 %build %global _default_pid_dir /run @@ -299,6 +323,7 @@ systemctl start lvm2-lvmpolld.socket >/dev/null 2>&1 || : %{_sbindir}/pvresize %{_sbindir}/pvs %{_sbindir}/pvscan +%{_sbindir}/vdoimport %{_sbindir}/vgcfgbackup %{_sbindir}/vgcfgrestore %{_sbindir}/vgchange @@ -367,6 +392,7 @@ systemctl start lvm2-lvmpolld.socket >/dev/null 2>&1 || : %{_mandir}/man8/vgdisplay.8.gz %{_mandir}/man8/vgexport.8.gz %{_mandir}/man8/vgextend.8.gz +%{_mandir}/man8/vdoimport.8.gz %{_mandir}/man8/vgimport.8.gz %{_mandir}/man8/vgimportclone.8.gz %{_mandir}/man8/vgimportdevices.8.gz @@ -763,6 +789,14 @@ An extensive functional testsuite for LVM2. %endif %changelog +* Tue Jul 13 2021 Marian Csontos - 2.03.12-5 +- Fix device_id handling of scsi_debug WWID. +- Add vdoimport support. + +* Tue Jun 22 2021 Marian Csontos - 2.03.12-4 +- Fix conversion of writecache LVs to thin pool data volume. +- Add deviceidtype option for lvmdevices. + * Tue Jun 15 2021 Marian Csontos - 2.03.12-3 - Allow extending thin-pool data with writecache on top. - Fix removing thin-pool data converted to writeache.