* RGW: Added support for the `RestrictPublicBuckets` property of the S3 `PublicAccessBlock`
configuration.
+* RBD: Moving an image that is a member of a group to trash is no longer
+ allowed. `rbd trash mv` command now behaves the same way as `rbd rm` in this
+ scenario.
+
>=19.2.1
* CephFS: Command `fs subvolume create` now allows tagging subvolumes through option
ictx->state->close();
return -EBUSY;
}
+ if (ictx->group_spec.is_valid() &&
+ source != RBD_TRASH_IMAGE_SOURCE_MIGRATION) {
+ lderr(cct) << "image is in a group - not moving to trash" << dendl;
+ ictx->image_lock.unlock_shared();
+ ictx->state->close();
+ return -EMLINK;
+ }
ictx->image_lock.unlock_shared();
if (mirror_r >= 0 &&
def test_group_image_list_move_to_trash(self):
eq([], list(self.group.list_images()))
- with Image(ioctx, image_name) as image:
- image_id = image.id()
self.group.add_image(ioctx, image_name)
eq([image_name], [img['name'] for img in self.group.list_images()])
- RBD().trash_move(ioctx, image_name, 0)
- eq([], list(self.group.list_images()))
- RBD().trash_restore(ioctx, image_id, image_name)
+ assert_raises(ImageMemberOfGroup, RBD().trash_move, ioctx, image_name, 0)
+ eq([image_name], [img['name'] for img in self.group.list_images()])
def test_group_image_list_remove(self):
# need a closed image to get ImageMemberOfGroup instead of ImageBusy
librbd::RBD rbd;
r = rbd.trash_move(io_ctx, image_name.c_str(), dt);
if (r < 0) {
- std::cerr << "rbd: deferred delete error: " << cpp_strerror(r)
- << std::endl;
+ if (r == -EMLINK) {
+ std::cerr << "rbd: error: image belongs to a group"
+ << std::endl
+ << "Remove the image from the group and try again."
+ << std::endl;
+ } else {
+ std::cerr << "rbd: deferred delete error: " << cpp_strerror(r)
+ << std::endl;
+ }
return r;
}
<< "waiting 30s for the crashed client to timeout."
<< std::endl;
} else if (r == -EMLINK) {
- std::cerr << std::endl
+ // moving to trash an image that belongs to a group is no longer
+ // allowed, this is to handle any image that was trashed earlier
+ std::cerr << "rbd: error: image belongs to a group"
+ << std::endl
<< "Remove the image from the group and try again."
<< std::endl;
} else if (r == -EPERM) {