Bug 1528018

Summary: boom traceback from incomplete boot entry creation
Product: Red Hat Enterprise Linux 7 Reporter: Corey Marthaler <cmarthal>
Component: lvm2Assignee: Marian Csontos <mcsontos>
lvm2 sub component: Default / Unclassified QA Contact: cluster-qe <cluster-qe>
Status: CLOSED ERRATA Docs Contact:
Severity: high    
Priority: unspecified CC: agk, heinzm, jbrassow, mcsontos, msnitzer, prajnoha, prockai, rhandlin, zkabelac
Version: 7.5   
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: lvm2-2.02.177-1.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-10 15:23:49 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:

Description Corey Marthaler 2017-12-20 19:01:05 UTC
Description of problem:

I assume more of the options below should have been filed in with this creation attempt?

[root@mckinley-03 ~]# boom profile create --from-host 
Created profile with os_id e681b91:
  OS ID: "e681b91cc8ac8061fad519e6588ec842c728697a",
  Name: "Red Hat Enterprise Linux Server", Short name: "rhel",
  Version: "7.4 (Maipo)", Version ID: "7.4",
  Kernel pattern: "/vmlinuz-%{version}", Initramfs pattern: "/initramfs-%{version}.img",
  Root options (LVM2): "rd.lvm.lv=%{lvm_root_lv}",
  Root options (BTRFS): "rootflags=%{btrfs_subvolume}",
  Options: "root=%{root_device} ro %{root_opts}"

Which lead to the following list failures:

[root@mckinley-03 ~]# boom profile list
Traceback (most recent call last):
  File "/usr/bin/boom", line 7, in <module>
    main(sys.argv)
  File "/usr/lib/python2.7/site-packages/boom/command.py", line 1698, in main
    status = command[1](cmd_args, select, opts, identifier)
  File "/usr/lib/python2.7/site-packages/boom/command.py", line 1388, in _list_profile_cmd
    opts=opts, sort_keys=cmd_args.sort)
  File "/usr/lib/python2.7/site-packages/boom/command.py", line 883, in print_profiles
    osps = find_profiles(selection=selection)
  File "/usr/lib/python2.7/site-packages/boom/osprofile.py", line 327, in find_profiles
    load_profiles()
  File "/usr/lib/python2.7/site-packages/boom/osprofile.py", line 213, in load_profiles
    (osp.disp_os_id))
UnboundLocalError: local variable 'osp' referenced before assignment



[root@mckinley-03 ~]# boom list
Traceback (most recent call last):
  File "/usr/bin/boom", line 7, in <module>
    main(sys.argv)
  File "/usr/lib/python2.7/site-packages/boom/command.py", line 1698, in main
    status = command[1](cmd_args, select, opts, identifier)
  File "/usr/lib/python2.7/site-packages/boom/command.py", line 1139, in _list_cmd
    opts=opts, sort_keys=cmd_args.sort)
  File "/usr/lib/python2.7/site-packages/boom/command.py", line 526, in print_entries
    bes = find_entries(selection=selection)
  File "/usr/lib/python2.7/site-packages/boom/bootloader.py", line 522, in find_entries
    load_entries()
  File "/usr/lib/python2.7/site-packages/boom/bootloader.py", line 392, in load_entries
    load_profiles()
  File "/usr/lib/python2.7/site-packages/boom/osprofile.py", line 213, in load_profiles
    (osp.disp_os_id))
UnboundLocalError: local variable 'osp' referenced before assignment



Version-Release number of selected component (if applicable):
3.10.0-823.el7.x86_64

lvm2-2.02.176-5.el7    BUILT: Wed Dec  6 04:13:07 CST 2017
lvm2-libs-2.02.176-5.el7    BUILT: Wed Dec  6 04:13:07 CST 2017
lvm2-cluster-2.02.176-5.el7    BUILT: Wed Dec  6 04:13:07 CST 2017
lvm2-lockd-2.02.176-5.el7    BUILT: Wed Dec  6 04:13:07 CST 2017
lvm2-python-boom-0.8.1-5.el7    BUILT: Wed Dec  6 04:15:40 CST 2017

Comment 2 Bryn M. Reeves 2018-01-08 17:30:09 UTC
This is the same basic problem as bug 1528014 (not including the built-in profiles), but with an added bug in the exception handler: the OS identifier is undefined when we attempt to print it in this case (the code was written to also output the file name but the format tuple is incorrect).

I'll change this to only print the name of the file that could not be read.

