-
Notifications
You must be signed in to change notification settings - Fork 898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not delete children snapshots as part of parent #17462
Do not delete children snapshots as part of parent #17462
Conversation
Do not delete children snapshots as part of parent. The default relation :children, added by acts_as_tree, has :dependent => :destroy. So deleting parent, will delete all it's children. This is not behavior we want in refresh. In old refresh, we were bypassing this by: https://github.com/ManageIQ/manageiq/blob/master/app/models/ems_refresh/save_inventory.rb#L366 So first, we deleted the tree relations, then we did create/update/delete of the nodes, then we updated the tree connections again. All of that should not be needed, if we will just use :dependent => :nullify Partially fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1571291
Checked commit Ladas@ff840c9 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
@Ladas I was thinking about this after we talked and I think the problem here is that it will leave orphaned child snaps if you destroy the vm. |
@Ladas pointed out in gitter that we already dependent destroy snapshots related to a VM so the tree delete is redundant. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 LGTM
…with_parent Do not delete children snapshots as part of parent (cherry picked from commit 2903440) https://bugzilla.redhat.com/show_bug.cgi?id=1581287
Gaprindashvili backport details:
|
Do not delete children snapshots as part of parent. The default
relation :children, added by acts_as_tree, has :dependent => :destroy.
So deleting parent, will delete all it's children. This is not behavior
we want in refresh. In old refresh, we were bypassing this by:
https://github.com/ManageIQ/manageiq/blob/master/app/models/ems_refresh/save_inventory.rb#L366
So first, we deleted the tree relations, then we did create/update/delete
of the nodes, then we updated the tree connections again. All of that should
not be needed, if we will just use :dependent => :nullify
Partially fixes:
https://bugzilla.redhat.com/show_bug.cgi?id=1571291
PR with spec is here:
ManageIQ/manageiq-providers-ovirt#241