]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rbd-nbd: removed default rbd pool name
authorJason Dillaman <dillaman@redhat.com>
Tue, 6 Jun 2017 13:40:13 +0000 (09:40 -0400)
committerJason Dillaman <dillaman@redhat.com>
Wed, 7 Jun 2017 20:26:24 +0000 (16:26 -0400)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/tools/rbd_nbd/rbd-nbd.cc

index a8e4bf60395836b30f301cc1378d62ca839a416c..b247c02546f2e5cf4f83dc807996f36e7a64909e 100644 (file)
@@ -73,7 +73,7 @@ static void usage()
   generic_server_usage();
 }
 
-static std::string devpath, poolname("rbd"), imgname, snapname;
+static std::string devpath, poolname, imgname, snapname;
 static bool readonly = false;
 static int nbds_max = 0;
 static int max_part = 255;
@@ -646,6 +646,14 @@ static int do_map(int argc, const char *argv[])
   if (r < 0)
     goto close_nbd;
 
+  if (poolname.empty()) {
+    r = rados.conf_get("rbd_default_pool", poolname);
+    if (r < 0) {
+      cerr << "rbd-nbd: failed to retrieve default pool" << std::endl;
+      goto close_nbd;
+    }
+  }
+
   r = rados.ioctx_create(poolname.c_str(), io_ctx);
   if (r < 0)
     goto close_nbd;
@@ -792,8 +800,11 @@ static int parse_imgpath(const std::string &imgpath)
     return -EINVAL;
   }
 
-  if (match[1].matched)
+  if (match[1].matched) {
     poolname = match[1];
+  } else {
+    poolname = "";
+  }
 
   imgname = match[2];