From 34d8eec9e23edec174a96d16bf42a0b8df118183 Mon Sep 17 00:00:00 2001 From: Josh Durgin Date: Fri, 14 Sep 2012 17:13:57 -0700 Subject: [PATCH] rbd: make --pool/--image args easier to understand for import 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 --- src/rbd.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/rbd.cc b/src/rbd.cc index c8090c19a51db..f95898fe79dd1 100644 --- a/src/rbd.cc +++ b/src/rbd.cc @@ -383,14 +383,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; } @@ -1077,8 +1074,11 @@ int main(int argc, const char **argv) usage_exit(); } - 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) { -- 2.39.5