-
Notifications
You must be signed in to change notification settings - Fork 900
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
PXE Images refresh duplicates entries #18940
PXE Images refresh duplicates entries #18940
Comments
@miq-bot assign @miha-plesko |
/cc @tadeboro |
There are at least two bugs in the sources that cause this issue. The first one is in the UI component of the MIQ. When the user updates any of the fields of the PXE server, all associated PXE menus are deleted and then recreated from the data in the form. The second bug is a bit subtler and has to do with the database modeling around the PXE stuff. Currently, this is how we model the PXE servers, menus, and images: PXE images are only deleted from the database if we remove the parent server. On the other hand, if we remove a PXE menu, no image gets deleted. Combine both of the bugs, and we have got our issue at hand. If we would like to solve this The Right Way (TM), we will probably need to remove the |
cc @bdunne |
We were invoking `.delete_all` method (aliased as `.clear`) which avoids `:dependent => destroy` callbacks hence related PXE images remained in database. Fixes ManageIQ/manageiq#18940 Signed-off-by: Miha Pleško <[email protected]>
When one destroys PxeMenu, also related MiqImages are destroyed. This works both subclasses of PxeMenu: - `PxeMenuIpxe` - `PxeMenuPxelinux` but does not work for base class, which is annoying in rspecs. With this commit we simply move relation definition to the base class so that it now works everywhere. Fixes ManageIQ#18940 Signed-off-by: Miha Pleško <[email protected]>
Currently, when user updates PXE Server details and submits form, all related PxeMenus and PxImages are discarded so she needs to run "Recreate Relationships" to inventory them again. This approach works but unfortunately user has option to manually edit PxeImages when they are inventoried, and by discarding them we also discard her work. With this commit we therefore go out of our way and double check which PxeMenus (and subsequent PxeImages) are *really* affected by update and only discard those. This way, if user only updates PxeServer's name, nothing else will be recreated hence user's manual work will be preserved. Fixes ManageIQ/manageiq#18940 Signed-off-by: Miha Pleško <[email protected]>
Currently, when user updates PXE Server details and submits form, all related PxeMenus and PxImages are discarded so she needs to run "Recreate Relationships" to inventory them again. This approach works but unfortunately user has option to manually edit PxeImages when they are inventoried, and by discarding them we also discard her work. With this commit we therefore go out of our way and double check which PxeMenus (and subsequent PxeImages) are *really* affected by update and only discard those. This way, if user only updates PxeServer's name, nothing else will be recreated hence user's manual work will be preserved. Fixes ManageIQ/manageiq#18940 Signed-off-by: Miha Pleško <[email protected]>
With this commit we introduce a utility method on PxeServer model to handle PxeMenus list update. Until now, miq-api was always recreating all menus upon server update, but often we can actually just preserve exisitng menus. This method calculates what menus to add, what to preserve and what to remove, and then executes it. Fixes ManageIQ#18940 Signed-off-by: Miha Pleško <[email protected]>
Currently, when user updates PXE Server details and submits form, all related PxeMenus and PxImages are discarded so she needs to run "Recreate Relationships" to inventory them again. This approach works but unfortunately user has option to manually edit PxeImages when they are inventoried, and by discarding them we also discard her work. With this commit we therefore go out of our way and double check which PxeMenus (and subsequent PxeImages) are *really* affected by update and only discard those. This way, if user only updates PxeServer's name, nothing else will be recreated hence user's manual work will be preserved. Fixes ManageIQ/manageiq#18940 Signed-off-by: Miha Pleško <[email protected]>
With this commit we introduce a utility method on PxeServer model to handle PxeMenus list update. Until now, miq-api was always recreating all menus upon server update, but often we can actually just preserve exisitng menus. This method calculates what menus to add, what to preserve and what to remove, and then executes it. Fixes ManageIQ#18940 Signed-off-by: Miha Pleško <[email protected]>
When one destroys PxeMenu, also related MiqImages are destroyed. This works both subclasses of PxeMenu: - `PxeMenuIpxe` - `PxeMenuPxelinux` but does not work for base class, which is annoying in rspecs. With this commit we simply move relation definition to the base class so that it now works everywhere. Fixes ManageIQ#18940 Signed-off-by: Miha Pleško <[email protected]>
We were invoking `.delete_all` method (aliased as `.clear`) which avoids `:dependent => destroy` callbacks hence related PXE images remained in database. Fixes ManageIQ/manageiq#18940 Signed-off-by: Miha Pleško <[email protected]>
Currently, when user updates PXE Server details and submits form, all related PxeMenus and PxImages are discarded so she needs to run "Recreate Relationships" to inventory them again. This approach works but unfortunately user has option to manually edit PxeImages when they are inventoried, and by discarding them we also discard her work. With this commit we therefore go out of our way and double check which PxeMenus (and subsequent PxeImages) are *really* affected by update and only discard those. This way, if user only updates PxeServer's name, nothing else will be recreated hence user's manual work will be preserved. Fixes ManageIQ/manageiq#18940 Signed-off-by: Miha Pleško <[email protected]>
Currently, when user updates PXE Server details and submits form, all related PxeMenus and PxImages are discarded so she needs to run "Recreate Relationships" to inventory them again. This approach works but unfortunately user has option to manually edit PxeImages when they are inventoried, and by discarding them we also discard her work. With this commit we therefore go out of our way and double check which PxeMenus (and subsequent PxeImages) are *really* affected by update and only discard those. This way, if user only updates PxeServer's name, nothing else will be recreated hence user's manual work will be preserved. Fixes ManageIQ/manageiq#18940 Signed-off-by: Miha Pleško <[email protected]>
Currently, when user updates PXE Server details and submits form, all related PxeMenus and PxImages are discarded so she needs to run "Recreate Relationships" to inventory them again. This approach works but unfortunately user has option to manually edit PxeImages when they are inventoried, and by discarding them we also discard her work. With this commit we therefore go out of our way and double check which PxeMenus (and subsequent PxeImages) are *really* affected by update and only discard those. This way, if user only updates PxeServer's name, nothing else will be recreated hence user's manual work will be preserved. Fixes ManageIQ/manageiq#18940 Signed-off-by: Miha Pleško <[email protected]>
Refreshing the relationships on an existing PXE server after a rename adds the images that have been added in previous refreshes. I took the following steps:
The expected outcome would be that even after a renaming and refreshing, the list of images should be unchanged.
The text was updated successfully, but these errors were encountered: