From 2c1653ca379d0bf78dfcfe931d895a16b9bfd21f Mon Sep 17 00:00:00 2001 From: lvshanchun Date: Wed, 1 Nov 2017 15:52:48 -0400 Subject: [PATCH] radosgw-admin zonegroup get and zone get return defaults when there is no realm Fixs: http://tracker.ceph.com/issues/21615 Signed-off-by: lvshanchun --- qa/tasks/radosgw_admin.py | 5 ++++- src/rgw/rgw_rados.cc | 8 ++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/qa/tasks/radosgw_admin.py b/qa/tasks/radosgw_admin.py index 8e744e3b662..f23a3b9ef40 100644 --- a/qa/tasks/radosgw_admin.py +++ b/qa/tasks/radosgw_admin.py @@ -908,7 +908,7 @@ def task(ctx, config): stdin=StringIO(json.dumps(out)), check_status=True) - (err, out) = rgwadmin(ctx, client, ['zone', 'get','--rgw-zone','default']) + (err, out) = rgwadmin(ctx, client, ['zone', 'get']) assert len(out) > 0 assert len(out['placement_pools']) == orig_placement_pools + 1 @@ -918,6 +918,9 @@ def task(ctx, config): (err, out) = rgwadmin(ctx, client, zonecmd, check_status=True) + # TESTCASE 'zonegroup-info', 'zonegroup', 'get', 'get zonegroup info', 'succeeds' + (err, out) = rgwadmin(ctx, client, ['zonegroup', 'get'], check_status=True) + import sys from tasks.radosgw_admin import task from teuthology.config import config diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 89bf8851a80..f2a77d913f0 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -482,9 +482,9 @@ int RGWZoneGroup::read_default_id(string& default_id, bool old_format) /* try using default realm */ RGWRealm realm; int ret = realm.init(cct, store); + // no default realm exist if (ret < 0) { - ldout(cct, 10) << "could not read realm id: " << cpp_strerror(-ret) << dendl; - return -ENOENT; + return read_id(default_zonegroup_name, default_id); } realm_id = realm.get_id(); } @@ -1808,9 +1808,9 @@ int RGWZoneParams::read_default_id(string& default_id, bool old_format) /* try using default realm */ RGWRealm realm; int ret = realm.init(cct, store); + //no default realm exist if (ret < 0) { - ldout(cct, 10) << "could not read realm id: " << cpp_strerror(-ret) << dendl; - return -ENOENT; + return read_id(default_zone_name, default_id); } realm_id = realm.get_id(); }