Merge pull request from somnathr/wip-sd-check-pool-existence

RadosClient: Adding pool existence checks for pool create interfaces.

Reviewed-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Sage Weil 2014-08-08 17:53:54 -07:00
commit 448edb191c

View File

@ -546,13 +546,19 @@ bool librados::RadosClient::put() {
int librados::RadosClient::pool_create(string& name, unsigned long long auid,
__u8 crush_rule)
{
int reply;
lock.Lock();
int r = wait_for_osdmap();
if (r < 0) {
lock.Unlock();
return r;
}
Mutex mylock ("RadosClient::pool_create::mylock");
int reply;
Cond cond;
bool done;
Context *onfinish = new C_SafeCond(&mylock, &cond, &done, &reply);
lock.Lock();
reply = objecter->create_pool(name, onfinish, auid, crush_rule);
lock.Unlock();
@ -572,8 +578,13 @@ int librados::RadosClient::pool_create_async(string& name, PoolAsyncCompletionIm
__u8 crush_rule)
{
Mutex::Locker l(lock);
int r = wait_for_osdmap();
if (r < 0)
return r;
Context *onfinish = new C_PoolAsync_Safe(c);
int r = objecter->create_pool(name, onfinish, auid, crush_rule);
r = objecter->create_pool(name, onfinish, auid, crush_rule);
if (r < 0) {
delete onfinish;
}