Blob Blame History Raw
From 6e71dcc1c9c1d8dd37da3f0fd71fc97cc5cbe92f Mon Sep 17 00:00:00 2001
From: Pino Toscano <ptoscano@redhat.com>
Date: Thu, 13 Dec 2018 18:36:20 +0100
Subject: [PATCH] v2v: -o rhv-upload: decouple name of nbdkit python plugin

Do not assume that the Python plugin of nbdkit has the same name of the
Python interpreter.

Use the default upstream name of nbdkit to identify it; downstream
distributions must adjust this variable, in case they rename the Python
plugin of nbdkit.

(cherry picked from commit 6b80c5fb51f08d3e62393e6722655bbcd940f4e7)
---
 v2v/output_rhv_upload.ml | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/v2v/output_rhv_upload.ml b/v2v/output_rhv_upload.ml
index 7dbd98a0d..79a2fc8fd 100644
--- a/v2v/output_rhv_upload.ml
+++ b/v2v/output_rhv_upload.ml
@@ -79,6 +79,7 @@ let parse_output_options options =
   { rhv_cafile; rhv_cluster; rhv_direct; rhv_verifypeer }
 
 let python3 = "python3" (* Defined by PEP 394 *)
+let nbdkit_python_plugin = "python"
 let pidfile_timeout = 30
 let finalization_timeout = 5*60
 
@@ -155,7 +156,7 @@ class output_rhv_upload output_alloc output_conn
    *)
   let error_unless_nbdkit_python3_working () =
     let cmd = sprintf "nbdkit %s %s --dump-plugin >/dev/null"
-                      python3 (quote plugin) in
+                      nbdkit_python_plugin (quote plugin) in
     if Sys.command cmd <> 0 then
       error (f_"nbdkit Python 3 plugin is not installed or not working.  It is required if you want to use ‘-o rhv-upload’.
 
@@ -222,7 +223,7 @@ See also \"OUTPUT TO RHV\" in the virt-v2v(1) manual.")
       "--newstyle";             (* use newstyle NBD protocol *)
       "--exportname"; "/";
 
-      "python3";                (* use the nbdkit Python 3 plugin *)
+      nbdkit_python_plugin;     (* use the nbdkit Python plugin *)
       plugin;                   (* Python plugin script *)
     ] in
     let args = if verbose () then args @ ["--verbose"] else args in
-- 
2.20.1