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

[Xen-devel] [PATCH] libxl: locally attach disks with hotplug scripts for bootloader execution



Or else bootloader execution fails. Tested using an iSCSI disk.

Signed-off-by: Roger Pau Monnà <roger.pau@xxxxxxxxxx>
Reported-by: Hildebrand, Nils <Nils.Hildebrand@xxxxxxxxxxx>
Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
Cc: Wei Liu <wei.liu2@xxxxxxxxxx>
Cc: George Dunlap <george.dunlap@xxxxxxxxxxxxx>
---
 tools/libxl/libxl.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index 9117b01..6430836 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -3063,9 +3063,16 @@ void libxl__device_disk_local_initiate_attach(libxl__egc 
*egc,
 
     switch (disk->backend) {
         case LIBXL_DISK_BACKEND_PHY:
-            LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "locally attaching PHY disk %s",
-                       disk->pdev_path);
-            dev = disk->pdev_path;
+            if (disk->script == NULL && disk->backend_domname == NULL) {
+                LOG(DEBUG, "locally attaching PHY disk %s", disk->pdev_path);
+                dev = disk->pdev_path;
+            } else {
+                libxl__prepare_ao_device(ao, &dls->aodev);
+                dls->aodev.callback = local_device_attach_cb;
+                device_disk_add(egc, LIBXL_TOOLSTACK_DOMID, disk, &dls->aodev,
+                                libxl__alloc_vdev, (void *) blkdev_start);
+                return;
+            }
             break;
         case LIBXL_DISK_BACKEND_TAP:
             switch (disk->format) {
@@ -3142,7 +3149,7 @@ static void local_device_attach_cb(libxl__egc *egc, 
libxl__ao_device *aodev)
     }
 
     dev = GCSPRINTF("/dev/%s", disk->vdev);
-    LOG(DEBUG, "locally attaching qdisk %s", dev);
+    LOG(DEBUG, "locally attaching disk %s", dev);
 
     rc = libxl__device_from_disk(gc, LIBXL_TOOLSTACK_DOMID, disk, &device);
     if (rc < 0)
@@ -3183,6 +3190,7 @@ void libxl__device_disk_local_initiate_detach(libxl__egc 
*egc,
 
     switch (disk->backend) {
         case LIBXL_DISK_BACKEND_QDISK:
+        case LIBXL_DISK_BACKEND_PHY:
             if (disk->vdev != NULL) {
                 GCNEW(device);
                 rc = libxl__device_from_disk(gc, LIBXL_TOOLSTACK_DOMID,
@@ -3199,7 +3207,6 @@ void libxl__device_disk_local_initiate_detach(libxl__egc 
*egc,
             /* disk->vdev == NULL; fall through */
         default:
             /*
-             * Nothing to do for PHYSTYPE_PHY.
              * For other device types assume that the blktap2 process is
              * needed by the soon to be started domain and do nothing.
              */
-- 
1.9.5 (Apple Git-50.3)


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

 


Rackspace

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