Comment 4 Corey Marthaler 2018-01-30 18:52:24 UTC
Marking verified in the latest rpms. Boom profiles can now be created and properly used.

3.10.0-841.el7.x86_64

lvm2-2.02.177-1.el7    BUILT: Tue Jan 23 16:50:39 CET 2018
lvm2-libs-2.02.177-1.el7    BUILT: Tue Jan 23 16:50:39 CET 2018
lvm2-cluster-2.02.177-1.el7    BUILT: Tue Jan 23 16:50:39 CET 2018
lvm2-lockd-2.02.177-1.el7    BUILT: Tue Jan 23 16:50:39 CET 2018
lvm2-python-boom-0.8.2-1.el7    BUILT: Tue Jan 23 16:53:42 CET 2018


# preloaded doesn't include current running (7.4 + 7.5 kern) yet.
[root@host-083 ~]# boom profile list
OsID    Name                            OsVersion               
9cb53dd Fedora                          24 (Workstation Edition)
9736c34 Fedora                          25 (Server Edition)     
d4439b7 Fedora                          26 (Workstation Edition)
efd6d41 Red Hat Enterprise Linux Server 4 (Server)              
98c3edb Red Hat Enterprise Linux Server 6 (Server)              
c0b921e Red Hat Enterprise Linux Server 7 (Server)              
3fc389b Red Hat Enterprise Linux Server 7.2 (Maipo)             
21e37c8 Ubuntu                          16.04 LTS (Xenial Xerus)

[root@host-083 ~]# boom profile create --from-host --uname-pattern Linux
Created profile with os_id e681b91:
  OS ID: "e681b91cc8ac8061fad519e6588ec842c728697a",
  Name: "Red Hat Enterprise Linux Server", Short name: "rhel",
  Version: "7.4 (Maipo)", Version ID: "7.4",
  UTS release pattern: "Linux",
  Kernel pattern: "/vmlinuz-%{version}", Initramfs pattern: "/initramfs-%{version}.img",
  Root options (LVM2): "rd.lvm.lv=%{lvm_root_lv}",
  Root options (BTRFS): "rootflags=%{btrfs_subvolume}",
  Options: "root=%{root_device} ro %{root_opts}"

# Now it does
[root@host-083 ~]# boom profile list
OsID    Name                            OsVersion               
9cb53dd Fedora                          24 (Workstation Edition)
9736c34 Fedora                          25 (Server Edition)     
d4439b7 Fedora                          26 (Workstation Edition)
efd6d41 Red Hat Enterprise Linux Server 4 (Server)              
98c3edb Red Hat Enterprise Linux Server 6 (Server)              
c0b921e Red Hat Enterprise Linux Server 7 (Server)              
3fc389b Red Hat Enterprise Linux Server 7.2 (Maipo)             
e681b91 Red Hat Enterprise Linux Server 7.4 (Maipo)             
21e37c8 Ubuntu                          16.04 LTS (Xenial Xerus)

# And it can now be used in creating boot entries
[root@host-083 ~]# boom create --profile e681b91 --title "RHEL7.4 snap1" --rootlv snapper/snap1
Created entry with boot_id 65645b3:
  title RHEL7.4 snap1
  machine-id 40a6ef4b385f4d0694b9c11428e5c0dd
  version 3.10.0-841.el7.x86_64
  linux /vmlinuz-3.10.0-841.el7.x86_64
  initrd /initramfs-3.10.0-841.el7.x86_64.img
  options root=/dev/snapper/snap1 ro rd.lvm.lv=snapper/snap1

[root@host-083 ~]# boom create --profile e681b91 --title "RHEL7.4 snap2" --rootlv snapper/snap2
Created entry with boot_id ad03cc2:
  title RHEL7.4 snap2
  machine-id 40a6ef4b385f4d0694b9c11428e5c0dd
  version 3.10.0-841.el7.x86_64
  linux /vmlinuz-3.10.0-841.el7.x86_64
  initrd /initramfs-3.10.0-841.el7.x86_64.img
  options root=/dev/snapper/snap2 ro rd.lvm.lv=snapper/snap2

[root@host-083 ~]# boom list
BootID  Version                  Name                            RootDevice        
65645b3 3.10.0-841.el7.x86_64    Red Hat Enterprise Linux Server /dev/snapper/snap1
ad03cc2 3.10.0-841.el7.x86_64    Red Hat Enterprise Linux Server /dev/snapper/snap2

Comment 7 errata-xmlrpc 2018-04-10 15:23:49 UTC
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, 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/RHEA-2018:0853