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
Richard W.M. Jones
2019-Jan-07 20:08 UTC
Re: [Libguestfs] [PATCH] v2v: -o rhv-upload: decouple name of nbdkit python plugin
On Mon, Jan 07, 2019 at 04:41:17PM +0100, Pino Toscano wrote:> 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:nbdkit >= 1.8 exports the Python version in ‘--dump-plugin’ output: $ nbdkit python --dump-plugin ... python_version=2.7.15 And where it's available, the PEP-384 ABI version: $ nbdkit python3 --dump-plugin ... python_version=3.7.2 python_pep_384_abi_version=3 I will try to see if we can parse this easily ... Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v
Richard W.M. Jones
2019-Jan-07 20:25 UTC
Re: [Libguestfs] [PATCH] v2v: -o rhv-upload: decouple name of nbdkit python plugin
On Mon, Jan 07, 2019 at 08:08:05PM +0000, Richard W.M. Jones wrote:> On Mon, Jan 07, 2019 at 04:41:17PM +0100, Pino Toscano wrote: > > 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: > > nbdkit >= 1.8 exports the Python version in ‘--dump-plugin’ output: > > $ nbdkit python --dump-plugin > ... > python_version=2.7.15 > > And where it's available, the PEP-384 ABI version: > > $ nbdkit python3 --dump-plugin > ... > python_version=3.7.2 > python_pep_384_abi_version=3 > > I will try to see if we can parse this easily ...I started to write something along these lines and I hate it already. However then I wondered: shouldn't all of this be ./configure options, eg: ./configure --with-virt-v2v-python-interpreter=/usr/bin/python3 \ --with-virt-v2v-nbdkit-python=python3 or something similar? Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://people.redhat.com/~rjones/virt-df/
Possibly Parallel Threads
- Re: [PATCH] v2v: -o rhv-upload: decouple name of nbdkit python plugin
- Re: [PATCH] v2v: -o rhv-upload: decouple name of nbdkit python plugin
- [PATCH] v2v: -o rhv-upload: decouple name of nbdkit python plugin
- [PATCH nbdkit] plugins: Add scripting language version to --dump-plugin output.
- [PATCH] v2v: -o rhv-upload: Allow configure commands to set the Python version.