]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix the bug of radowgw-admin zonegroup set requires realm 22767/head
authorlvshanchun <lvshanchun@gmail.com>
Tue, 21 Nov 2017 02:17:53 +0000 (10:17 +0800)
committerPrashant D <pdhange@redhat.com>
Fri, 29 Jun 2018 00:49:05 +0000 (20:49 -0400)
Signed-off-by: lvshanchun <lvshanchun@gmail.com>
(cherry picked from commit 361be454ac2b917f777604f156711f752a6137f4)

src/rgw/rgw_admin.cc

index 350875984125895fa3aa0e19535b5525340f4ad1..24e6365e58a9f6db71923012cf08e3b81ff5cebc 100644 (file)
@@ -3947,7 +3947,9 @@ int main(int argc, const char **argv)
       {
        RGWRealm realm(realm_id, realm_name);
        int ret = realm.init(g_ceph_context, store);
-       if (ret < 0) {
+       bool default_realm_not_exist = (ret == -ENOENT && realm_id.empty() && realm_name.empty());
+
+       if (ret < 0 && !default_realm_not_exist ) {
          cerr << "failed to init realm: " << cpp_strerror(-ret) << std::endl;
          return -ret;
        }
@@ -3962,7 +3964,7 @@ int main(int argc, const char **argv)
        if (ret < 0) {
          return 1;
        }
-       if (zonegroup.realm_id.empty()) {
+       if (zonegroup.realm_id.empty() && !default_realm_not_exist) {
          zonegroup.realm_id = realm.get_id();
        }
        ret = zonegroup.create();