libxl: make hotplug execution conditional on backend_domid == domid
authorRoger Pau Monne <roger.pau@citrix.com>
Wed, 2 Oct 2013 09:24:25 +0000 (11:24 +0200)
committerIan Campbell <ian.campbell@citrix.com>
Tue, 5 Nov 2013 11:40:49 +0000 (11:40 +0000)
libxl currently refuses to execute hotplug scripts if the backend
domid of a device is different than LIBXL_TOOLSTACK_DOMID. This will
prevent libxl from executing hotplug scripts when running on a domain
different than LIBXL_TOOLSTACK_DOMID, we should instead check if
backend_domid is different than current domid.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/libxl/libxl_device.c

index 2971dd354d6995e4e938445c79aebf660d1d96ed..48acc9235ed5d52034b061362c96f26eec5873e1 100644 (file)
@@ -908,12 +908,15 @@ static void device_hotplug(libxl__egc *egc, libxl__ao_device *aodev)
     int rc = 0;
     int hotplug;
     pid_t pid;
+    uint32_t domid;
 
     /*
      * If device is attached from a driver domain don't try to execute
      * hotplug scripts
      */
-    if (aodev->dev->backend_domid != LIBXL_TOOLSTACK_DOMID)
+    rc = libxl__get_domid(gc, &domid);
+    if (rc) goto out;
+    if (aodev->dev->backend_domid != domid)
         goto out;
 
     /* Check if we have to execute hotplug scripts for this device