Bug 1845715
| Summary: | boom: fix --add/del-opts and options precedence for edit and clone | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 8 | Reporter: | Bryn M. Reeves <bmr> |
| Component: | boom-boot | Assignee: | Bryn M. Reeves <bmr> |
| Status: | CLOSED ERRATA | QA Contact: | cluster-qe <cluster-qe> |
| Severity: | medium | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 8.3 | CC: | agk, bmr, cmarthal, jbrassow, jhrdlica, mcsontos, rhandlin |
| Target Milestone: | rc | Flags: | pm-rhel:
mirror+
|
| Target Release: | --- | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | boom-boot-1.2-2.el8 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2020-11-04 01:57:39 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
The precedence bug is quite subtle and relies on the original boot entry being in a specific state (having been created with --add/del-opts) so I've added some extra test cases to check specifically for this behaviour. The two cases are mirror images of one another: the first checks that when an entry created with --add-opts is modified by a subsequent --del-opts, that the --del-opts takes effect, and the second the reverse. The first of these tests is the case that was broken in 1.2: the reverse case was correct, but the test is added to check for any future regression.
test_clone_entry_del_opts_and_re_add
test_clone_entry_add_opts_and_re_del
boom-1.2:
test_clone_entry_add_opts_and_re_del (tests.command_tests.CommandTests) ... ok
test_clone_entry_del_opts_and_re_add (tests.command_tests.CommandTests) ... FAIL
======================================================================
FAIL: test_clone_entry_del_opts_and_re_add (tests.command_tests.CommandTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/breeves/src/git/boom/tests/command_tests.py", line 538, in test_clone_entry_del_opts_and_re_add
self.assertTrue("rhgb quiet" in be2.options)
AssertionError: False is not true
current master:
test_clone_entry_add_opts_and_re_del (tests.command_tests.CommandTests) ... ok
test_clone_entry_del_opts_and_re_add (tests.command_tests.CommandTests) ... ok
Verified with rpm: boom-boot-1.2-2.el8.noarch Cloning: # boom create --title adddeltest --rootlv rhel_virt-262/root --del-opts "rhgb quiet" Created entry with boot_id adcd0ad: title adddeltest machine-id 1a008e1b09fa4890b3ac1f526b88500f version 4.18.0-236.el8.x86_64 linux /vmlinuz-4.18.0-236.el8.x86_64 initrd /initramfs-4.18.0-236.el8.x86_64.img options root=/dev/rhel_virt-262/root ro rd.lvm.lv=rhel_virt-262/root grub_users $grub_users grub_arg --unrestricted grub_class kernel # boom clone adcd0ad --add-opts "rhgb quiet" Cloned entry with boot_id adcd0ad as boot_id 41339f2: title adddeltest machine-id 1a008e1b09fa4890b3ac1f526b88500f version 4.18.0-236.el8.x86_64 linux /vmlinuz-4.18.0-236.el8.x86_64 initrd /initramfs-4.18.0-236.el8.x86_64.img options root=/dev/rhel_virt-262/root ro rd.lvm.lv=rhel_virt-262/root rhgb quiet grub_users $grub_users grub_arg --unrestricted grub_class kernel -------------------------------------------------------------------------------------- Editing: boom create --title edittest --rootlv rhel_virt-262/root --del-opts "rhgb quiet" Created entry with boot_id 64c9c2c: title edittest machine-id 1a008e1b09fa4890b3ac1f526b88500f version 4.18.0-236.el8.x86_64 linux /vmlinuz-4.18.0-236.el8.x86_64 initrd /initramfs-4.18.0-236.el8.x86_64.img options root=/dev/rhel_virt-262/root ro rd.lvm.lv=rhel_virt-262/root grub_users $grub_users grub_arg --unrestricted grub_class kernel # boom edit 64c9c2c --add-opts "rhgb quiet" Edited entry, boot_id now: 71d40dc title edittest machine-id 1a008e1b09fa4890b3ac1f526b88500f version 4.18.0-236.el8.x86_64 linux /vmlinuz-4.18.0-236.el8.x86_64 initrd /initramfs-4.18.0-236.el8.x86_64.img options root=/dev/rhel_virt-262/root ro rd.lvm.lv=rhel_virt-262/root rhgb quiet grub_users $grub_users grub_arg --unrestricted grub_class kernel Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (boom-boot bug fix and enhancement update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2020:4532 |
Description of problem: There are two bugs affecting the --add-opts and --del-opts options when used with the "boom edit" and "boom clone" commands in boom-1.2 that can cause the value of the command line arguments to be ignored. The edit command ignores the command line arguments and the strategy used to merge the options changes from the command line and the existing boot entry is too simplistic: this leads to confusing behaviour when cloning a boot entry with a previous modification that conflicts with the current command line. For example cloning an entry with --add-opts "rhgb quiet" that was created with --del-opts "rhgb quiet". In this case the command line --add-opts should be effective as it should have higher precedence than the setting in the existing boot entry. In boom 1.0-1.2 the precedence is reversed and the --add-opts given to the clone command is effectively ignored. Version-Release number of selected component (if applicable): boom-1.2 How reproducible: 100% Steps to Reproduce: 1. Create an entry for the test with "rhgb quiet" deleted: # boom create --title adddeltest --rootlv rhel/root --del-opts "rhgb quiet" Created entry with boot_id fc12426: title adddeltest machine-id b49e623f993c4fd7b200c5e350f9cacc version 4.18.0-167.el8.x86_64 linux /vmlinuz-4.18.0-167.el8.x86_64 initrd /initramfs-4.18.0-167.el8.x86_64.img options root=/dev/rhel/root ro rd.lvm.lv=rhel/root grub_users $grub_users grub_arg --unrestricted grub_class kernel 2. Edit or clone the entry to restore "rhgb quiet" # boom clone fc12426 --add-opts "rhgb quiet" 3. Actual results: # boom clone fc12426 --add-opts "rhgb quiet" Entry already exists (boot_id=fc12426). (i.e. the entry created abvoe without "rhgb quiet") Expected results: # boom clone fc12426 --add-opts "rhgb quiet" Cloned entry with boot_id fc12426 as boot_id 349f394: title adddeltest machine-id b49e623f993c4fd7b200c5e350f9cacc version 4.18.0-167.el8.x86_64 linux /vmlinuz-4.18.0-167.el8.x86_64 initrd /initramfs-4.18.0-167.el8.x86_64.img options root=/dev/rhel/root ro rd.lvm.lv=rhel/root rhgb quiet grub_users $grub_users grub_arg --unrestricted grub_class kernel Additional info: commit 9fb8f4e81078babda6c7407617e9e90e6c7fcaa5 Author: Bryn M. Reeves <bmr> Date: Tue Jun 9 21:46:21 2020 +0100 boom: pass --add,del-opts to edit_entry() in edit command handler Signed-off-by: Bryn M. Reeves <bmr> commit b6ab1091df02c5f694c88b903d72b557ff1d9b33 Author: Bryn M. Reeves <bmr> Date: Tue Jun 9 21:16:15 2020 +0100 boom: fix precedence and handle conflicts when merging options The --add-opts and --del-opts options specify lists of options to add or remove from the default set when creating, editing or cloning a boot entry. When editing or cloning the command line values should be merged with the existing values in the BootEntry's attached BootParams: command line values should override any changes present in the original entry (so a --del-opt cancels a prior --add-opts and vice versa). Signed-off-by: Bryn M. Reeves <bmr>