]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rados: you can now set the crush rule to use when creating a pool
authorGreg Farnum <gregf@hq.newdream.net>
Wed, 26 May 2010 23:58:31 +0000 (16:58 -0700)
committerGreg Farnum <gregf@hq.newdream.net>
Wed, 26 May 2010 23:58:38 +0000 (16:58 -0700)
src/rados.cc

index 7ae68f654b10bbf1428e68c131f45f036f546039..7cfab5404db053541941379f5be8d62e4a4ce6f4 100644 (file)
@@ -48,11 +48,11 @@ void usage()
   cerr << "   put objname -- write object\n";
   cerr << "   rm objname  -- remove object\n";
   cerr << "   ls          -- list objects in pool\n\n";
-  cerr << "   chown 123   -- change the pool owner to auid 123";
+  cerr << "   chown 123   -- change the pool owner to auid 123\n";
 
-  cerr << "   mkpool foo [123]  -- create pool 'foo' [with auid 123]\n";
+  cerr << "   mkpool foo [123[ 4]]  -- create pool 'foo'\n"
+       << "                         [with auid 123[and using crush rule 4]]\n";
   cerr << "   rmpool foo  -- remove pool 'foo'\n";
-  cerr << "   mkpool foo  -- create the pool 'foo'\n";
   cerr << "   lssnap      -- list snaps\n";
   cerr << "   mksnap foo  -- create snap 'foo'\n";
   cerr << "   rmsnap foo  -- remove snap 'foo'\n\n";
@@ -322,13 +322,18 @@ int main(int argc, const char **argv)
 
   else if (strcmp(nargs[0], "mkpool") == 0) {
     int auid = 0;
+    __u8 crush_rule = 0;
     if (nargs.size() < 2)
       usage();
     if (nargs.size() > 2) {
       auid = strtol(nargs[2], 0, 10);
       cerr << "setting auid:" << auid << std::endl;
+      if (nargs.size() > 3) {
+       crush_rule = (__u8)strtol(nargs[3], 0, 10);
+       cerr << "using crush rule " << (int)crush_rule << std::endl;
+      }
     }
-    ret = rados.create_pool(nargs[1], auid);
+    ret = rados.create_pool(nargs[1], auid, crush_rule);
     if (ret < 0) {
       cerr << "error creating pool " << nargs[1] << ": "
           << strerror_r(-ret, buf, sizeof(buf)) << std::endl;