Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rados: we need to get the latest osdmap when pool does not exists #13289

Merged
merged 1 commit into from Mar 3, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 13 additions & 11 deletions src/librados/RadosClient.cc
Expand Up @@ -88,8 +88,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)
Expand Down Expand Up @@ -439,15 +449,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);
Expand Down