]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: add a new error message for user conflict when using Admin Ops API 5974/head
authorSangdi <xu.sangdi@h3c>
Fri, 18 Sep 2015 03:02:07 +0000 (11:02 +0800)
committerSangdi <xu.sangdi@h3c>
Fri, 18 Sep 2015 03:18:52 +0000 (11:18 +0800)
Add a new error message to indicate user conflict, which was using the error code for bucket conflict.

Signed-off-by: Sangdi Xu <xu.sangdi@h3c.com>
src/rgw/rgw_common.h
src/rgw/rgw_http_errors.h
src/rgw/rgw_user.cc

index 8ad0733a9a65a1c9e456f487215d2b33316c95e5..6fa6825e05cf1cba90f620b58885d0959b6d699d 100644 (file)
@@ -149,6 +149,7 @@ using ceph::crypto::MD5;
 #define ERR_SIGNATURE_NO_MATCH   2027
 #define ERR_INVALID_ACCESS_KEY   2028
 #define ERR_MALFORMED_XML        2029
+#define ERR_USER_EXIST           2030
 #define ERR_USER_SUSPENDED       2100
 #define ERR_INTERNAL_ERROR       2200
 #define ERR_NOT_IMPLEMENTED      2201
index 1b8ca3623ab8d21aa65b3e9039f1ddc408b1f418..aaa5312cbec6e124db0ba3be82e19194d6ff3623 100644 (file)
@@ -50,6 +50,7 @@ const static struct rgw_http_errors RGW_HTTP_ERRORS[] = {
     { ERR_METHOD_NOT_ALLOWED, 405, "MethodNotAllowed" },
     { ETIMEDOUT, 408, "RequestTimeout" },
     { EEXIST, 409, "BucketAlreadyExists" },
+    { ERR_USER_EXIST, 409, "UserAlreadyExists" },
     { ENOTEMPTY, 409, "BucketNotEmpty" },
     { ERR_PRECONDITION_FAILED, 412, "PreconditionFailed" },
     { ERANGE, 416, "InvalidRange" },
index 47475c3d8b5ea61da17a3a97d4eb39022f6024c1..5dee3a271cc139fa5accac1a6e1701ae6b624170 100644 (file)
@@ -2200,8 +2200,11 @@ int RGWUserAdminOp_User::create(RGWRados *store, RGWUserAdminOpState& op_state,
   Formatter *formatter = flusher.get_formatter();
 
   ret = user.add(op_state, NULL);
-  if (ret < 0)
+  if (ret < 0) {
+    if (ret == -EEXIST)
+      ret = -ERR_USER_EXIST;
     return ret;
+  }
 
   ret = user.info(info, NULL);
   if (ret < 0)