]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
src/test: allow ENOENT if target object of tier_flush has snapshots
authormyoungwon oh <ohmyoungwon@gmail.com>
Mon, 23 Dec 2024 15:01:11 +0000 (15:01 +0000)
committermyoungwon oh <ohmyoungwon@gmail.com>
Mon, 23 Dec 2024 15:09:26 +0000 (15:09 +0000)
Tier_flush can return ENOENT if the recovery procedure for
adjacent clones are in progress. Allowing ENOENT might not
cover some cases, but this has some advantages:
1) tier_flush is a write operation that rarely returns ENOENT
2) other operations in combination test can cover ENOENT case,
minimizing OSD changes.

Signed-off-by: Myoungwon Oh <myoungwon.oh@samsung.com>
src/test/osd/RadosModel.h

index 49b7d605d3663a7ed4a508dc93a8bfcc1dea5658..703ce70465164ce52f7e5587d7b8f711af8efa12 100644 (file)
@@ -694,6 +694,21 @@ public:
     }
     return true;
   }
+  bool has_snapshot(std::string oid) {
+    io_ctx.snap_set_read(librados::SNAP_DIR);
+    librados::snap_set_t snap_set;
+    int snap_ret;
+    librados::ObjectReadOperation op;
+    op.list_snaps(&snap_set, &snap_ret);
+    io_ctx.operate(prefix+oid, &op, NULL);
+    bool has_snap = false;
+    if (snap_set.clones.size()) {
+      has_snap = true;
+      std::cout << __func__ << " has snap true " << std::endl;
+    }
+    io_ctx.snap_set_read(0);
+    return has_snap;
+  }
 };
 
 void read_callback(librados::completion_t comp, void *arg);
@@ -2985,6 +3000,7 @@ public:
 
     int r = completion->get_return_value();
     std::cout << num << ":  got " << cpp_strerror(r) << std::endl;
+
     if (r == 0) {
       // sucess
       context->update_object_tier_flushed(oid, snap);
@@ -2997,8 +3013,13 @@ public:
       if (src_value.deleted()) {
        std::cout << num << ":  got expected ENOENT (src dne)" << std::endl;
       } else {
-       std::cerr << num << ": got unexpected ENOENT" << std::endl;
-       ceph_abort();
+       if (context->has_snapshot(oid)) {
+         std::cout << num << ":  got expected ENOENT \
+           -- adjacent snapshot might not be recovered yet" << std::endl;
+       } else {
+         std::cerr << num << ": got unexpected ENOENT" << std::endl;
+         ceph_abort();
+       }
       }
     } else {
       if (r != -ENOENT && src_value.deleted()) {