]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: use helper to set ImageCtx snapid
authorJosh Durgin <josh.durgin@dreamhost.com>
Fri, 28 Jan 2011 19:02:59 +0000 (11:02 -0800)
committerYehuda Sadeh <yehuda.sadeh@dreamhost.com>
Mon, 7 Feb 2011 22:41:57 +0000 (14:41 -0800)
src/librbd.cc

index b6a30903e798ab10cf2eefcd46ac609ee10b0154..d55028224d821ddc444dfba23f9f10d49071caad 100644 (file)
@@ -667,8 +667,6 @@ int librbd::RBDClient::get_snapc(PoolCtx *pp, string& md_oid, const char *snap_n
     ::decode(id, iter);
     ::decode(image_size, iter);
     ::decode(s, iter);
-    if (s.compare(snap_name) == 0)
-      ictx->snapid = id;
     ictx->snapc.snaps.push_back(id);
     ictx->snaps.push_back(id);
     ictx->add_snap(s, id);
@@ -679,8 +677,11 @@ int librbd::RBDClient::get_snapc(PoolCtx *pp, string& md_oid, const char *snap_n
     return -EIO;
   }
 
-  if (!ictx->snapid) {
-    return -ENOENT;
+  if (snap_name) {
+    ictx->set_snap(snap_name);
+    if (!ictx->snapid) {
+      return -ENOENT;
+    }
   }
 
   return 0;