Skip to contentSkip to conversation

main - vdo: add vdoimport support

PATCH Zdenek Kabelac 1 participant 1 message Jul 9, 2021 Kbuild

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=ed48cb26a31e8e5a12d82d96d8bec6bfc4d5b218
Commit:        ed48cb26a31e8e5a12d82d96d8bec6bfc4d5b218
Parent:        3a92d633a5a23377aa0d5d4ed5a01db8ca14cf69
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Fri Jul 9 14:44:07 2021 +0200
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Fri Jul 9 14:57:59 2021 +0200

vdo: add vdoimport support

Add tool 'vdoimport' to support easy conversion of an existing VDO manager managed VDO volumes into lvm2 managed VDO LV.

When physical converted volume is already a logical volume, conversion happens with the VG itself, just with validation for extent_size, so the virtually sized logical VDO volume size can be expressed in extents.

Example of basic simple usage:

vdoimport --name vg/vdolv /dev/mapper/vdophysicalvolume

---
 WHATS_NEW                 |   1 +
 configure                 |  25 +++
 configure.ac              |  15 ++
 include/configure.h.in    |   3 +
 man/Makefile.in           |   7 +-
 scripts/Makefile.in       |   4 +
 scripts/vdoimport.sh      | 376 ++++++++++++++++++++++++++++++++++++++++++++++
 spec/packages.inc         |   1 +
 test/Makefile.in          |   1 +
 test/shell/vdo-convert.sh | 110 ++++++++++++++
 10 files changed, 542 insertions(+), 1 deletion(-)
WHATS_NEW +1 -0
index 8f6dad27a..810411914 100644
@@ -1,5 +1,6 @@
 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.
   Simplified handling of archive() and backup() internal calls.
configure +25 -0
index 3a9888528..c2d2cff5b 100755
@@ -643,6 +643,8 @@ WRITE_INSTALL
 WRITECACHE
 VDO_LIB
 VDO_INCLUDE
+VDOIMPORT_PATH
+VDOIMPORT
 VDO
 VALGRIND_POOL
 USRSBINDIR
@@ -969,6 +971,7 @@ enable_dbus_service
 enable_pkgconfig
 enable_write_install
 enable_fsadm
+enable_vdoimport
 enable_blkdeactivate
 enable_dmeventd
 enable_selinux
@@ -1707,6 +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-blkdeactivate disable blkdeactivate
   --enable-dmeventd       enable the device-mapper event daemon
   --disable-selinux       disable selinux support
@@ -3139,6 +3143,7 @@ case "$host_os" in
 		DM_IOCTLS=yes
 		SELINUX=yes
 		FSADM=yes
+		VDOIMPORT=yes
 		BLKDEACTIVATE=yes
 		;;
 	darwin*)
@@ -3152,6 +3157,7 @@ case "$host_os" in
 		DM_IOCTLS=no
 		SELINUX=no
 		FSADM=no
+		VDOIMPORT=no
 		BLKDEACTIVATE=no
 		;;
 	*)
@@ -12544,6 +12550,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; }
@@ -14030,6 +14048,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
 
configure.ac +15 -0
index 40acc49c2..a20633e21 100644
@@ -46,6 +46,7 @@ case "$host_os" in
 		DM_IOCTLS=yes
 		SELINUX=yes
 		FSADM=yes
+		VDOIMPORT=yes
 		BLKDEACTIVATE=yes
 		;;
 	darwin*)
@@ -59,6 +60,7 @@ case "$host_os" in
 		DM_IOCTLS=no
 		SELINUX=no
 		FSADM=no
+		VDOIMPORT=no
 		BLKDEACTIVATE=no
 		;;
 	*)
@@ -1311,6 +1313,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)
@@ -1666,6 +1676,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
@@ -1902,6 +1915,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)
include/configure.h.in +3 -0
index 08f696167..55d18bd4f 100644
@@ -687,6 +687,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
 
man/Makefile.in +6 -1
index 29afc776b..d60a92cde 100644
@@ -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
scripts/Makefile.in +4 -0
index e8f674282..1fe88ca90 100644
@@ -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
scripts/vdoimport.sh new file +376 -0

376 lines not on this page · raw message

spec/packages.inc +1 -0
index 71aaeea7a..bf693a4ce 100644
@@ -70,6 +70,7 @@ fi
 %{_sbindir}/vgdisplay
 %{_sbindir}/vgexport
 %{_sbindir}/vgextend
+%{_sbindir}/vdoimport
 %{_sbindir}/vgimport
 %{_sbindir}/vgimportclone
 %{_sbindir}/vgimportdevices
test/Makefile.in +1 -0
index 5f35c30b8..093054087 100644
@@ -368,6 +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
 	@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/"; \
test/shell/vdo-convert.sh new file +110 -0

110 lines not on this page · raw message