Daniel P. Berrangé <[email protected]> writes: > On Fri, Jul 03, 2026 at 08:40:28AM +0200, Markus Armbruster wrote: >> Daniel P. Berrangé <[email protected]> writes: >> >> > While most objects can perform all their cleanup in the finalizer >> > method, there can be interactions with other resources / subsystems >> > / threads which require that some cleanup be performed on an user >> > creatable object before unparenting it and entering finalization. >> > >> > The current 'can_be_deleted' method runs in the deletion path and >> > is intended to be used to block deletion. While it could be used >> > to perform cleanup tasks, its name suggests it should be free of >> > side-effects. >> > >> > Generalize this by renaming it to 'prepare_delete', explicitly >> > allowing for cleanup to be provided. Existing users of 'can_be_deleted' >> > are re-written, which provides them with more detailed/tailored error >> > messages. >> >> Old message: >> >> error_setg(errp, "object '%s' is in use, can not be deleted", id); >> >> New messages: >> >> error_setg(errp, "Cryptodev backend '%s' is still in use", >> error_setg(errp, "Host memory backend '%s' is still mapped", >> error_setg(errp, "IOMMUFD backend '%s' still has %d users", >> error_setg(errp, "Throttle group '%s' still has multiple references", >> error_setg(errp, "Deleting CAN bus device '%s' is not supported", >> error_setg(errp, "Deleting main loop '%s' is not supported", >> >> All now mention what kind of object it is. Users could probably figure >> this out from context easily. Welcome small improvement. >> >> The two unconditional ones become more accurate: they now report "not >> supported" instead of "in use". >> >> The other four lose "can not be deleted". Users can probably figure >> this out from context. Still, I lean towards error messages like "Can't >> DO-SOMETHING because REASON" until that becomes overly verbose. What do >> you think? > > I'll change them as follows: > > - error_setg(errp, "Cryptodev backend '%s' is still in use", > + error_setg(errp, > + "Cannot delete cryptodev backend '%s' that is in use", > > > - error_setg(errp, "Host memory backend '%s' is still mapped", > + error_setg(errp, > + "Cannot delete host memory backend '%s' which is > mapped", > > > - error_setg(errp, "IOMMUFD backend '%s' still has %d users", > + error_setg(errp, "Can not delete IOMMUFD backend '%s' with %d > users", > > > - error_setg(errp, "Throttle group '%s' still has multiple > references", > + error_setg(errp, > + "Cannot delete throttle group '%s' with active > references",
Works for me, thanks!
