]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: update for librbd api changes
authorJosh Durgin <josh.durgin@dreamhost.com>
Fri, 25 Feb 2011 18:57:27 +0000 (10:57 -0800)
committerJosh Durgin <josh.durgin@dreamhost.com>
Fri, 25 Feb 2011 18:58:09 +0000 (10:58 -0800)
Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>
src/rbd.cc

index f55b3aff619e23d15fc4b1a23794e278a6fd4c11..a9d8de490faa5534c7f815cf41d1142ccb892ca0 100644 (file)
@@ -342,8 +342,8 @@ static int do_import(librados::pool_t pool, const char *imgname, int *order, con
     return r;
   }
   librbd::Image *image = NULL;
-  image = rbd.image_open(pool, imgname);
-  if (!image) {
+  r = rbd.open(pool, image, imgname);
+  if (r < 0) {
     cerr << "failed to open image" << std::endl;
     return r;
   }
@@ -488,7 +488,7 @@ static int do_watch(librados::pool_t& pp, const char *imgname)
 static void err_exit(librados::pool_t pool, librbd::Image *image = NULL)
 {
   if (image)
-    image->close();
+    delete image;
   rados.close_pool(pool);
   rados.shutdown();
   exit(1);
@@ -707,9 +707,9 @@ int main(int argc, const char **argv)
       (opt_cmd == OPT_RESIZE || opt_cmd == OPT_INFO || opt_cmd == OPT_SNAP_LIST ||
        opt_cmd == OPT_SNAP_CREATE || opt_cmd == OPT_SNAP_ROLLBACK ||
        opt_cmd == OPT_SNAP_REMOVE || opt_cmd == OPT_EXPORT || opt_cmd == OPT_WATCH)) {
-    image = rbd.image_open(pool, imgname);
-    if (!image) {
-      cerr << "error opening image " << imgname << std::endl;
+    r = rbd.open(pool, image, imgname);
+    if (r < 0) {
+      cerr << "error opening image " << imgname << ": " << strerror(r) << std::endl;
       err_exit(pool);
     }
   }
@@ -885,7 +885,7 @@ int main(int argc, const char **argv)
   }
 
   if (image)
-    image->close();
+    delete image;
 
   rados.close_pool(pool);
   rados.shutdown();