From: Ilya Dryomov Date: Sat, 14 Nov 2015 14:12:52 +0000 (+0100) Subject: rbd: unbreak rbd map CLI X-Git-Tag: v10.0.1~68^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=34b2b8f48a82d6837355907b20bd2d1e0ce29658;p=ceph.git rbd: unbreak rbd map CLI Previously, if snapname wasn't specified we would pass NULL to krbd_map(), which was a cue for it to use "-" as a snapshot name. With the new rbd CLI, "" is passed in; same goes for map options. Change krbd_map() accordingly and update its other user. Signed-off-by: Ilya Dryomov --- diff --git a/src/krbd.cc b/src/krbd.cc index 778c109fe4c9..53f64bbbb015 100644 --- a/src/krbd.cc +++ b/src/krbd.cc @@ -107,9 +107,6 @@ static int have_minor_attr(void) return access("/sys/module/rbd/parameters/single_major", F_OK) == 0; } -/* - * options can be NULL - */ static int build_map_buf(CephContext *cct, const char *pool, const char *image, const char *snap, const char *options, string *pbuf) { @@ -164,7 +161,7 @@ static int build_map_buf(CephContext *cct, const char *pool, const char *image, oss << ",key=" << key_name; } - if (options && strcmp(options, "") != 0) + if (strcmp(options, "") != 0) oss << "," << options; oss << " " << pool << " " << image << " " << snap; @@ -283,16 +280,13 @@ out_mon: return r; } -/* - * snap and options can be NULL - */ static int map_image(struct krbd_ctx *ctx, const char *pool, const char *image, const char *snap, const char *options, string *pname) { string buf; int r; - if (!snap) + if (strcmp(snap, "") == 0) snap = "-"; r = build_map_buf(ctx->cct, pool, image, snap, options, &buf); diff --git a/src/test/librbd/fsx.cc b/src/test/librbd/fsx.cc index de40625e8cac..e7bfcf12905d 100644 --- a/src/test/librbd/fsx.cc +++ b/src/test/librbd/fsx.cc @@ -550,7 +550,7 @@ krbd_open(const char *name, struct rbd_ctx *ctx) if (ret < 0) return ret; - ret = krbd_map(krbd, pool, name, NULL, NULL, &devnode); + ret = krbd_map(krbd, pool, name, "", "", &devnode); if (ret < 0) { prt("krbd_map(%s) failed\n", name); return ret;