[Libguestfs] [PATCH v2] v2v: -o rhv-upload: Allow configure to set the nbdkit Python version.

Richard W.M. Jones rjones at redhat.com
Tue Jan 15 13:29:55 UTC 2019


No functional change, but it does allow downstream distributions to
adjust the nbdkit Python plugin used by virt-v2v -o rhv-upload mode:

./configure --with-virt-v2v-nbdkit-python-plugin=...
---
 .gitignore               |  1 +
 configure.ac             |  5 +++++
 m4/guestfs-v2v.m4        | 28 ++++++++++++++++++++++++++++
 v2v/Makefile.am          |  4 ++++
 v2v/config.ml.in         | 20 ++++++++++++++++++++
 v2v/config.mli           | 26 ++++++++++++++++++++++++++
 v2v/output_rhv_upload.ml |  2 +-
 7 files changed, 85 insertions(+), 1 deletion(-)

diff --git a/.gitignore b/.gitignore
index fe5aa6d70..637bf7765 100644
--- a/.gitignore
+++ b/.gitignore
@@ -678,6 +678,7 @@ Makefile.in
 /utils/qemu-boot/qemu-boot
 /utils/qemu-speed-test/qemu-speed-test
 /v2v/.depend
+/v2v/config.ml
 /v2v/oUnit-*
 /v2v/output_rhv_upload_*_source.ml
 /v2v/real-*.d/
diff --git a/configure.ac b/configure.ac
index 143435b36..a94f3abab 100644
--- a/configure.ac
+++ b/configure.ac
@@ -162,6 +162,10 @@ m4_include([m4/guestfs-golang.m4])
 HEADING([Checking for GObject Introspection])
 m4_include([m4/guestfs-gobject.m4])
 
+dnl virt-v2v, virt-p2v.
+HEADING([Checking the virt-v2v and virt-p2v dependencies])
+m4_include([m4/guestfs-v2v.m4])
+
 dnl Bash completion.
 HEADING([Checking for bash completion])
 m4_include([m4/guestfs-bash-completion.m4])
@@ -365,6 +369,7 @@ AC_CONFIG_FILES([Makefile
                  utils/qemu-boot/Makefile
                  utils/qemu-speed-test/Makefile
                  v2v/Makefile
+                 v2v/config.ml
                  v2v/test-harness/Makefile
                  v2v/test-harness/META
                  website/index.html])
diff --git a/m4/guestfs-v2v.m4 b/m4/guestfs-v2v.m4
new file mode 100644
index 000000000..dff8f124e
--- /dev/null
+++ b/m4/guestfs-v2v.m4
@@ -0,0 +1,28 @@
+# libguestfs
+# Copyright (C) 2009-2019 Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# 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.
+
+dnl Virt-v2v and virt-p2v.
+
+dnl nbdkit python plugin.
+AC_MSG_CHECKING([for the nbdkit python plugin name])
+AC_ARG_WITH([virt-v2v-nbdkit-python-plugin],
+    [AS_HELP_STRING([--with-virt-v2v-nbdkit-python-plugin="python|..."],
+        [set nbdkit python plugin name used by virt-v2v @<:@default=python@:>@])],
+    [VIRT_V2V_NBDKIT_PYTHON_PLUGIN="$withval"],
+    [VIRT_V2V_NBDKIT_PYTHON_PLUGIN=python])
+AC_MSG_RESULT([$VIRT_V2V_NBDKIT_PYTHON_PLUGIN])
+AC_SUBST([VIRT_V2V_NBDKIT_PYTHON_PLUGIN])
diff --git a/v2v/Makefile.am b/v2v/Makefile.am
index a156524ae..2312812fb 100644
--- a/v2v/Makefile.am
+++ b/v2v/Makefile.am
@@ -23,6 +23,7 @@ generator_built = \
 
 BUILT_SOURCES = \
 	$(generator_built) \
+	config.ml \
 	output_rhv_upload_createvm_source.ml \
 	output_rhv_upload_plugin_source.ml \
 	output_rhv_upload_precheck_source.ml
@@ -48,6 +49,7 @@ EXTRA_DIST = \
 SOURCES_MLI = \
 	changeuid.mli \
 	cmdline.mli \
+	config.mli \
 	convert_linux.mli \
 	convert_windows.mli \
 	create_libvirt_xml.mli \
@@ -100,6 +102,7 @@ SOURCES_MLI = \
 	windows_virtio.mli
 
 SOURCES_ML = \
+	config.ml \
 	types.ml \
 	uefi.ml \
 	utils.ml \
@@ -697,6 +700,7 @@ v2v_unit_tests_LINK = \
 .depend: \
 	$(srcdir)/*.mli \
 	$(srcdir)/*.ml \
+	config.ml \
 	output_rhv_upload_*_source.ml
 	$(top_builddir)/ocaml-dep.sh $^
 -include .depend
diff --git a/v2v/config.ml.in b/v2v/config.ml.in
new file mode 100644
index 000000000..240f60868
--- /dev/null
+++ b/v2v/config.ml.in
@@ -0,0 +1,20 @@
+(* virt-v2v
+ * Copyright (C) 2019 Red Hat Inc.
+ * @configure_input@
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ *)
+
+let virt_v2v_nbdkit_python_plugin = "@VIRT_V2V_NBDKIT_PYTHON_PLUGIN@"
diff --git a/v2v/config.mli b/v2v/config.mli
new file mode 100644
index 000000000..b9f4d6225
--- /dev/null
+++ b/v2v/config.mli
@@ -0,0 +1,26 @@
+(* virt-v2v
+ * Copyright (C) 2019 Red Hat Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ *)
+
+val virt_v2v_nbdkit_python_plugin : string
+(** Return the name of the nbdkit python plugin used by
+    [virt-v2v -o rhv-upload].
+
+    As above this must also be the Python 3 version of the plugin,
+    unless you change it.  The configure command to change this is:
+
+    [./configure --with-virt-v2v-nbdkit-python-plugin=...] *)
diff --git a/v2v/output_rhv_upload.ml b/v2v/output_rhv_upload.ml
index c309e31e3..77c39107e 100644
--- a/v2v/output_rhv_upload.ml
+++ b/v2v/output_rhv_upload.ml
@@ -78,7 +78,7 @@ let parse_output_options options =
 
   { rhv_cafile; rhv_cluster; rhv_direct; rhv_verifypeer }
 
-let nbdkit_python_plugin = "python"
+let nbdkit_python_plugin = Config.virt_v2v_nbdkit_python_plugin
 let pidfile_timeout = 30
 let finalization_timeout = 5*60
 
-- 
2.20.1




More information about the Libguestfs mailing list