|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] libxl: wait for state "connected" in libxl__device_disk_local_attach
# HG changeset patch
# User Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
# Date 1338305812 -3600
# Node ID 74155299b076f87300a976ae48af68da6bed2f5f
# Parent 4a812073a87805b93a9630ba598a84b6543cce0f
libxl: wait for state "connected" in libxl__device_disk_local_attach
In order to make sure that the block device is available and ready to be
used, wait for state "connected" in the backend before returning.
Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
[ ijc -- resolved simple conflict in libxl__device_disk_local_detach ]
Committed-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
diff -r 4a812073a878 -r 74155299b076 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c Tue May 29 16:36:51 2012 +0100
+++ b/tools/libxl/libxl.c Tue May 29 16:36:52 2012 +0100
@@ -1781,9 +1781,10 @@ char * libxl__device_disk_local_attach(l
const char *blkdev_start)
{
libxl_ctx *ctx = gc->owner;
- char *dev = NULL;
+ char *dev = NULL, *be_path = NULL;
char *ret = NULL;
int rc, xs_ret;
+ libxl__device device;
xs_transaction_t t = XBT_NULL;
if (in_disk->pdev_path == NULL)
@@ -1863,12 +1864,25 @@ char * libxl__device_disk_local_attach(l
break;
}
+ if (disk->vdev != NULL) {
+ rc = libxl__device_from_disk(gc, LIBXL_TOOLSTACK_DOMID, disk, &device);
+ if (rc < 0)
+ goto out;
+ be_path = libxl__device_backend_path(gc, &device);
+ rc = libxl__wait_for_backend(gc, be_path, "4");
+ if (rc < 0)
+ goto out;
+ }
+ if (dev != NULL)
+ ret = strdup(dev);
+ return ret;
+
out:
if (t != XBT_NULL)
xs_transaction_end(ctx->xsh, t, 1);
- if (dev != NULL)
- ret = strdup(dev);
- return ret;
+ else
+ libxl__device_disk_local_detach(gc, disk);
+ return NULL;
}
int libxl__device_disk_local_detach(libxl__gc *gc, libxl_device_disk *disk)
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |