[Libguestfs] [PATCH 2/2] launch: libvirt: Use qemu-bridge-helper to implement a full network (RHBZ#1148012).

Daniel P. Berrange berrange at redhat.com
Wed Oct 1 16:21:34 UTC 2014


On Tue, Sep 30, 2014 at 04:44:05PM +0100, Richard W.M. Jones wrote:
> When using the libvirt backend, don't use the SLIRP.  Use
> qemu-bridge-helper via libvirt to give us a full network connection.
> One consequence of this is that 'ping' works in virt-builder
> --run-command.
> 
> Note unfortunately this does not fix virt-rescue (since it overrides
> the default backend and uses 'direct' for various reasons).
> ---
>  src/launch-libvirt.c | 34 +++++++++++++---------------------
>  1 file changed, 13 insertions(+), 21 deletions(-)
> 
> diff --git a/src/launch-libvirt.c b/src/launch-libvirt.c
> index 706ae38..50c3f9d 100644
> --- a/src/launch-libvirt.c
> +++ b/src/launch-libvirt.c
> @@ -1236,6 +1236,19 @@ construct_libvirt_xml_devices (guestfs_h *g,
>        } end_element ();
>      } end_element ();
>  
> +    /* Connect to libvirt bridge virbr0 (see: RHBZ#1148012). */
> +    if (g->enable_network) {
> +      start_element ("interface") {
> +        attribute ("type", "bridge");
> +        start_element ("source") {
> +          attribute ("bridge", "virbr0");
> +        } end_element ();
> +        start_element ("model") {
> +          attribute ("type", "virtio");
> +        } end_element ();
> +      } end_element ();
> +    }
> +
>    } end_element (); /* </devices> */

Looks fine for a default config. I wonder if there's mileage in having
a LIBGUESTFS_LIBVIRT_BRIDGE  env variable to override virbr0 ?


Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the Libguestfs mailing list