[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH RFC 7/9] libxl: introduce specific error codes in libxl_device_disk_add
Signed-off-by: Rob Hoes <rob.hoes@xxxxxxxxxx> --- tools/libxl/libxl.c | 21 ++++++++++++++------- tools/libxl/libxl_types.idl | 13 +++++++++++++ 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index f622981..2f56c6e 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -2008,9 +2008,16 @@ static int libxl__device_nextid(libxl__gc *gc, uint32_t domid, char *device) static int libxl__resolve_domid(libxl__gc *gc, const char *name, uint32_t *domid) { + int rc; if (!name) return 0; - return libxl_domain_qualifier_to_domid(CTX, name, domid); + + rc = libxl_domain_qualifier_to_domid(CTX, name, domid); + + if (rc < 0) + return ERROR_DOMAIN_NOTFOUND; + else + return rc; } /******************************************************************************/ @@ -2326,7 +2333,7 @@ int libxl__device_from_disk(libxl__gc *gc, uint32_t domid, if (devid==-1) { LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Invalid or unsupported" " virtual disk identifier %s", disk->vdev); - return ERROR_INVAL; + return ERROR_INVAL_DISK_VDEV; } device->backend_domid = disk->backend_domid; @@ -2345,7 +2352,7 @@ int libxl__device_from_disk(libxl__gc *gc, uint32_t domid, default: LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "unrecognized disk backend type: %d\n", disk->backend); - return ERROR_INVAL; + return ERROR_INVAL_DISK_BACKEND; } device->domid = domid; @@ -2391,7 +2398,7 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid, libxl_domain_type type = libxl__domain_type(gc, domid); if (type == LIBXL_DOMAIN_TYPE_INVALID) { - rc = ERROR_FAIL; + rc = ERROR_INVAL_DOMAIN_TYPE; goto out; } @@ -2423,7 +2430,7 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid, assert(get_vdev_user); disk->vdev = get_vdev(gc, get_vdev_user, t); if (disk->vdev == NULL) { - rc = ERROR_FAIL; + rc = ERROR_DISK_VDEV_UNDETERMINED; goto out; } } @@ -2488,7 +2495,7 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid, if (!dev) { LOG(ERROR, "failed to get blktap devpath for %p\n", disk->pdev_path); - rc = ERROR_FAIL; + rc = ERROR_DISK_PDEV_NOT_FOUND; goto out; } } @@ -2511,7 +2518,7 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid, break; default: LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "unrecognized disk backend type: %d\n", disk->backend); - rc = ERROR_INVAL; + rc = ERROR_INVAL_DISK_BACKEND; goto out; } diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl index 3c44b41..15e4af2 100644 --- a/tools/libxl/libxl_types.idl +++ b/tools/libxl/libxl_types.idl @@ -125,6 +125,19 @@ libxl_error = Enumeration("error", [ # Unable to initialise device connection watch (ENUM_PREV, "DEVICE_WAIT_INIT"), + + # Domain type invalid + (ENUM_PREV, "INVAL_DOMAIN_TYPE"), + + # Disk parameters invalid + (ENUM_PREV, "INVAL_DISK_VDEV"), + (ENUM_PREV, "INVAL_DISK_BACKEND"), + + # Disk parameters could not be determined + (ENUM_PREV, "DISK_VDEV_UNDETERMINED"), + + # Physical disk device could not be found + (ENUM_PREV, "DISK_PDEV_NOT_FOUND"), ], value_namespace = "") libxl_domain_type = Enumeration("domain_type", [ -- 2.4.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |