From: Greg Farnum Date: Tue, 23 Mar 2010 20:38:02 +0000 (-0700) Subject: objecter: add change_pool_auid function. X-Git-Tag: v0.20~180 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1a4899d1cb23f18fd150b29b64d479311f77010d;p=ceph.git objecter: add change_pool_auid function. I'm reluctant to stick this in the objecter since it doesn't quite fit, but it's a pool management function and putting it here makes it easy to use elsewhere while maintaining librados' standard function flow. --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index d504220b7b35..e8464aab875a 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -4037,7 +4037,9 @@ void OSD::handle_op(MOSDOp *op) int pool = pgid.pool(); int perm = caps.get_pool_cap(pool, osdmap->get_pg_pool(pool)->v.auid); - dout(10) << "request for pool=" << pool << " perm=" << perm + dout(10) << "request for pool=" << pool << " owner=" + << osdmap->get_pg_pool(pool)->v.auid + << " perm=" << perm << " may_read=" << op->may_read() << " may_write=" << op->may_write() << " may_exec=" << op->may_exec() << dendl; diff --git a/src/osdc/Objecter.cc b/src/osdc/Objecter.cc index c2e846b39d08..74b21cd8c13d 100644 --- a/src/osdc/Objecter.cc +++ b/src/osdc/Objecter.cc @@ -720,6 +720,30 @@ int Objecter::delete_pool(int pool, Context *onfinish) { return 0; } +/** + * change the auid owner of a pool by contacting the monitor. + * This requires the current connection to have write permissions + * on both the pool's current auid and the new (parameter) auid. + * Uses the standard Context callback when done. + */ +int Objecter::change_pool_auid(int pool, Context *onfinish, __u64 auid) +{ + dout(10) << "change_pool_auid " << pool << " to " << auid << dendl; + PoolOp *op = new PoolOp; + if (!op) return -ENOMEM; + op->tid = ++last_tid; + op->pool = pool; + op->name = "change_pool_auid"; + op->onfinish = onfinish; + op->pool_op = POOL_OP_AUID_CHANGE; + op->auid = auid; + op_pool[op->tid] = op; + + pool_op_submit(op); + + return 0; +} + void Objecter::pool_op_submit(PoolOp *op) { dout(10) << "pool_op_submit " << op->tid << dendl; monc->send_mon_message(new MPoolOp(monc->get_fsid(), op->tid, op->pool, diff --git a/src/osdc/Objecter.h b/src/osdc/Objecter.h index 665b43020dbb..b887ef3174a0 100644 --- a/src/osdc/Objecter.h +++ b/src/osdc/Objecter.h @@ -675,6 +675,7 @@ public: int create_pool(string& name, Context *onfinish, __u64 auid=0); int delete_pool(int pool, Context *onfinish); + int change_pool_auid(int pool, Context *onfinish, __u64 auid); void handle_pool_op_reply(MPoolOpReply *m);