objecter: librados: add optional auid param to

create_pool functions
This commit is contained in:
Greg Farnum 2010-03-08 07:41:35 -08:00
parent 14cdfd4337
commit 9199dd2d9e
4 changed files with 16 additions and 8 deletions

View File

@ -129,7 +129,7 @@ public:
int get_pool_stats(std::vector<string>& ls, map<string,rados_pool_stat_t>& result);
int get_fs_stats( rados_statfs_t& result );
int create_pool(string& name);
int create_pool(string& name, __u64 auid=0);
int delete_pool(const rados_pool_t& pool);
int list(PoolCtx& pool, int max_entries, std::list<object_t>& entries,
@ -532,7 +532,7 @@ int RadosClient::snap_remove( const rados_pool_t pool, const char *snapName)
return reply;
}
int RadosClient::create_pool(string& name)
int RadosClient::create_pool(string& name, __u64 auid)
{
int reply;
@ -541,7 +541,7 @@ int RadosClient::create_pool(string& name)
bool done;
lock.Lock();
objecter->create_pool(name,
new C_SafeCond(&mylock, &cond, &done, &reply));
new C_SafeCond(&mylock, &cond, &done, &reply), auid);
lock.Unlock();
mylock.Lock();
@ -1082,12 +1082,12 @@ int Rados::get_pool_stats(std::vector<string>& v, std::map<string,rados_pool_sta
return client->get_pool_stats(v, result);
}
int Rados::create_pool(const char *name)
int Rados::create_pool(const char *name, __u64 auid)
{
string str(name);
if (!client)
return -EINVAL;
return client->create_pool(str);
return client->create_pool(str, auid);
}
int Rados::delete_pool(const rados_pool_t& pool)
@ -1450,6 +1450,12 @@ extern "C" int rados_create_pool(const char *name)
return radosp->create_pool(sname);
}
extern "C" int rados_create_pool_with_auid(const char *name, __u64 auid)
{
string sname(name);
return radosp->create_pool(sname, auid);
}
extern "C" int rados_delete_pool(const rados_pool_t pool)
{
return radosp->delete_pool(pool);

View File

@ -679,7 +679,7 @@ int Objecter::delete_pool_snap(int pool, string& snapName, Context *onfinish) {
return 0;
}
int Objecter::create_pool(string& name, Context *onfinish) {
int Objecter::create_pool(string& name, Context *onfinish, __u64 auid) {
dout(10) << "create_pool name=" << name << dendl;
PoolOp *op = new PoolOp;
if (!op)
@ -690,6 +690,7 @@ int Objecter::create_pool(string& name, Context *onfinish) {
op->onfinish = onfinish;
op->pool_op = POOL_OP_CREATE;
op_pool[op->tid] = op;
if (auid) op->auid = auid;
pool_op_submit(op);

View File

@ -673,7 +673,7 @@ public:
int create_pool_snap(int pool, string& snapName, Context *onfinish);
int delete_pool_snap(int pool, string& snapName, Context *onfinish);
int create_pool(string& name, Context *onfinish);
int create_pool(string& name, Context *onfinish, __u64 auid=0);
int delete_pool(int pool, Context *onfinish);
void handle_pool_op_reply(MPoolOpReply *m);

View File

@ -53,6 +53,7 @@ void rados_pool_close_ctx(rados_list_ctx_t *ctx);
int rados_pool_list_next(rados_pool_t pool, const char **entry, rados_list_ctx_t *ctx);
int rados_create_pool(const char *name);
int rados_create_pool_with_auid(const char *name, __u64 auid);
int rados_delete_pool(const rados_pool_t pool);
/* snapshots */
@ -132,7 +133,7 @@ public:
std::map<std::string,rados_pool_stat_t>& stats);
int get_fs_stats(rados_statfs_t& result);
int create_pool(const char *name);
int create_pool(const char *name, __u64 auid=0);
int delete_pool(const rados_pool_t& pool);
int snap_create(const rados_pool_t pool, const char *snapname);