Skip to contentSkip to conversation

libxl: add "downscript=no" to Qemu call

PATCH New Roger Pau Monne 1 participant 2 messages Apr 25, 2012

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/2 libxl: add "downscript=no" to Qemu call

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

Changes since v2:

* Remove non related indentation changes.

Changes since v1:

* Indentation fixes.

---
 tools/libxl/libxl_dm.c |   21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)
tools/libxl/libxl_dm.c +14 -7
index 8cf9d9d..27483e5 100644
@@ -218,9 +218,14 @@ static char ** libxl__build_device_model_args_old(libxl__gc *gc,
                 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,
+                                      "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);
                 ioemu_vifs++;
             }
         }
@@ -462,10 +467,12 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
                                                 vifs[i].model, vifs[i].devid,
                                                 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",
-                                                vifs[i].devid, ifname,
-                                                libxl_tapif_script(gc)));
+                flexarray_append(dm_args, 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)));
                 ioemu_vifs++;
             }
         }
Signature · 1 line
1.7.7.5 (Apple Git-26)
#1 lore raw

PATCH v4 2/2 libxl: fix indentation in libxl_dm.c for qemu

Fixed indentation on Qemu argument construction for network devices.

---
 tools/libxl/libxl_dm.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
tools/libxl/libxl_dm.c +4 -2
index 27483e5..35a2ddc 100644
@@ -216,8 +216,10 @@ static char ** libxl__build_device_model_args_old(libxl__gc *gc,
                 else
                     ifname = libxl__sprintf(gc, "xentap-%s", 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,
+                                      "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,"
Signature · 1 line
1.7.7.5 (Apple Git-26)