Skip to contentSkip to conversation

libxl/netbsd: check num_exec in hotplug function

PATCH In review Wei Liu 1 participant 2 messages Jul 4, 2016 – Jul 6, 2016

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

PATCH 1/1 libxl/netbsd: check num_exec in hotplug function

This basically replicates the same logic in libxl_linux.c but with one change -- only test num_exec == 0 in nic hotplug case because NetBSD let QEMU call a script itself. Without this patch libxl will loop indefinitely trying to execute hotplug script.

---
Cc: Ian Jackson <[email protected]>
Cc: John Nemeth <[email protected]>
Cc: Roger Pau Monné <[email protected]>

Ian, this is a backport candidate.

---
 tools/libxl/libxl_netbsd.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
tools/libxl/libxl_netbsd.c +21 -0
index 096c057..a79b8aa 100644
@@ -68,7 +68,28 @@ int libxl__get_hotplug_script_info(libxl__gc *gc, libxl__device *dev,
 
     switch (dev->backend_kind) {
     case LIBXL__DEVICE_KIND_VBD:
+        if (num_exec != 0) {
+            LOG(DEBUG, "num_exec %d, not running hotplug scripts", num_exec);
+            rc = 0;
+            goto out;
+        }
+        rc = libxl__hotplug(gc, dev, args, action);
+        if (!rc) rc = 1;
+        break;
     case LIBXL__DEVICE_KIND_VIF:
+        /*
+         * If domain has a stubdom we don't have to execute hotplug scripts
+         * for emulated interfaces
+         *
+         * NetBSD let QEMU call a script to plug emulated nic, so
+         * only test if num_exec == 0 in that case.
+         */
+        if ((num_exec != 0) ||
+            (libxl_get_stubdom_id(CTX, dev->domid) && num_exec)) {
+            LOG(DEBUG, "num_exec %d, not running hotplug scripts", num_exec);
+            rc = 0;
+            goto out;
+        }
         rc = libxl__hotplug(gc, dev, args, action);
         if (!rc) rc = 1;
         break;
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
author
#1 lore raw
Quoted 8 lines · Wei Liu

This basically replicates the same logic in libxl_linux.c but with one change -- only test num_exec == 0 in nic hotplug case because NetBSD let QEMU call a script itself. Without this patch libxl will loop indefinitely trying to execute hotplug script.

Queued.

I think Roger's ack is sufficient for BSD related code and John confirmed in the other thread this fixed his problem.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel