mirror of
https://github.com/ceph/ceph
synced 2024-12-30 07:23:11 +00:00
Merge pull request #13289 from songbaisen/s13
rados: we need to get the latest osdmap when pool does not exists Reviewed-by: Sage Weil <sage@redhat.com> Reviewed-by: Josh Durgin <jdurgin@redhat.com>
This commit is contained in:
commit
4657560503
@ -89,8 +89,18 @@ int64_t librados::RadosClient::lookup_pool(const char *name)
|
||||
return r;
|
||||
}
|
||||
|
||||
return objecter->with_osdmap(std::mem_fn(&OSDMap::lookup_pg_pool_name),
|
||||
name);
|
||||
int64_t ret = objecter->with_osdmap(std::mem_fn(&OSDMap::lookup_pg_pool_name),
|
||||
name);
|
||||
if (-ENOENT == ret) {
|
||||
// Make sure we have the latest map
|
||||
int r = wait_for_latest_osdmap();
|
||||
if (r < 0)
|
||||
return r;
|
||||
ret = objecter->with_osdmap(std::mem_fn(&OSDMap::lookup_pg_pool_name),
|
||||
name);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool librados::RadosClient::pool_requires_alignment(int64_t pool_id)
|
||||
@ -437,15 +447,7 @@ int librados::RadosClient::create_ioctx(const char *name, IoCtxImpl **io)
|
||||
{
|
||||
int64_t poolid = lookup_pool(name);
|
||||
if (poolid < 0) {
|
||||
// Make sure we have the latest map
|
||||
int r = wait_for_latest_osdmap();
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
poolid = lookup_pool(name);
|
||||
if (poolid < 0) {
|
||||
return (int)poolid;
|
||||
}
|
||||
return (int)poolid;
|
||||
}
|
||||
|
||||
*io = new librados::IoCtxImpl(this, objecter, poolid, CEPH_NOSNAP);
|
||||
|
Loading…
Reference in New Issue
Block a user