On Wed, Oct 01, 2014 at 05:21:34PM +0100, Daniel P. Berrange wrote:
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 ?
Yes, I suspect it'll be better not to hard-code this.
Using libguestfs backend settings though :-)
http://libguestfs.org/guestfs.3.html#backend-settings
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