Bug 1632585 - lvremove command will fail if it asks for confirmation while removing old RHV-H layers
Summary: lvremove command will fail if it asks for confirmation while removing old RHV...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: imgbased
Version: 4.2.6
Hardware: All
OS: Linux
unspecified
high
Target Milestone: ovirt-4.2.7
: ---
Assignee: Yuval Turgeman
QA Contact: Huijuan Zhao
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-09-25 07:42 UTC by nijin ashok
Modified: 2020-08-03 15:38 UTC (History)
13 users (show)

Fixed In Version: imgbased-1.0.29
Doc Type: Bug Fix
Doc Text:
During the upgrade process, when lvremove runs garbage collection, it prompts for user confirmation, causing the upgrade process to fail. Now the process uses "lvremove --force" when trying to remove logical volumes and does not fail even if garbage collection fails, and as a result, the upgrade process finishes successfully.
Clone Of:
Environment:
Last Closed: 2018-11-05 15:01:34 UTC
oVirt Team: Node
Target Upstream Version:
lsvaty: testing_plan_complete-


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2018:3470 None None None 2018-11-05 15:01:45 UTC
oVirt gerrit 94619 master MERGED Do not fail update on garbage collection 2018-10-02 11:35:42 UTC
oVirt gerrit 94632 ovirt-4.2 MERGED Do not fail update on garbage collection 2018-10-09 08:41:49 UTC

Description nijin ashok 2018-09-25 07:42:31 UTC
Description of problem:

The host is having the custom configuration "issue_discards = 1" in the lvm.conf on hypervisor. So if we execute any lvremove command, it will ask for confirmation as below.

lvremove rhvh/rhvh-4.1-0.20180314.0+1;echo $?
Do you really want to remove and DISCARD logical volume rhvh/rhvh-4.1-0.20180314.0+1? [y/n]: y

While removing the old layers, the lvremove is executed without "force" option. So the lvremove command will give an exit status of 5 because of the above confirmation and it will fail with the error below.

===
2018-09-18 15:08:16,196 [DEBUG] (MainThread) Calling: (['lvremove', u'rhvh/rhvh-4.1-0.20180314.0+1'],) {'close_fds': True, 'stderr': <open file '/dev/null', mode 'w' at 0x7f757fe94030>}
2018-09-18 15:08:16,308 [DEBUG] (MainThread) Exception!
2018-09-18 15:08:16,308 [ERROR] (MainThread) Update failed, resetting registered LVs

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 "/tmp/tmp.33vZVUL00H/usr/lib/python2.7/site-packages/imgbased/__main__.py", line 53, in <module>
    CliApplication()
  File "/tmp/tmp.33vZVUL00H/usr/lib/python2.7/site-packages/imgbased/__init__.py", line 82, in CliApplication
    app.hooks.emit("post-arg-parse", args)
  File "/tmp/tmp.33vZVUL00H/usr/lib/python2.7/site-packages/imgbased/hooks.py", line 120, in emit
    cb(self.context, *args)
  File "/tmp/tmp.33vZVUL00H/usr/lib/python2.7/site-packages/imgbased/plugins/update.py", line 68, in post_argparse
    six.reraise(*exc_info)
  File "/tmp/tmp.33vZVUL00H/usr/lib/python2.7/site-packages/imgbased/plugins/update.py", line 63, in post_argparse
    GarbageCollector(app.imgbase).run(base, keep)
  File "/tmp/tmp.33vZVUL00H/usr/lib/python2.7/site-packages/imgbased/plugins/update.py", line 199, in run
    self.imgbase.remove_base(base.nvr)
  File "/tmp/tmp.33vZVUL00H/usr/lib/python2.7/site-packages/imgbased/imgbase.py", line 332, in remove_base
    self.remove_layer(layer.nvr)
  File "/tmp/tmp.33vZVUL00H/usr/lib/python2.7/site-packages/imgbased/imgbase.py", line 351, in remove_layer
    lv.remove()
  File "/tmp/tmp.33vZVUL00H/usr/lib/python2.7/site-packages/imgbased/lvm.py", line 261, in remove
    LVM._lvremove(cmd)
  File "/tmp/tmp.33vZVUL00H/usr/lib/python2.7/site-packages/imgbased/utils.py", line 393, in lvremove
    return self.call(["lvremove"] + args, **kwargs)
  File "/tmp/tmp.33vZVUL00H/usr/lib/python2.7/site-packages/imgbased/utils.py", line 469, in call
    return super(LvmBinary, self).call(*args, stderr=DEVNULL, **kwargs)
  File "/tmp/tmp.33vZVUL00H/usr/lib/python2.7/site-packages/imgbased/utils.py", line 378, in call
    stdout = call(*args, **kwargs)
  File "/tmp/tmp.33vZVUL00H/usr/lib/python2.7/site-packages/imgbased/utils.py", line 153, in call
    return subprocess.check_output(*args, **kwargs).strip()
  File "/usr/lib64/python2.7/subprocess.py", line 575, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['lvremove', u'rhvh/rhvh-4.1-0.20180314.0+1']' returned non-zero exit status 5
===


Version-Release number of selected component (if applicable):

imgbased-1.0.24

How reproducible:

100 %

Steps to Reproduce:

1. Change issue_discards = 1 in lvm.conf
2. Update the host which is having 3 or more layers. While deleting the old layer LV, it will fail with the mentioned error.

Actual results:

The upgrade is failing because lvremove asks for confirmation before removing the LV.

Expected results:

The upgrade should work. Maybe we can use --force option in lvremove?

Additional info:

Comment 1 Huijuan Zhao 2018-10-11 07:11:04 UTC
QE did not reproduce this issue with normal upgrades, please refer to:
https://bugzilla.redhat.com/show_bug.cgi?id=1632058#c13

Comment 2 Huijuan Zhao 2018-10-12 07:27:47 UTC
QE reproduced this issue, please refer to:
https://bugzilla.redhat.com/show_bug.cgi?id=1632058#c18

Comment 4 Huijuan Zhao 2018-10-22 06:49:34 UTC
This bug is fixed in redhat-virtualization-host-4.2-20181017.2. 
Please refer to:
https://bugzilla.redhat.com/show_bug.cgi?id=1632058#c21

So change the status to VERIFIED.

Comment 5 Steve Goodman 2018-10-29 14:25:52 UTC
Please review the doc text:

During the upgrade process, when lvremove runs garbage collection, it prompts for user confirmation, causing the upgrade process to fail. Now the process uses "lvremove --force" when trying to remove logical volumes and does not fail even if garbage collection fails, and as a result, the upgrade process finishes successfully.

Comment 7 errata-xmlrpc 2018-11-05 15:01:34 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-2018:3470

Comment 8 Daniel Gur 2019-08-28 13:14:20 UTC
sync2jira

Comment 9 Daniel Gur 2019-08-28 13:19:22 UTC
sync2jira


Note You need to log in before you can comment on or make changes to this bug.