[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] libxl/netbsd: check num_exec in hotplug function



commit db59dbc46e0312a38978d22c6bd72b554a2f1c91
Author:     Wei Liu <wei.liu2@xxxxxxxxxx>
AuthorDate: Sat Jul 2 12:35:30 2016 +0100
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Wed Jul 6 18:22:53 2016 +0100

    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.
    
    Reported-by: John Nemeth <jnemeth@xxxxxxxxx>
    Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    Acked-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
 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;
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.