]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd-mirror: image deleter now handles clone v2
authorJason Dillaman <dillaman@redhat.com>
Tue, 30 Jan 2018 02:12:10 +0000 (21:12 -0500)
committerJason Dillaman <dillaman@redhat.com>
Mon, 5 Feb 2018 16:12:00 +0000 (11:12 -0500)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/tools/rbd_mirror/image_deleter/RemoveRequest.cc
src/tools/rbd_mirror/image_deleter/SnapshotPurgeRequest.cc

index e411fa33ca9cab5de9323f947f7964baf66bbab4..6f10dd99ecd28eba0e498dec9a76e81a6ae5fe06 100644 (file)
@@ -117,6 +117,14 @@ void RemoveRequest<I>::remove_image() {
 template <typename I>
 void RemoveRequest<I>::handle_remove_image(int r) {
   dout(10) << "r=" << r << dendl;
+  if (r == -ENOTEMPTY) {
+    // image must have clone v2 snapshot still associated to child
+    dout(10) << "snapshots still in-use" << dendl;
+    *m_error_result = ERROR_RESULT_RETRY_IMMEDIATELY;
+    finish(-EBUSY);
+    return;
+  }
+
   if (r < 0 && r != -ENOENT) {
     derr << "error removing image " << m_image_id << " "
          << "(" << m_image_id << ") from local pool: "
index c417d9f90e5da117ed9702262cb0e383379c0b04..797dbdb9059d62fe02f12d6964466b40ba50aa88 100644 (file)
@@ -225,7 +225,12 @@ template <typename I>
 void SnapshotPurgeRequest<I>::handle_snap_remove(int r) {
   dout(10) << "r=" << r << dendl;
 
-  if (r < 0) {
+  if (r == -EBUSY) {
+    dout(10) << "snapshot in-use" << dendl;
+    m_ret_val = r;
+    close_image();
+    return;
+  } else if (r < 0) {
     derr << "failed to remove snapshot: " << cpp_strerror(r) << dendl;
     m_ret_val = r;
     close_image();