[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH RFC 5/9] libxl: introduce specific JSON error codes
Signed-off-by: Rob Hoes <rob.hoes@xxxxxxxxxx> --- tools/libxl/libxl_dom.c | 6 +++--- tools/libxl/libxl_internal.c | 4 +--- tools/libxl/libxl_json.c | 4 ++-- tools/libxl/libxl_types.idl | 5 +++++ 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c index a0c9850..efdb570 100644 --- a/tools/libxl/libxl_dom.c +++ b/tools/libxl/libxl_dom.c @@ -2323,7 +2323,7 @@ int libxl__userdata_store(libxl__gc *gc, uint32_t domid, goto out; } - rc = ERROR_FAIL; + rc = ERROR_JSON_SET_CONFIG; fd = open(newfilename, O_RDWR | O_CREAT | O_TRUNC, 0600); if (fd < 0) @@ -2400,13 +2400,13 @@ int libxl__userdata_retrieve(libxl__gc *gc, uint32_t domid, e = libxl_read_file_contents(CTX, filename, data_r ? &data : 0, &datalen); if (e && errno != ENOENT) { - rc = ERROR_FAIL; + rc = ERROR_JSON_GET_CONFIG; goto out; } if (!e && !datalen) { LIBXL__LOG(CTX, LIBXL__LOG_ERROR, "userdata file %s is empty", filename); if (data_r) assert(!*data_r); - rc = ERROR_FAIL; + rc = ERROR_JSON_GET_CONFIG; goto out; } diff --git a/tools/libxl/libxl_internal.c b/tools/libxl/libxl_internal.c index c2c67bd..4ac43f8 100644 --- a/tools/libxl/libxl_internal.c +++ b/tools/libxl/libxl_internal.c @@ -500,7 +500,6 @@ int libxl__get_domain_configuration(libxl__gc *gc, uint32_t domid, if (rc) { LOGEV(ERROR, rc, "failed to retrieve domain configuration for domain %d", domid); - rc = ERROR_FAIL; goto out; } @@ -527,7 +526,7 @@ int libxl__set_domain_configuration(libxl__gc *gc, uint32_t domid, LOGE(ERROR, "failed to convert domain configuration to JSON for domain %d", domid); - rc = ERROR_FAIL; + rc = ERROR_JSON_SET_CONFIG; goto out; } @@ -537,7 +536,6 @@ int libxl__set_domain_configuration(libxl__gc *gc, uint32_t domid, if (rc) { LOGEV(ERROR, rc, "failed to store domain configuration for domain %d", domid); - rc = ERROR_FAIL; goto out; } diff --git a/tools/libxl/libxl_json.c b/tools/libxl/libxl_json.c index 346929a..973d535 100644 --- a/tools/libxl/libxl_json.c +++ b/tools/libxl/libxl_json.c @@ -1044,14 +1044,14 @@ int libxl__object_from_json(libxl_ctx *ctx, const char *type, LOG(ERROR, "unable to generate libxl__json_object from JSON representation of %s.", type); - rc = ERROR_FAIL; + rc = ERROR_JSON_PARSE_CONFIG; goto out; } rc = parse(gc, o, p); if (rc) { LOG(ERROR, "unable to convert libxl__json_object to %s. (rc=%d)", type, rc); - rc = ERROR_FAIL; + rc = ERROR_JSON_PARSE_CONFIG; goto out; } diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl index 52795e4..b905353 100644 --- a/tools/libxl/libxl_types.idl +++ b/tools/libxl/libxl_types.idl @@ -117,6 +117,11 @@ libxl_error = Enumeration("error", [ # libxc connection error (ENUM_PREV, "XC_CONNECT"), + + # JSON domain config errors + (ENUM_PREV, "JSON_GET_CONFIG"), + (ENUM_PREV, "JSON_SET_CONFIG"), + (ENUM_PREV, "JSON_PARSE_CONFIG"), ], 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 |