From: myoungwon oh Date: Mon, 23 Dec 2024 15:01:11 +0000 (+0000) Subject: src/test: allow ENOENT if target object of tier_flush has snapshots X-Git-Tag: testing/wip-pdonnell-testing-20250205.170831-debug~27^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=9e04f49a2fa5cdb08b3fb0c962c9cce3ddc52915;p=ceph-ci.git src/test: allow ENOENT if target object of tier_flush has snapshots 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 --- diff --git a/src/test/osd/RadosModel.h b/src/test/osd/RadosModel.h index 49b7d605d36..703ce704651 100644 --- a/src/test/osd/RadosModel.h +++ b/src/test/osd/RadosModel.h @@ -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()) {