Bug 1729023

Summary: The error message is inappropriate when run `imgbase layout --init` on current layout
Product: Red Hat Enterprise Virtualization Manager Reporter: Qin Yuan <qiyuan>
Component: redhat-virtualization-hostAssignee: Yuval Turgeman <yturgema>
Status: CLOSED ERRATA QA Contact: Qin Yuan <qiyuan>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.3.5CC: cshao, mavital, nlevy, qiyuan, rdlugyhe, sbonazzo, weiwang, yaniwang, yturgema
Target Milestone: ovirt-4.3.5Keywords: Rebase, ZStream
Target Release: 4.3.5   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: imgbased-1.1.9 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-08-12 11:54:28 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Node RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Qin Yuan 2019-07-11 08:40:59 UTC
Description of problem:

When run `imgbase layout --init` on the current layout, it should fail with an error that tells user there is already a working imgbase, but the current error message, as following, shows wrong information.

[root@ati-local-01 ~]# imgbase layout --init
2019-07-11 16:25:10,282 [INFO] (MainThread) Trying to create a manageable base from '/'
Traceback (most recent call last):
  File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/lib/python2.7/site-packages/imgbased/__main__.py", line 53, in <module>
    CliApplication()
  File "/usr/lib/python2.7/site-packages/imgbased/__init__.py", line 82, in CliApplication
    app.hooks.emit("post-arg-parse", args)
  File "/usr/lib/python2.7/site-packages/imgbased/hooks.py", line 120, in emit
    cb(self.context, *args)
  File "/usr/lib/python2.7/site-packages/imgbased/plugins/core.py", line 173, in post_argparse
    layout.initialize(args.source, args.init_nvr)
  File "/usr/lib/python2.7/site-packages/imgbased/plugins/core.py", line 220, in initialize
    self.app.imgbase.init_layout_from(source, init_nvr)
  File "/usr/lib/python2.7/site-packages/imgbased/imgbase.py", line 286, in init_layout_from
    self.init_tags_on(existing_lv)
  File "/usr/lib/python2.7/site-packages/imgbased/imgbase.py", line 252, in init_tags_on
    self._assert_tags(lv)
  File "/usr/lib/python2.7/site-packages/imgbased/imgbase.py", line 136, in _assert_tags
    "and logical volumes, then retry" % tag)
imgbased.imgbase.VgTaggedLvNotTagged: 
A tagged volume group was found, but no logical volumes were tagged with: imgbased:init
Please remove tags from volume groups and logical volumes, then retry


Version-Release number of selected component (if applicable):
redhat-virtualization-host-4.3.5-20190710.2.el7_7
imgbased-1.1.8-0.1.el7ev.noarch

How reproducible:
100%

Steps to Reproduce:
1. Install redhat-virtualization-host-4.3.5-20190710.2.el7_7
2. Boot into the system after installation finished
3. Run `imgbase layout --init`

Actual results:
1. The error message is as above

Expected results:
1. The error message should tell user there is already a working imgbase

Additional info:

Comment 2 Qin Yuan 2019-07-18 06:06:55 UTC
Test with:
redhat-virtualization-host-4.3.5-20190717.0.el7_7
imgbased-1.1.9-0.1.el7ev.noarch

The output of `imgbase layout --init` on the current layer is:

[root@ati-fc-02 ~]# imgbase layout --init
2019-07-18 13:57:00,192 [INFO] (MainThread) Trying to create a manageable base from '/'
Traceback (most recent call last):
  File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/lib/python2.7/site-packages/imgbased/__main__.py", line 53, in <module>
    CliApplication()
  File "/usr/lib/python2.7/site-packages/imgbased/__init__.py", line 82, in CliApplication
    app.hooks.emit("post-arg-parse", args)
  File "/usr/lib/python2.7/site-packages/imgbased/hooks.py", line 120, in emit
    cb(self.context, *args)
  File "/usr/lib/python2.7/site-packages/imgbased/plugins/core.py", line 173, in post_argparse
    layout.initialize(args.source, args.init_nvr)
  File "/usr/lib/python2.7/site-packages/imgbased/plugins/core.py", line 220, in initialize
    self.app.imgbase.init_layout_from(source, init_nvr)
  File "/usr/lib/python2.7/site-packages/imgbased/imgbase.py", line 286, in init_layout_from
    self.init_tags_on(existing_lv)
  File "/usr/lib/python2.7/site-packages/imgbased/imgbase.py", line 252, in init_tags_on
    self._assert_tags(lv)
  File "/usr/lib/python2.7/site-packages/imgbased/imgbase.py", line 138, in _assert_tags
    "Looks like the system already has imgbase working properly.\n"
imgbased.imgbase.ExistingImgbaseWithTags: Looks like the system already has imgbase working properly.
However, imgbase was called with --init. If this was intentional, please untag the existing volumes and try again.

The error message is correct. The bug is fixed, move to VERIFIED.

Comment 5 errata-xmlrpc 2019-08-12 11:54:28 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/RHSA-2019:2437