]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: fix watch tool
authorYehuda Sadeh <yehuda.sadeh@dreamhost.com>
Tue, 8 Feb 2011 22:04:47 +0000 (14:04 -0800)
committerYehuda Sadeh <yehuda.sadeh@dreamhost.com>
Tue, 8 Feb 2011 22:04:47 +0000 (14:04 -0800)
src/include/rbd/librbd.hpp
src/librbd.cc
src/rbd.cc

index a97bd2f4cc5c3321c02416925d2c36a114cac1f9..53755a7e42df40fc593abc5a935a9f580fb30e15 100644 (file)
@@ -102,6 +102,7 @@ public:
   int aio_read(image_t image, off_t off, size_t len, ceph::bufferlist& bl, AioCompletion *c);
 
   /* lower level access */
+  librados::Rados& get_rados();
   void get_rados_pools(pool_t pool, librados::pool_t *md_pool, librados::pool_t *data_pool);
 };
 
index 927acb082bda4ae677b35dcb9ccb0154f4b2830c..c9d5f53323620af0aca63a1485533b6f3928313e 100644 (file)
@@ -249,6 +249,7 @@ public:
     c->set_complete_cb(cb_arg, cb_complete);
     return c;
   }
+  librados::Rados& get_rados() { return rados; }
 };
 
 
@@ -1474,6 +1475,11 @@ void librbd::RBD::AioCompletion::release()
   c->release();
 }
 
+librados::Rados& librbd::RBD::get_rados()
+{
+  return client->get_rados();
+}
+
 } // namespace librbd
 
 extern "C" void librbd_version(int *major, int *minor, int *extra)
index 8936d5a87e8403cee0d1a9fcec3cb32eca18e587..11408470a24e2b8e6de5df665b6308d925746b04 100644 (file)
@@ -467,8 +467,7 @@ static int do_watch(librbd::pool_t& pp, const char *imgname)
   md_oid = imgname;
   md_oid += RBD_SUFFIX;
 
-  librados::Rados rados;
-  rados.initialize(0, NULL);
+  librados::Rados& rados = rbd.get_rados();
   int r = rados.watch(md_pool, md_oid, 0, &cookie, &ctx);
   if (r < 0) {
     cerr << "watch failed" << std::endl;
@@ -479,8 +478,6 @@ static int do_watch(librbd::pool_t& pp, const char *imgname)
   cout << "press enter to exit..." << std::endl;
   getchar();
 
-  rados.shutdown();
-
   return 0;
 }