Pino Toscano
2018-Dec-13 17:58 UTC
[Libguestfs] [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. --- v2v/output_rhv_upload.ml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/v2v/output_rhv_upload.ml b/v2v/output_rhv_upload.ml index f5e0e6b1c..d8f608cff 100644 --- a/v2v/output_rhv_upload.ml +++ b/v2v/output_rhv_upload.ml @@ -78,6 +78,7 @@ let parse_output_options options { rhv_cafile; rhv_cluster; rhv_direct; rhv_verifypeer } +let nbdkit_python_plugin = "python" let pidfile_timeout = 30 let finalization_timeout = 5*60 @@ -139,14 +140,14 @@ class output_rhv_upload output_alloc output_conn *) let error_unless_nbdkit_python_plugin_working () let cmd = sprintf "nbdkit %s %s --dump-plugin >/dev/null" - Python_script.python + nbdkit_python_plugin (quote (Python_script.path plugin_script)) in debug "%s" cmd; if Sys.command cmd <> 0 then error (f_"nbdkit %s plugin is not installed or not working. It is required if you want to use ‘-o rhv-upload’. See also the virt-v2v-output-rhv(1) manual.") - Python_script.python + nbdkit_python_plugin in (* Check that nbdkit was compiled with SELinux support (for the @@ -209,7 +210,7 @@ See also the virt-v2v-output-rhv(1) manual.") "--newstyle"; (* use newstyle NBD protocol *) "--exportname"; "/"; - Python_script.python; (* use the nbdkit Python 3 plugin *) + nbdkit_python_plugin; (* use the nbdkit Python plugin *) Python_script.path plugin_script; (* Python plugin script *) ] in let args = if verbose () then args @ ["--verbose"] else args in -- 2.17.2
Richard W.M. Jones
2018-Dec-14 22:28 UTC
Re: [Libguestfs] [PATCH] v2v: -o rhv-upload: decouple name of nbdkit python plugin
On Thu, Dec 13, 2018 at 06:58:30PM +0100, Pino Toscano wrote:> 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. > --- > v2v/output_rhv_upload.ml | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/v2v/output_rhv_upload.ml b/v2v/output_rhv_upload.ml > index f5e0e6b1c..d8f608cff 100644 > --- a/v2v/output_rhv_upload.ml > +++ b/v2v/output_rhv_upload.ml > @@ -78,6 +78,7 @@ let parse_output_options options > > { rhv_cafile; rhv_cluster; rhv_direct; rhv_verifypeer } > > +let nbdkit_python_plugin = "python" > let pidfile_timeout = 30 > let finalization_timeout = 5*60 > > @@ -139,14 +140,14 @@ class output_rhv_upload output_alloc output_conn > *) > let error_unless_nbdkit_python_plugin_working () > let cmd = sprintf "nbdkit %s %s --dump-plugin >/dev/null" > - Python_script.python > + nbdkit_python_plugin > (quote (Python_script.path plugin_script)) in > debug "%s" cmd; > if Sys.command cmd <> 0 then > error (f_"nbdkit %s plugin is not installed or not working. It is required if you want to use ‘-o rhv-upload’. > > See also the virt-v2v-output-rhv(1) manual.") > - Python_script.python > + nbdkit_python_plugin > in > > (* Check that nbdkit was compiled with SELinux support (for the > @@ -209,7 +210,7 @@ See also the virt-v2v-output-rhv(1) manual.") > "--newstyle"; (* use newstyle NBD protocol *) > "--exportname"; "/"; > > - Python_script.python; (* use the nbdkit Python 3 plugin *) > + nbdkit_python_plugin; (* use the nbdkit Python plugin *) > Python_script.path plugin_script; (* Python plugin script *) > ] in > let args = if verbose () then args @ ["--verbose"] else args in > --ACK Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top
Richard W.M. Jones
2019-Jan-07 13:30 UTC
Re: [Libguestfs] [PATCH] v2v: -o rhv-upload: decouple name of nbdkit python plugin
On Thu, Dec 13, 2018 at 06:58:30PM +0100, Pino Toscano wrote:> 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.I'm not saying this is wrong, but it does break "out of the box" -o rhv-upload. It means that to get it to work on Fedora we _have_ to patch:> --- a/v2v/output_rhv_upload.ml > +++ b/v2v/output_rhv_upload.ml > @@ -78,6 +78,7 @@ let parse_output_options options > > { rhv_cafile; rhv_cluster; rhv_direct; rhv_verifypeer } > > +let nbdkit_python_plugin = "python"to change this "python3" [1]. I would dearly love to drop Python 2 support everywhere, but I don't think we can do that realisticly before the Python 2 EOL (https://pythonclock.org/) which is another 12 months away. I wonder if there's a better way we can solve this? I don't have any immediate ideas ... Rich. [1] By the way, the failure is weird, non-obvious and non-actionable, so here it is: nbdkit python '/home/rjones/d/libguestfs-master/tmp/v2v.xSFDLk/rhv-upload-plugin.py' --dump-plugin >/dev/null File "/home/rjones/d/libguestfs-master/tmp/v2v.xSFDLk/rhv-upload-plugin.py", line 3 SyntaxError: Non-ASCII character '\xe2' in file /home/rjones/d/libguestfs-master/tmp/v2v.xSFDLk/rhv-upload-plugin.py on line 3, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details nbdkit: error: /home/rjones/d/libguestfs-master/tmp/v2v.xSFDLk/rhv-upload-plugin.py: error running this script virt-v2v: error: nbdkit python plugin is not installed or not working. It is required if you want to use ‘-o rhv-upload’. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org
Pino Toscano
2019-Jan-07 15:41 UTC
Re: [Libguestfs] [PATCH] v2v: -o rhv-upload: decouple name of nbdkit python plugin
On Monday, 7 January 2019 14:30:00 CET Richard W.M. Jones wrote:> On Thu, Dec 13, 2018 at 06:58:30PM +0100, Pino Toscano wrote: > > 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. > > I'm not saying this is wrong, but it does break "out of the box" -o > rhv-upload. It means that to get it to work on Fedora we _have_ to > patch: > > > --- a/v2v/output_rhv_upload.ml > > +++ b/v2v/output_rhv_upload.ml > > @@ -78,6 +78,7 @@ let parse_output_options options > > > > { rhv_cafile; rhv_cluster; rhv_direct; rhv_verifypeer } > > > > +let nbdkit_python_plugin = "python" > > to change this "python3" [1].Yes, this is correct. This follows the fact that on Fedora the Python 3 plugin is renamed, so the "OOTB experience" is already "different" because of that. Also, the previous name ("python3") for the nbdkit plugin was broken everywhere but on Fedora, which basically breaks the "OOTB" experience for any other distro...> [1] By the way, the failure is weird, non-obvious and non-actionable, > so here it is: > > nbdkit python '/home/rjones/d/libguestfs-master/tmp/v2v.xSFDLk/rhv-upload-plugin.py' --dump-plugin >/dev/null > File "/home/rjones/d/libguestfs-master/tmp/v2v.xSFDLk/rhv-upload-plugin.py", line 3 > SyntaxError: Non-ASCII character '\xe2' in file /home/rjones/d/libguestfs-master/tmp/v2v.xSFDLk/rhv-upload-plugin.py on line 3, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details > nbdkit: error: /home/rjones/d/libguestfs-master/tmp/v2v.xSFDLk/rhv-upload-plugin.py: error running this script > virt-v2v: error: nbdkit python plugin is not installed or not working. It > is required if you want to use ‘-o rhv-upload’.At least it fails ;) One option I see is to export, as part of the nbdkit Python module interface, the equivalent of sys.version_info: this way, the scripts can detect which python version is the plugin linked with: if nbdkit.python_version_info[0] != 3: error("this script is for Python 3") OTOH, it will not help with the above case, as there is a syntax error even before a check can be reached... -- Pino Toscano
Maybe Matching Threads
- [PATCH] v2v: -o rhv-upload: make -oo rhv-cafile optional
- [PATCH v2v v3 0/2] rhv-upload: Validate UUIDs and check they don't exist already
- [PATCH v2v] v2v: -o rhv-upload: Make -oo rhv-cafile optional in all cases (RHBZ#1791240).
- [PATCH] v2v: -o rhv-upload: Allow configure commands to set the Python version.
- Re: [PATCH v2v v2 1/2] rhv-upload: Validate UUIDs passed to -oo rhv-disk-uuid (RHBZ#1789279)