xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libxl/netbsd: check num_exec in hotplug function
@ 2016-07-04 12:13 Wei Liu
  2016-07-06 17:27 ` Wei Liu
  0 siblings, 1 reply; 6+ messages in thread
From: Wei Liu @ 2016-07-04 12:13 UTC (permalink / raw)
  To: Xen-devel; +Cc: Ian Jackson, Wei Liu, John Nemeth, Roger Pau Monné

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.

Reported-by: John Nemeth <jnemeth@cue.bc.ca>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: John Nemeth <jnemeth@cue.bc.ca>
Cc: Roger Pau Monné <roger.pau@citrix.com>

Ian, this is a backport candidate.
---
 tools/libxl/libxl_netbsd.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/tools/libxl/libxl_netbsd.c b/tools/libxl/libxl_netbsd.c
index 096c057..a79b8aa 100644
--- a/tools/libxl/libxl_netbsd.c
+++ b/tools/libxl/libxl_netbsd.c
@@ -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;
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-07-06 17:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <201607040811.u648B4MN011551@server.cornerstoneservice.ca>
2016-07-04 11:09 ` [PATCH] libxl/netbsd: check num_exec in hotplug function Wei Liu
2016-07-04 11:23   ` Wei Liu
2016-07-04 11:56     ` John Nemeth
2016-07-04 12:02       ` Roger Pau Monné
2016-07-04 12:13 Wei Liu
2016-07-06 17:27 ` Wei Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).