]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: avoid throwing error if mirroring is unsupported 8417/head
authorJason Dillaman <dillaman@redhat.com>
Fri, 1 Apr 2016 16:08:12 +0000 (12:08 -0400)
committerJason Dillaman <dillaman@redhat.com>
Fri, 1 Apr 2016 16:08:12 +0000 (12:08 -0400)
Attempting to remove an image will remove the image from the mirroring
directory.  However, if the OSD is older and doesn't support this
new feature, avoid throwing an error.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/internal.cc

index 23fe70f182d886c4a5cc879a56fce2dc0e02628e..6ace24f1d8f80fc5884cb7068ffd4be50bfa2bf5 100644 (file)
@@ -291,14 +291,17 @@ int mirror_image_disable_internal(ImageCtx *ictx, bool force) {
 
   int r = cls_client::mirror_image_get(&ictx->md_ctx, ictx->id,
       &mirror_image_internal);
-  if (r < 0 && r != -ENOENT) {
-    lderr(cct) << "cannot disable mirroring: " << cpp_strerror(r) << dendl;
-    return r;
-  } else if (r == -ENOENT) {
+  if (r == -ENOENT) {
     // mirroring is not enabled for this image
     ldout(cct, 20) << "ignoring disable command: mirroring is not enabled "
       "for this image" << dendl;
     return 0;
+  } else if (r == -EOPNOTSUPP) {
+    ldout(cct, 5) << "mirroring not supported by OSD" << dendl;
+    return r;
+  } else if (r < 0) {
+    lderr(cct) << "cannot disable mirroring: " << cpp_strerror(r) << dendl;
+    return r;
   }
 
   bool is_primary;
@@ -1960,7 +1963,7 @@ remove_mirroring_image:
 
       if (!old_format) {
         r = mirror_image_disable_internal(ictx, false);
-        if (r < 0) {
+        if (r < 0 && r != -EOPNOTSUPP) {
           lderr(cct) << "error disabling image mirroring: " << cpp_strerror(r)
                      << dendl;
           ictx->owner_lock.put_read();