]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: unbreak rbd map CLI
authorIlya Dryomov <idryomov@redhat.com>
Sat, 14 Nov 2015 14:12:52 +0000 (15:12 +0100)
committerIlya Dryomov <idryomov@redhat.com>
Sat, 14 Nov 2015 15:38:53 +0000 (16:38 +0100)
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 <idryomov@redhat.com>
src/krbd.cc
src/test/librbd/fsx.cc

index 778c109fe4c97907c821ab717fc1c711b8edb4de..53f64bbbb015f9cc1c35e1214335b4bc29bb22d6 100644 (file)
@@ -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);
index de40625e8caca5d2cb2f1616cc39671bb8dd53e9..e7bfcf12905d7b0dc9a963c5cbc5775c75fb6b07 100644 (file)
@@ -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;