The exclusive boolean of the create method was unused so far.
This commit adds the proper handling by checking if an object already exists, and returning EEXISTS appropriately.
Signed-off-by: Or Ozeri <oro@il.ibm.com>
}
std::unique_lock l{m_pool->file_lock};
+ if (exclusive) {
+ TestMemCluster::SharedFile file = get_file(oid, false, CEPH_NOSNAP, {});
+ if (file != NULL && file->exists) {
+ return -EEXIST;
+ }
+ }
+
get_file(oid, true, CEPH_NOSNAP, snapc);
return 0;
}
void SetUp() override {
TestMockFixture::SetUp();
+ m_ioctx.remove(RBD_INFO);
ASSERT_EQ(0, open_image(m_image_name, &image_ctx));
}