Bug 476694

Summary: lvm delete message calulates the number of volumes incorrectly
Product: Red Hat Enterprise Linux 4 Reporter: Milan Broz <mbroz>
Component: lvm2Assignee: Peter Rajnoha <prajnoha>
Status: CLOSED ERRATA QA Contact: Cluster QE <mspqa-list>
Severity: low Docs Contact:
Priority: low    
Version: 4.7CC: agk, cmarthal, dwysocha, edamato, heinzm, jbrassow, mbroz, prockai, pvrabec
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-05-18 20:11:08 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Milan Broz 2008-12-16 15:56:58 UTC
+++ This bug was initially created as a clone of Bug #431760 +++
RHEL4 clone

Description of problem:

[root@grant-03 ~]# vgremove mirror_sanity
Do you really want to remove volume group "mirror_sanity" containing 8 logical
volumes? [y/n]:          

There are really one 2 volumes, not 8, they just both happen to be mirrors.

[root@grant-03 ~]# lvs
  LV             VG            Attr   LSize  Origin Snap%  Move Log            
    Copy%  Convert
  LogVol00       VolGroup00    -wi-ao 72.44G
  LogVol01       VolGroup00    -wi-ao  1.94G
  resync_nosync  mirror_sanity mwi-a-  2.00G                   
resync_nosync_mlog  100.00
  resync_regular mirror_sanity mwi-a-  2.00G                   
resync_regular_mlog  10.55


[root@grant-03 ~]# lvs -a -o +devices
  LV                        VG            Attr   LSize  Origin Snap%  Move Log 
               Copy%  Convert Devices
  LogVol00                  VolGroup00    -wi-ao 72.44G                        
                              /dev/sda2(0)
  LogVol01                  VolGroup00    -wi-ao  1.94G                        
                              /dev/sda2(2318)
  resync_nosync             mirror_sanity mwi-a-  2.00G                   
resync_nosync_mlog  100.00        
resync_nosync_mimage_0(0),resync_nosync_mimage_1(0)
  [resync_nosync_mimage_0]  mirror_sanity iwi-ao  2.00G                        
                              /dev/sdd1(0)
  [resync_nosync_mimage_1]  mirror_sanity iwi-ao  2.00G                        
                              /dev/sdb5(0)
  [resync_nosync_mlog]      mirror_sanity lwi-ao  4.00M                        
                              /dev/sdb3(0)
  resync_regular            mirror_sanity mwi-a-  2.00G                   
resync_regular_mlog  10.55        
resync_regular_mimage_0(0),resync_regular_mimage_1(0)
  [resync_regular_mimage_0] mirror_sanity Iwi-ao  2.00G                        
                              /dev/sdd1(512)
  [resync_regular_mimage_1] mirror_sanity Iwi-ao  2.00G                        
                              /dev/sdb2(0)
  [resync_regular_mlog]     mirror_sanity lwi-ao  4.00M                        
                              /dev/sdb5(512)


Version-Release number of selected component (if applicable):
lvm2-2.02.32-1.el5
lvm2-cluster-2.02.32-1.el5

How reproducible:
everytime


--- Additional comment from prajnoha on 2008-12-04 11:46:33 EDT ---

There are other places in code where similar inconsistency related to counting visible LVs (from user's perspective!) can be found, like in output of "vgdisplay -c" command. Snapshot volumes should be counted in statistics of open LVs within the output of "vgdisplay", "vgremove" should count snapshot volumes as well while displaying the message about the number of LVs beeing deleted. Renaming of hidden snapshot volumes should not be allowed for a user.

All these cases are related to testing the visibility and counting of LVs from user's perpsective, so two new functions have been proposed - displayable_lvs_in_vg counting LVs in a given VG that are displayable to the user through outputs of commands and lv_is_displayable testing the actual visibility of an LV. These should be used instead of lv_is_visible function whenever a test for visibility and counting from user's perspective is needed (e.g. in listings and outputs of user commands).

The fix has been uploaded to CVS.

Comment 2 Milan Broz 2008-12-16 16:54:38 UTC
In CVS - lvm2-2.02.42-1.el4

Comment 4 Corey Marthaler 2009-04-20 21:48:31 UTC
fix verified in lvm2-2.02.42-5.el4.

Comment 6 errata-xmlrpc 2009-05-18 20:11:08 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2009-0967.html