]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
objecter: add change_pool_auid function.
authorGreg Farnum <gregf@hq.newdream.net>
Tue, 23 Mar 2010 20:38:02 +0000 (13:38 -0700)
committerGreg Farnum <gregf@hq.newdream.net>
Thu, 25 Mar 2010 23:18:43 +0000 (16:18 -0700)
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.

src/osd/OSD.cc
src/osdc/Objecter.cc
src/osdc/Objecter.h

index d504220b7b353029330af6fbb1ca0cdeb23912ec..e8464aab875a44eb23d38739c75101a0a017e5bd 100644 (file)
@@ -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;
 
index c2e846b39d08bd53b28b1bc6c1760aa8e765aa2e..74b21cd8c13d2423ceb70c8a0426ed499ada0e21 100644 (file)
@@ -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,
index 665b43020dbb19dceddfbd78e072725e2fad6ebb..b887ef3174a0f08a94e67b8348d77c74e243cce6 100644 (file)
@@ -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);