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

[Xen-devel] [PATCH RFC 4/9] libxl: use explicit error codes in libxl_ctx_alloc



Signed-off-by: Rob Hoes <rob.hoes@xxxxxxxxxx>
---
 tools/libxl/libxl.c         | 6 +++---
 tools/libxl/libxl_event.c   | 2 +-
 tools/libxl/libxl_types.idl | 3 +++
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index a6eb2df..f622981 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -89,7 +89,7 @@ int libxl_ctx_alloc(libxl_ctx **pctx, int version,
         LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Failed to initialize mutex");
         free(ctx);
         ctx = 0;
-        rc = ERROR_FAIL;
+        rc = ERROR_LOCK_FAIL;
         goto out;
     }
 
@@ -107,7 +107,7 @@ int libxl_ctx_alloc(libxl_ctx **pctx, int version,
     ctx->xch = xc_interface_open(lg,lg,0);
     if (!ctx->xch) {
         LOGEV(ERROR, errno, "cannot open libxc handle");
-        rc = ERROR_FAIL; goto out;
+        rc = ERROR_XC_CONNECT; goto out;
     }
 
     ctx->xsh = xs_daemon_open();
@@ -115,7 +115,7 @@ int libxl_ctx_alloc(libxl_ctx **pctx, int version,
         ctx->xsh = xs_domain_open();
     if (!ctx->xsh) {
         LOGEV(ERROR, errno, "cannot connect to xenstore");
-        rc = ERROR_FAIL; goto out;
+        rc = ERROR_XS_CONNECT; goto out;
     }
 
     *pctx = ctx;
diff --git a/tools/libxl/libxl_event.c b/tools/libxl/libxl_event.c
index 9ff4e78..b1e82c1 100644
--- a/tools/libxl/libxl_event.c
+++ b/tools/libxl/libxl_event.c
@@ -740,7 +740,7 @@ int libxl__ctx_evtchn_init(libxl__gc *gc) {
     xce = xc_evtchn_open(CTX->lg, 0);
     if (!xce) {
         LOGE(ERROR,"cannot open libxc evtchn handle");
-        rc = ERROR_FAIL;
+        rc = ERROR_XC_CONNECT;
         goto out;
     }
 
diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
index e9b3477..52795e4 100644
--- a/tools/libxl/libxl_types.idl
+++ b/tools/libxl/libxl_types.idl
@@ -114,6 +114,9 @@ libxl_error = Enumeration("error", [
     (ENUM_PREV, "XS_TRANS_START"),
     (ENUM_PREV, "XS_TRANS_COMMIT"),
     (ENUM_PREV, "XS_REMOVE"),
+        
+    # libxc connection error
+    (ENUM_PREV, "XC_CONNECT"),
     ], value_namespace = "")
 
 libxl_domain_type = Enumeration("domain_type", [
-- 
2.4.1


_______________________________________________
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®.