[elbe-devel] [PATCH] init libvirt.xml.mako: dont use deprecate option -redir for ports
Manuel Traut
manut at linutronix.de
Fri Oct 19 16:56:56 CEST 2018
Hi Torben,
On Fri, Oct 12, 2018 at 11:14:36AM +0200, Torben Hohn wrote:
> the option -redir is deprecated in qemu since version 2.6.0
> (see https://qemu.weilnetz.de/doc/qemu-doc.html#Deprecated-features)
> qemu needs the following commandline options now:
> -------------------------------------------------------------------------
> -device virtio-net-pci,netdev=user.0
> -netdev user,ipv4,id=user.0,hostfwd=tcp::5022-:22,hostfwd=tcp::7587-:7588
> -------------------------------------------------------------------------
Luckily deprecated doesn't mean, it is currently not working.
> the -device and -netdev options are generated by libvirt, though. And
> libvirt does not support hostfwd= in any way.
>
> in order to be able to specify hostfwd, remove the libvirt generated
> network interface, and then create it via <qemu:arg>. This hides the
> network interface from libvirt. The only bad thing seems to be, that
> virt-manager does not show the network interface and the trafic graph
> is not showing any traffic.
I think we should use the time to fix the issue in libvirt, instead of
merging a really ugly workaround.
To be prepared if we aren't able to extend libvirt in time, i'd like to store
this patch in contrib/
What do you think?
Manu
> Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
> ---
> elbepack/init/libvirt.xml.mako | 15 ++++++++++-----
> 1 file changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/elbepack/init/libvirt.xml.mako b/elbepack/init/libvirt.xml.mako
> index 1260c55f..bf3c893f 100644
> --- a/elbepack/init/libvirt.xml.mako
> +++ b/elbepack/init/libvirt.xml.mako
> @@ -28,6 +28,12 @@ img = os.path.join(opt.directory, 'buildenv.img')
>
> emulator = prj.text('interpreter', default=defs, key='interpreter')
>
> +fwd = ""
> +if prj.has("portforwarding"):
> + for f in prj.node("portforwarding"):
> + fwd += ",hostfwd=%s::%s-:%s" % (f.text("proto"),
> + f.text("host"),
> + f.text("buildenv"))
> %><domain type='kvm'
> xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
> <name>${name}</name>
> @@ -72,14 +78,13 @@ xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
> <address type='virtio-serial' controller='0' bus='0'
> port='1' />
> </channel>
> - <interface type='user' />
> </devices>
> %if prj.has("portforwarding"):
> <qemu:commandline>
> - %for f in prj.node('portforwarding'):
> - <qemu:arg value='-redir' />
> - <qemu:arg value='${f.text("proto")}:${f.text("host")}::${f.text("buildenv")}' />
> - %endfor
> + <qemu:arg value='-device' />
> + <qemu:arg value='virtio-net-pci,netdev=user.0' />
> + <qemu:arg value='-netdev' />
> + <qemu:arg value='user,ipv4,id=user.0${fwd}' />
> </qemu:commandline>
> % endif
> </domain>
> --
> 2.11.0
>
>
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel
More information about the elbe-devel
mailing list