Skip to content

Commit

Permalink
Merge pull request ceph#18667 from Leeshine/wip-rgw-bug-21615
Browse files Browse the repository at this point in the history
rgw: radosgw-admin zonegroup get and zone get return defaults when there is no realm

Reviewed-by: Orit Wasserman <[email protected]>
Reviewed-by: Casey Bodley <[email protected]>
  • Loading branch information
cbodley authored Nov 20, 2017
2 parents 92b8229 + 2c1653c commit 3149ba1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 4 additions & 1 deletion qa/tasks/radosgw_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/rgw/rgw_rados.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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();
}
Expand Down

0 comments on commit 3149ba1

Please sign in to comment.