On Tue, Aug 24, 2010 at 12:13:49PM +0100, Daniel P. Berrange wrote:
On Tue, Aug 24, 2010 at 11:56:00AM +0100, Richard W.M. Jones wrote:
>
> --
> Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
> libguestfs lets you edit virtual machines. Supports shell scripting,
> bindings from many languages.
http://et.redhat.com/~rjones/libguestfs/
> See what it can do:
http://et.redhat.com/~rjones/libguestfs/recipes.html
> >From 56f426a0be9b0c2e6551ae7a841d236c5909b488 Mon Sep 17 00:00:00 2001
> From: Richard Jones <rjones(a)redhat.com>
> Date: Tue, 24 Aug 2010 11:53:40 +0100
> Subject: [PATCH] New APIs: set-network and get-network to enable network support.
>
> guestfs_set_network (g, true) enables network support in the appliance.
> ---
> src/generator.ml | 19 +++++++++++++++++++
> src/guestfs-internal.h | 1 +
> src/guestfs.c | 13 +++++++++++++
> src/guestfs.pod | 5 +++++
> src/launch.c | 8 ++++++++
> 5 files changed, 46 insertions(+), 0 deletions(-)
> diff --git a/src/launch.c b/src/launch.c
> index 1e1ea8e..df78b1a 100644
> --- a/src/launch.c
> +++ b/src/launch.c
> @@ -410,6 +410,14 @@ guestfs__launch (guestfs_h *g)
> add_cmdline (g, "-device");
> add_cmdline (g,
"virtserialport,chardev=channel0,name=org.libguestfs.channel.0");
>
> + /* Enable user networking. */
> + if (g->enable_network) {
> + add_cmdline (g, "-net");
> + add_cmdline (g, "user,vlan=0,net=" NETWORK);
> + add_cmdline (g, "-net");
> + add_cmdline (g, "nic,model=" NET_IF ",vlan=0");
> + }
If you can rely on QEMU >= 0.12 then you should switch to using -netdev,
since -net is going the way of the Dodo in upstream QEMU.
eg
-netdev user,id=hostnet0
-device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:1b:a1:fc
Yeah, good idea, I'll make that change.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine. Supports Linux and Windows.