Re: [PATCH 4/5] libxl: add "downscript=no" to Qemu call

Ian Campbell
Mon, 16 Apr 2012 16:48:09 -0000

On Mon, 2012-04-16 at 16:06 +0100, Roger Pau Monne
wrote:
> Currently we only pass script=no to Qemu, to avoid calling any scripts when
> attaching a tap interface, but we should also pass downscript=no to avoid
Qemu
> trying to execute a script when disconnecting the interface. This prevents
the
> following harmless error message:
>
> /etc/qemu-ifdown: could not launch network script
>
> Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
> ---
>  tools/libxl/libxl_dm.c |   17 +++++++++++------
>  1 files changed, 11 insertions(+), 6 deletions(-)
>
> diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
> index ba5bef7..8dc588d 100644
> --- a/tools/libxl/libxl_dm.c
> +++ b/tools/libxl/libxl_dm.c
> @@ -216,11 +216,14 @@ static char **
libxl__build_device_model_args_old(libxl__gc *gc,
>                  else
>                      ifname = vifs[i].ifname;
>                  flexarray_vappend(dm_args,
> -                                "-net", libxl__sprintf(gc,
"nic,vlan=%d,macaddr=%s,model=%s",
> -                                                       vifs[i].devid,
smac, vifs[i].model),
> -                                "-net", libxl__sprintf(gc,
"tap,vlan=%d,ifname=%s,bridge=%s,script=%s",
> -                                                       vifs[i].devid,
ifname, vifs[i].bridge, libxl_tapif_script(gc)),
> -                                NULL);
> +                "-net", libxl__sprintf(gc,
"nic,vlan=%d,macaddr=%s,model=%s",
> +                                       vifs[i].devid, smac,
vifs[i].model),
> +                "-net", libxl__sprintf(gc,
> +
"tap,vlan=%d,ifname=%s,bridge=%s,script=%s,"
> +                               "downscript=%s",
> +                               vifs[i].devid, ifname, vifs[i].bridge,
> +                               libxl_tapif_script(gc),
libxl_tapif_script(gc)),
> +                               NULL);

I think these should be indented at least a little bit wrt the
flexarray_vappend. Since you''ve already split the string you might just
need to re-wrap a bit to fit in 80 chars (which I guess is why you
changed this)

>                  ioemu_vifs++;
>              }
>          }
> @@ -462,8 +465,10 @@ static char **
libxl__build_device_model_args_new(libxl__gc *gc,
>                                                  vifs[i].devid, smac));
>                  flexarray_append(dm_args, "-netdev");
>                  flexarray_append(dm_args,
> -                   libxl__sprintf(gc,
"type=tap,id=net%d,ifname=%s,script=%s",
> +                   libxl__sprintf(gc,
"type=tap,id=net%d,ifname=%s,script=%s,"
> +                                      "downscript=%s",
>                                                  vifs[i].devid, ifname,
> +                                                libxl_tapif_script(gc),
>                                                  libxl_tapif_script(gc)));

The indentation here is now inconsistent.

Other than the whitepace issues:

Acked-by: Ian Campbell <ian.campbell@citrix.com>

>                  ioemu_vifs++;
>              }