Skip to content

Commit a79ff9a

Browse files
authored
Merge pull request ceph#61374 from myoungwon/fix-68518
src/test: allow ENOENT if target object of tier_flush has snapshots Reviewed-by: Laura Flores <[email protected]>
2 parents 4fdd68a + 9e04f49 commit a79ff9a

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

src/test/osd/RadosModel.h

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,21 @@ class RadosTestContext {
694694
}
695695
return true;
696696
}
697+
bool has_snapshot(std::string oid) {
698+
io_ctx.snap_set_read(librados::SNAP_DIR);
699+
librados::snap_set_t snap_set;
700+
int snap_ret;
701+
librados::ObjectReadOperation op;
702+
op.list_snaps(&snap_set, &snap_ret);
703+
io_ctx.operate(prefix+oid, &op, NULL);
704+
bool has_snap = false;
705+
if (snap_set.clones.size()) {
706+
has_snap = true;
707+
std::cout << __func__ << " has snap true " << std::endl;
708+
}
709+
io_ctx.snap_set_read(0);
710+
return has_snap;
711+
}
697712
};
698713

699714
void read_callback(librados::completion_t comp, void *arg);
@@ -2985,6 +3000,7 @@ class TierFlushOp : public TestOp {
29853000

29863001
int r = completion->get_return_value();
29873002
std::cout << num << ": got " << cpp_strerror(r) << std::endl;
3003+
29883004
if (r == 0) {
29893005
// sucess
29903006
context->update_object_tier_flushed(oid, snap);
@@ -2997,8 +3013,13 @@ class TierFlushOp : public TestOp {
29973013
if (src_value.deleted()) {
29983014
std::cout << num << ": got expected ENOENT (src dne)" << std::endl;
29993015
} else {
3000-
std::cerr << num << ": got unexpected ENOENT" << std::endl;
3001-
ceph_abort();
3016+
if (context->has_snapshot(oid)) {
3017+
std::cout << num << ": got expected ENOENT \
3018+
-- adjacent snapshot might not be recovered yet" << std::endl;
3019+
} else {
3020+
std::cerr << num << ": got unexpected ENOENT" << std::endl;
3021+
ceph_abort();
3022+
}
30023023
}
30033024
} else {
30043025
if (r != -ENOENT && src_value.deleted()) {

0 commit comments

Comments
 (0)