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 <lvshanchun@gmail.com>
This commit is contained in:
lvshanchun 2017-11-01 15:52:48 -04:00
parent c662dc3067
commit 2c1653ca37
2 changed files with 8 additions and 5 deletions

View File

@ -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

View File

@ -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();
}