]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
librbd: incorporate new trash notification messages
authorJason Dillaman <dillaman@redhat.com>
Wed, 29 Nov 2017 20:45:24 +0000 (15:45 -0500)
committerJason Dillaman <dillaman@redhat.com>
Tue, 19 Dec 2017 14:09:12 +0000 (09:09 -0500)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/internal.cc

index 69cfda50b96397ccb3a5c27318c1baf4ee6c94f0..78aeff794387aaef1944d11cc8224d1a558b05b2 100644 (file)
@@ -28,6 +28,7 @@
 #include "librbd/Journal.h"
 #include "librbd/ObjectMap.h"
 #include "librbd/Operations.h"
+#include "librbd/TrashWatcher.h"
 #include "librbd/Types.h"
 #include "librbd/Utils.h"
 #include "librbd/api/Image.h"
@@ -1408,6 +1409,15 @@ bool compare_by_name(const child_info_t& c1, const child_info_t& c2)
       return r;
     }
 
+    C_SaferCond notify_ctx;
+    TrashWatcher<>::notify_image_added(io_ctx, image_id, trash_image_spec,
+                                       &notify_ctx);
+    r = notify_ctx.wait();
+    if (r < 0) {
+      lderr(cct) << "failed to send update notification: " << cpp_strerror(r)
+                 << dendl;
+    }
+
     return 0;
   }
 
@@ -1502,6 +1512,15 @@ bool compare_by_name(const child_info_t& c1, const child_info_t& c2)
                  << " from rbd_trash object" << dendl;
       return r;
     }
+
+    C_SaferCond notify_ctx;
+    TrashWatcher<>::notify_image_removed(io_ctx, image_id, &notify_ctx);
+    r = notify_ctx.wait();
+    if (r < 0) {
+      lderr(cct) << "failed to send update notification: " << cpp_strerror(r)
+                 << dendl;
+    }
+
     return 0;
   }
 
@@ -1574,6 +1593,14 @@ bool compare_by_name(const child_info_t& c1, const child_info_t& c2)
       return r;
     }
 
+    C_SaferCond notify_ctx;
+    TrashWatcher<>::notify_image_removed(io_ctx, image_id, &notify_ctx);
+    r = notify_ctx.wait();
+    if (r < 0) {
+      lderr(cct) << "failed to send update notification: " << cpp_strerror(r)
+                 << dendl;
+    }
+
     return 0;
   }