|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH RFC 08/10] libxl: add new hotplug interface support for HVM guests
Reads the results of the hotplug script execution and changes
pdev_path libxl_device_disk to point to the block device. This will be
used later when Qemu is launched.
Signed-off-by: Roger Pau Monnà <roger.pau@xxxxxxxxxx>
---
tools/libxl/libxl_create.c | 33 +++++++++++++++++++++++++++++++++
1 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index c176967..1d5410f 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -964,6 +964,10 @@ static void domcreate_launch_dm(libxl__egc *egc,
libxl__multidev *multidev,
libxl__domain_create_state *dcs = CONTAINER_OF(multidev, *dcs, multidev);
STATE_AO_GC(dcs->ao);
int i;
+ char *hotplug_path;
+ const char *pdev;
+ libxl__device dev;
+ libxl_device_disk *disk;
/* convenience aliases */
const uint32_t domid = dcs->guest_domid;
@@ -975,6 +979,35 @@ static void domcreate_launch_dm(libxl__egc *egc,
libxl__multidev *multidev,
goto error_out;
}
+ /*
+ * If using the new hotplug interface change disks pdev_path
+ * to point to the real physical path, so it can be used by Qemu.
+ */
+ for (i = 0; i < d_config->num_disks; i++) {
+ disk = &d_config->disks[i];
+ if (disk->hotplug_version != 0) {
+ /* Update pdev_path */
+ ret = libxl__device_from_disk(gc, domid, disk, &dev);
+ if (ret != 0) {
+ LOG(ERROR, "Invalid or unsupported virtual disk identifier %s",
+ disk->vdev);
+ goto error_out;
+ }
+ hotplug_path = libxl__device_xs_hotplug_path(gc, &dev);
+ ret = libxl__xs_read_checked(gc, XBT_NULL,
+ GCSPRINTF("%s/pdev", hotplug_path),
+ &pdev);
+ if (ret)
+ goto error_out;
+ if (!pdev) {
+ ret = ERROR_FAIL;
+ goto error_out;
+ }
+ free(disk->pdev_path);
+ disk->pdev_path = libxl__strdup(NOGC, pdev);
+ }
+ }
+
for (i = 0; i < d_config->b_info.num_ioports; i++) {
libxl_ioport_range *io = &d_config->b_info.ioports[i];
--
1.7.7.5 (Apple Git-26)
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |