This patch series aims to fix #6613 [0]. Although an implementation was proposed in the past, it was not applied since it was unclear how to handle the case where the removed resource is the last resource in a rule.
The approach in this patch series is the following: - With the purge param activated (default), the resource is removed from any rule referencing it. - Without the purge param, rules are left untouched, making the removal of resources from rules "opt-out", as was suggested in the previous implementation [1]. - If the resource was the last resource in the rule *and* the purge param is set, the rule will also be deleted. - For guest destruction, the "Purge from job configurations" option will also set the purge parameter for removing the HA resource - The purge param is set by default for resource removal in the GUI and CLI After some back-and-forth, I settled in this approach as the most intuitive and transparent. Alternative approaches considered were the following: - Updating rules even without the purge flag set, but failing and showing an error to the user if a rule would be deleted, prompting the user to enable the purge flag. This approach seems to be to restrictive and IMO doesn't add any UX value. - By default not setting the purge flag. This would by default leave "zombie" rules with non-existent resources. This is IMO intransparent if it happens by default. Users might be removing resources, not even knowing they're leaving behind rules that still reference said resources. Changes since v2: - Rebase on latest master - Split up widget-toolkit patches to make review easier. The intention for patches 1/4 to 3/4 of widget-toolkit is to keep the functionality of SafeDestroy intact (no changes in behavior for SafeDestroyGuest, SafeDestroyStorage, and other SafeDestroy dialogs), only adding additional functionality that is then moved to ConfirmRemoveDialog in 4/4, where the default settings are then changed in ConfirmRemoveDialog and SafeDestroy explicitly sets the parameters to keep behavior intact. - Instead of replacing SafeDestroy with ConfirmRemoveDialog and requiring additional changes to windows extending SafeDestroy, make SafeDestroy extend ConfirmRemoveDialog, encapsulating the specific settings of a SafeDestroy dialog. This also makes the original follow-up series obsolete [2]. Thanks to @Daniel and @Thomas for their review and feedback on v2! [0] https://bugzilla.proxmox.com/show_bug.cgi?id=6613 [1] https://lore.proxmox.com/pve-devel/[email protected] [2] https://lore.proxmox.com/pve-devel/[email protected]/ pve-ha-manager: Michael Köppl (2): fix #6613: update rules containing the resource to be deleted api: add purge parameter for resource deletion src/PVE/API2/HA/Resources.pm | 10 +++++++++- src/PVE/HA/Config.pm | 13 ++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) qemu-server: Michael Köppl (1): fix #6613: pass purge param to delete_service_from_config src/PVE/API2/Qemu.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) pve-container: Michael Köppl (1): fix #6613: pass purge param to delete_service_from_config src/PVE/API2/LXC.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) proxmox-widget-toolkit: Michael Köppl (4): window: refactor construction of SafeDestroy items window: introduce dangerous parameter to SafeDestroy window: make buttons in SafeDestroy configurable window: add more general base dialog, make SafeDestroy concrete src/Makefile | 1 + src/window/ConfirmRemoveDialog.js | 247 ++++++++++++++++++++++++++++++ src/window/SafeDestroy.js | 196 ++---------------------- 3 files changed, 257 insertions(+), 187 deletions(-) create mode 100644 src/window/ConfirmRemoveDialog.js pve-manager: Michael Köppl (2): ui: add ConfirmRemoveResource window ui: use ConfirmRemoveResource window for removing resources www/manager6/Makefile | 1 + www/manager6/ha/Resources.js | 16 ++++++-- www/manager6/window/ConfirmRemoveResource.js | 41 ++++++++++++++++++++ 3 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 www/manager6/window/ConfirmRemoveResource.js pve-docs: Michael Köppl (1): add notes about effects of purge flag for resource and guest removal ha-manager.adoc | 4 ++++ pct.adoc | 3 +++ qm.adoc | 3 +++ 3 files changed, 10 insertions(+) Summary over all repositories: 13 files changed, 346 insertions(+), 195 deletions(-) -- Generated by git-murpp 0.8.0 _______________________________________________ pve-devel mailing list [email protected] https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
