Bug 1840871
| Summary: | boom.cache.load_cache() warning branch references undefined variable | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 8 | Reporter: | Bryn M. Reeves <bmr> |
| Component: | boom-boot | Assignee: | LVM and device-mapper development team <lvm-team> |
| Status: | CLOSED ERRATA | QA Contact: | cluster-qe <cluster-qe> |
| Severity: | low | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 8.3 | CC: | agk, bmr, cmarthal, jbrassow, mcsontos, rbednar, rhandlin |
| Target Milestone: | rc | Flags: | pm-rhel:
mirror+
|
| Target Release: | 8.0 | ||
| 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: | |||
Fixed upstream in boom-1.2. Verified. Cache metadata inconsistencies are now listed properly. Also the warning message changed slightly due to this commit: https://github.com/snapshotmanager/boom/commit/b3c0d8b209ae7615261a39abcb25bfc1c03239c2#diff-5ac18ce178c550b92c53d871eed288f1L241 # boom create --backup --root-lv rhel_virt-030/root WARNING - Boom grub2 integration is disabled in '/boot/../etc/default/boom' Created entry with boot_id 15dbae7: title Red Hat Enterprise Linux 8 (4.18.0-236.el8.x86_64) machine-id 77302920920a40c8bb6e0a28d727fd54 version 4.18.0-236.el8.x86_64 linux /vmlinuz-4.18.0-236.el8.x86_64.boom0 initrd /initramfs-4.18.0-236.el8.x86_64.img.boom0 options root=/dev/rhel_virt-030/root ro rd.lvm.lv=rhel_virt-030/root rhgb quiet grub_users $grub_users grub_arg --unrestricted grub_class kernel # boom cache list Path ImageID Timestamp State /initramfs-4.18.0-236.el8.x86_64.img.boom0 646a998 1600171069 RESTORED /vmlinuz-4.18.0-236.el8.x86_64.boom0 dec192b 1599668800 RESTORED # rm /boot/boom/cache/dec192bfb33317bae640a4f8b368c8138c736675.img rm: remove regular file '/boot/boom/cache/dec192bfb33317bae640a4f8b368c8138c736675.img'? y # boom cache list WARNING - Image identifier 'dec192bfb33317bae640a4f8b368c8138c736675' not found in cache for path /vmlinuz-4.18.0-236.el8.x86_64.boom0 WARNING - Found unknown image_id 'dec192bfb33317bae640a4f8b368c8138c736675' Path ImageID Timestamp State /initramfs-4.18.0-236.el8.x86_64.img.boom0 646a998 1600171069 RESTORED /vmlinuz-4.18.0-236.el8.x86_64.boom0 dec192b 1599668800 BROKEN # boom cache list --debug=all WARNING - Image identifier 'dec192bfb33317bae640a4f8b368c8138c736675' not found in cache for path /vmlinuz-4.18.0-236.el8.x86_64.boom0 WARNING - Found unknown image_id 'dec192bfb33317bae640a4f8b368c8138c736675' Path ImageID Timestamp State /initramfs-4.18.0-236.el8.x86_64.img.boom0 646a998 1600171069 RESTORED /vmlinuz-4.18.0-236.el8.x86_64.boom0 dec192b 1599668800 BROKEN # rpm -qa | grep boom python3-boom-1.2-2.el8.noarch boom-boot-1.2-2.el8.noarch boom-boot-grub2-1.2-2.el8.noarch boom-boot-conf-1.2-2.el8.noarch 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: Coverity identified a problem in a load_cache() warning branch when a specific type of inconsistency is found in the cache metadata: the "images" variable used to report the error is incorrect and should be "image_id": commit d788f82746826d091abcdf76b5f4884c22e3b7de Author: Bryn M. Reeves <bmr> Date: Wed May 20 15:14:27 2020 +0100 boom.cache: use correct variable in load_cache() warning branch Signed-off-by: Bryn M. Reeves <bmr> diff --git a/boom/cache.py b/boom/cache.py index 1dc5e07..cf7de47 100644 --- a/boom/cache.py +++ b/boom/cache.py @@ -238,7 +238,7 @@ def load_cache(verify=True, digests=False): images = cachedata["images"] for image_id in images.keys(): if image_id not in ids: - _log_warn("Found orphan image_id '%s'" % image) + _log_warn("Found orphan image_id '%s'" % image_id) # clean up? _log_debug("Loaded %d cache paths and %d images" % Version-Release number of selected component (if applicable): 1.1-1.el8 How reproducible: 100% Steps to Reproduce: 1. Create at least one cache entry by using 'boom create --backup' 2. Use "boom cache list" to identify any image_id, e.g.: # boom cache list Path ImageID Timestamp State /vmlinuz-4.16.11-100.fc26.x86_64 0c703b0 1588366186 CACHED /vmlinuz-3.10.1-1.el7 ee3e6f8 1588366186 CACHED /initramfs-3.10.1-1.el7.img 0f61425 1588366186 RESTORED /initramfs-4.16.11-100.fc26.x86_64.img 77dc54e 1588366186 CACHED 3. Delete the cache image file for the corresponding image_id: # rm /boot/boom/cache/0c703b0*.img 4. Run "boom cache list" (or any command that loads the boom cache) Actual results: $ boom cache list WARNING - Image identifier '0c703b03017edda8296b2208f3742e90d0494b76' not found in cache ERROR - Command failed: global name 'image' is not defined WARNING - Image identifier '0c703b03017edda8296b2208f3742e90d0494b76' not found in cache ERROR - Could not clean boot image cache: global name 'image' is not defined $ boom cache list --debug=all WARNING - Image identifier '0c703b03017edda8296b2208f3742e90d0494b76' not found in cache Traceback (most recent call last): File "/home/breeves/src/git/boom/bin/boom", line 7, in <module> r = main(sys.argv) File "/home/breeves/src/git/boom/boom/command.py", line 3231, in main status = command[1](cmd_args, select, opts, identifier) File "/home/breeves/src/git/boom/boom/command.py", line 2804, in _list_cache_cmd print_fn) File "/home/breeves/src/git/boom/boom/command.py", line 2154, in _generic_list_cmd expand=cmd_args.expand_variables) File "/home/breeves/src/git/boom/boom/command.py", line 1776, in print_cache output_fields=output_fields, sort_keys=sort_keys) File "/home/breeves/src/git/boom/boom/command.py", line 1752, in _print_cache ces = find_fn(selection=selection) File "/home/breeves/src/git/boom/boom/cache.py", line 718, in find_cache_paths matches = _find_cache_entries(selection=selection, images=False) File "/home/breeves/src/git/boom/boom/cache.py", line 672, in _find_cache_entries load_cache() File "/home/breeves/src/git/boom/boom/cache.py", line 241, in load_cache _log_warn("Found orphan image_id '%s'" % image) NameError: global name 'image' is not defined Expected results: $ boom cache list WARNING - Image identifier '0c703b03017edda8296b2208f3742e90d0494b76' not found in cache WARNING - Found orphan image_id '0c703b03017edda8296b2208f3742e90d0494b76' Path ImageID Timestamp State /vmlinuz-4.16.11-100.fc26.x86_64 0c703b0 1588366186 BROKEN /vmlinuz-3.10.1-1.el7 ee3e6f8 1588366186 CACHED /initramfs-3.10.1-1.el7.img 0f61425 1588366186 RESTORED /initramfs-4.16.11-100.fc26.x86_64.img 77dc54e 1588366186 CACHED Additional info: