]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: make --pool/--image args easier to understand for import
authorJosh Durgin <josh.durgin@inktank.com>
Sat, 15 Sep 2012 00:13:57 +0000 (17:13 -0700)
committerJosh Durgin <josh.durgin@inktank.com>
Tue, 18 Sep 2012 22:21:39 +0000 (15:21 -0700)
There's no need to set the default pool in set_pool_image_name - this
is done later, in a way that doesn't ignore --pool if --dest-pool
is not specified.

This means --pool and --image can be used with import, just like
the rest of the commands. Without this change, --dest and --dest-pool
had to be used, and --pool would be silently ignored for rbd import.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
src/rbd.cc

index 35b85842d49f8cca3b88ccf3eac691cd0eb78cc5..9e2a58ee263776595eaab9b4b79945ba7e00f99c 100644 (file)
@@ -498,14 +498,11 @@ static void set_pool_image_name(const char *orig_pool, const char *orig_img,
   if (orig_pool)
     return;
 
-  if (!orig_img) {
-    *new_pool = strdup("rbd");
+  if (!orig_img)
     return;
-  }
 
   sep = strchr(orig_img, '/');
   if (!sep) {
-    *new_pool= strdup("rbd");
     *new_img = strdup(orig_img);
     goto done_img;
   }
@@ -1261,8 +1258,11 @@ int main(int argc, const char **argv)
     return EXIT_FAILURE;
   }
 
-  if (opt_cmd == OPT_IMPORT && !destname)
-    destname = imgname_from_path(path);
+  if (opt_cmd == OPT_IMPORT && !destname) {
+    destname = imgname;
+    if (!destname)
+      destname = imgname_from_path(path);
+  }
 
   if (opt_cmd != OPT_LIST && opt_cmd != OPT_IMPORT && opt_cmd != OPT_UNMAP && opt_cmd != OPT_SHOWMAPPED &&
       !imgname) {