Bug 877811 - lvconvert --repair ignores -f option when -y option is used
Summary: lvconvert --repair ignores -f option when -y option is used
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: lvm2
Version: 6.5
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Peter Rajnoha
QA Contact: Cluster QE
URL:
Whiteboard:
Depends On:
Blocks: 888457
TreeView+ depends on / blocked
 
Reported: 2012-11-18 23:00 UTC by benscott
Modified: 2013-02-21 08:15 UTC (History)
11 users (show)

Fixed In Version: lvm2-2.02.98-5.el6
Doc Type: Bug Fix
Doc Text:
The lvconvert command handles the -y and -f command line options inconsistently when repairing mirror or raid volumes. With the -f option alone, the broken image is removed but in conjunction with the -y option, the -f option is ignored and replacement is done. The tool now handles -f correctly and doesn't replace volumes, as described on the man page.
Clone Of:
Environment:
Last Closed: 2013-02-21 08:15:01 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:0501 normal SHIPPED_LIVE lvm2 bug fix and enhancement update 2013-02-20 21:30:45 UTC

Description benscott 2012-11-18 23:00:50 UTC
Description of problem:

The lvconvert command seems inconsistent in applying the
command line options -y and -f on mirror repairs. If I
specify the -f option alone the broken image is removed 
as implied by the man page but in conjuntion with the -y
option, the -f option is ignored and replacement is done.

in other words:

 lvconvert --repair -f name        <<removes the faulty image>>
 lvconvert --repair -y -f name     <<replaces the faulty image>>


From the lvconvert man page:

 --repair

   Repair a mirror after suffering a disk failure. The mirror will be
   brought back into a consistent state.  By default, the original
   number of mirrors will be restored if possible.  Specify -y on the
   command line to skip the prompts. Use -f if you do not want any
   replacement.  Additionally, you may use --use-policies to use the
   device replacement policy specified in lvm.conf(5),
   viz. activation/mirror_log_fault_policy or
   activation/mirror_device_fault_policy.

{ TEST SETUP FOLLOWS }

#lvs --version
  LVM version:     2.02.98(2) (2012-10-15)
  Library version: 1.02.77 (2012-10-15)
  Driver version:  4.23.0


The test mirror with all physical devices working:

~# pvs
  PV         VG   Fmt  Attr PSize PFree
  /dev/sdc   vg1  lvm2 a--  5.13g 4.93g
  /dev/sdd   vg1  lvm2 a--  5.13g 5.12g
  /dev/sde   vg1  lvm2 a--  5.13g 4.93g
  /dev/sdf   vg1  lvm2 a--  5.13g 5.13g


~# lvs --all -o +devices
  LV               VG   Attr      LSize    Log        Copy%  Devices                            
  lvol0            vg1  mwi-a-m-- 200.00m  lvol0_mlog 100.00 lvol0_mimage_0(0),lvol0_mimage_1(0)
  [lvol0_mimage_0] vg1  iwi-aom-- 200.00m                    /dev/sdc(0)                        
  [lvol0_mimage_1] vg1  iwi-aom-- 200.00m                    /dev/sde(0)                        
  [lvol0_mlog]     vg1  lwi-aom--   2.00m                    /dev/sdd(0)  


Now we kill off device /dev/sdc:

~# lvs --all -o +devices
  Couldn't find device with uuid AnR728-QcVB-R47B-qU2y-Ns0S-H1Mh-premLH.
  LV               VG   Attr      LSize   Log        Copy%  Devices                            
  lvol0            vg1  mwi-a-m-p 200.00m lvol0_mlog 100.00 lvol0_mimage_0(0),lvol0_mimage_1(0)
  [lvol0_mimage_0] vg1  iwi-aom-p 200.00m                   unknown device(0)                  
  [lvol0_mimage_1] vg1  iwi-aom-- 200.00m                   /dev/sde(0)                        
  [lvol0_mlog]     vg1  lwi-aom--   2.00m                   /dev/sdd(0)                        

{ END TEST SETUP }

{ TEST ONE }

Run lvconvert with the -y and -f option:

~# lvconvert --repair -y -f  vg1/lvol0
  Couldn't find device with uuid AnR728-QcVB-R47B-qU2y-Ns0S-H1Mh-premLH.
  Mirror status: 1 of 2 images failed.
  Trying to up-convert to 2 images, 1 logs.
  vg1/lvol0: Converted: 2.0%
  vg1/lvol0: Converted: 100.0%

~# lvs --all -o +devices
  Couldn't find device with uuid AnR728-QcVB-R47B-qU2y-Ns0S-H1Mh-premLH.
  LV               VG   Attr      LSize   Log        Copy%  Devices                            
  lvol0            vg1  mwi-a-m-- 200.00m lvol0_mlog 100.00 lvol0_mimage_0(0),lvol0_mimage_1(0)
  [lvol0_mimage_0] vg1  iwi-aom-- 200.00m                   /dev/sde(0)                        
  [lvol0_mimage_1] vg1  iwi-aom-- 200.00m                   /dev/sdf(0)                        
  [lvol0_mlog]     vg1  lwi-aom--   2.00m                   /dev/sdd(1) 

{ END TEST ONE }

{ TEST TWO }

If I Recreate the original mirror and then break it
the same way and run lvconvert with only the -f option:

~# lvconvert --repair -f  vg1/lvol0
  Couldn't find device with uuid AnR728-QcVB-R47B-qU2y-Ns0S-H1Mh-premLH.
  Mirror status: 1 of 2 images failed.

~# lvs --all -o +devices
  Couldn't find device with uuid AnR728-QcVB-R47B-qU2y-Ns0S-H1Mh-premLH.
  LV    VG   Attr      LSize   Log Copy%  Convert Devices    
  lvol0 vg1  -wi-a---- 200.00m                    /dev/sde(0)

{ END TEST TWO }

So if I use the -y option lvconvert ignores the -f option and replaces
the missing physical volumes while it works as expected without the
-y option.

Comment 3 Nenad Peric 2012-12-11 09:06:59 UTC
Adding QA Ack with test being described in the BZ report/description, and a self-reminder that this should be tested with --type mirror and --type raid1 as well.

Comment 4 Peter Rajnoha 2012-12-11 09:31:20 UTC
Standard mirrors:
=================
(test with lvconvert --repair -y)
$ lvcreate -l1 -m1 vg
  Logical volume "lvol0" created
$ lvs -a -o lv_name,devices
  LV               Devices                            
  root             /dev/vda1(0)                       
  swap             /dev/vda1(2250)                    
  lvol0            lvol0_mimage_0(0),lvol0_mimage_1(0)
  [lvol0_mimage_0] /dev/sda(0)                        
  [lvol0_mimage_1] /dev/sdb(0)                        
  [lvol0_mlog]     /dev/sdc(0)                        
$ echo offline > /sys/block/sda/device/state 
$ lvs -a -o lv_name,devices
  Couldn't find device with uuid gHAo1c-YSOh-iFHM-9p0k-EfhX-gk8C-asEvLE.
  LV               Devices                            
  root             /dev/vda1(0)                       
  swap             /dev/vda1(2250)                    
  lvol0            lvol0_mimage_0(0),lvol0_mimage_1(0)
  [lvol0_mimage_0] unknown device(0)                  
  [lvol0_mimage_1] /dev/sdb(0)                        
  [lvol0_mlog]     /dev/sdc(0)                        
$ lvconvert --repair -y vg/lvol0
  Couldn't find device with uuid gHAo1c-YSOh-iFHM-9p0k-EfhX-gk8C-asEvLE.
  Mirror status: 1 of 2 images failed.
  Trying to up-convert to 2 images, 1 logs.
  vg/lvol0: Converted: 100.0%
$ lvs -a -o lv_name,devices
  Couldn't find device with uuid gHAo1c-YSOh-iFHM-9p0k-EfhX-gk8C-asEvLE.
  LV               Devices                            
  root             /dev/vda1(0)                       
  swap             /dev/vda1(2250)                    
  lvol0            lvol0_mimage_0(0),lvol0_mimage_1(0)
  [lvol0_mimage_0] /dev/sdb(0)                        
  [lvol0_mimage_1] /dev/sdc(0)                        
  [lvol0_mlog]     /dev/sdc(1) 

---
(test with lvconvert --repair -y -f)
$ lvcreate -l1 -m1 vg
  Logical volume "lvol0" created
$ lvs -a -o lv_name,devices
  LV               Devices                            
  root             /dev/vda1(0)                       
  swap             /dev/vda1(2250)                    
  lvol0            lvol0_mimage_0(0),lvol0_mimage_1(0)
  [lvol0_mimage_0] /dev/sda(0)                        
  [lvol0_mimage_1] /dev/sdb(0)                        
  [lvol0_mlog]     /dev/sdc(0)                        
$ echo offline > /sys/block/sda/device/state
$ lvs -a -o lv_name,devices
  Couldn't find device with uuid gHAo1c-YSOh-iFHM-9p0k-EfhX-gk8C-asEvLE.
  LV               Devices                            
  root             /dev/vda1(0)                       
  swap             /dev/vda1(2250)                    
  lvol0            lvol0_mimage_0(0),lvol0_mimage_1(0)
  [lvol0_mimage_0] unknown device(0)                  
  [lvol0_mimage_1] /dev/sdb(0)                        
  [lvol0_mlog]     /dev/sdc(0)                        
$ lvconvert --repair -y -f vg/lvol0
  Couldn't find device with uuid gHAo1c-YSOh-iFHM-9p0k-EfhX-gk8C-asEvLE.
  Mirror status: 1 of 2 images failed.
$ lvs -a -o lv_name,devices
  Couldn't find device with uuid gHAo1c-YSOh-iFHM-9p0k-EfhX-gk8C-asEvLE.
  LV    Devices        
  root  /dev/vda1(0)   
  swap  /dev/vda1(2250)
  lvol0 /dev/sdb(0)   


RAID mirrors
============
(test with lvconvert --repair -y)
$ lvcreate -l1 -m1 --type raid1 vg      
  Logical volume "lvol0" created
$ lvs -a -o lv_name,devices
  LV               Devices                            
  root             /dev/vda1(0)                       
  swap             /dev/vda1(2250)                    
  lvol0            lvol0_rimage_0(0),lvol0_rimage_1(0)
  [lvol0_rimage_0] /dev/sda(1)                        
  [lvol0_rimage_1] /dev/sdb(1)                        
  [lvol0_rmeta_0]  /dev/sda(0)                        
  [lvol0_rmeta_1]  /dev/sdb(0)                        
$ echo offline > /sys/block/sda/device/state
$ lvs -a -o lv_name,devices
  Couldn't find device with uuid gHAo1c-YSOh-iFHM-9p0k-EfhX-gk8C-asEvLE.
  LV               Devices                            
  root             /dev/vda1(0)                       
  swap             /dev/vda1(2250)                    
  lvol0            lvol0_rimage_0(0),lvol0_rimage_1(0)
  [lvol0_rimage_0] unknown device(1)                  
  [lvol0_rimage_1] /dev/sdb(1)                        
  [lvol0_rmeta_0]  unknown device(0)                  
  [lvol0_rmeta_1]  /dev/sdb(0)                        
$ lvconvert --repair -y vg/lvol0
  Couldn't find device with uuid gHAo1c-YSOh-iFHM-9p0k-EfhX-gk8C-asEvLE.
  Faulty devices in vg/lvol0 successfully replaced.
$ lvs -a -o lv_name,devices
  Couldn't find device with uuid gHAo1c-YSOh-iFHM-9p0k-EfhX-gk8C-asEvLE.
  LV               Devices                            
  root             /dev/vda1(0)                       
  swap             /dev/vda1(2250)                    
  lvol0            lvol0_rimage_0(0),lvol0_rimage_1(0)
  [lvol0_rimage_0] /dev/sdc(1)                        
  [lvol0_rimage_1] /dev/sdb(1)                        
  [lvol0_rmeta_0]  /dev/sdc(0)                        
  [lvol0_rmeta_1]  /dev/sdb(0)

---
(test with lvconvert --repair -y -f)
$ lvcreate -l1 -m1 --type raid1 vg
  Logical volume "lvol0" created
$ lvs -a -o lv_name,devices
  LV               Devices                            
  root             /dev/vda1(0)                       
  swap             /dev/vda1(2250)                    
  lvol0            lvol0_rimage_0(0),lvol0_rimage_1(0)
  [lvol0_rimage_0] /dev/sda(1)                        
  [lvol0_rimage_1] /dev/sdb(1)                        
  [lvol0_rmeta_0]  /dev/sda(0)                        
  [lvol0_rmeta_1]  /dev/sdb(0)                        
$ echo offline > /sys/block/sda/device/state
$ lvs -a -o lv_name,devices
  Couldn't find device with uuid gHAo1c-YSOh-iFHM-9p0k-EfhX-gk8C-asEvLE.
  LV               Devices                            
  root             /dev/vda1(0)                       
  swap             /dev/vda1(2250)                    
  lvol0            lvol0_rimage_0(0),lvol0_rimage_1(0)
  [lvol0_rimage_0] unknown device(1)                  
  [lvol0_rimage_1] /dev/sdb(1)                        
  [lvol0_rmeta_0]  unknown device(0)                  
  [lvol0_rmeta_1]  /dev/sdb(0)                        
$ lvconvert --repair -y -f vg/lvol0
  Couldn't find device with uuid gHAo1c-YSOh-iFHM-9p0k-EfhX-gk8C-asEvLE.
$ lvs -a -o lv_name,devices
  Couldn't find device with uuid gHAo1c-YSOh-iFHM-9p0k-EfhX-gk8C-asEvLE.
  LV               Devices                            
  root             /dev/vda1(0)                       
  swap             /dev/vda1(2250)                    
  lvol0            lvol0_rimage_0(0),lvol0_rimage_1(0)
  [lvol0_rimage_0] unknown device(1)                  
  [lvol0_rimage_1] /dev/sdb(1)                        
  [lvol0_rmeta_0]  unknown device(0)                  
  [lvol0_rmeta_1]  /dev/sdb(0)

Comment 7 Nenad Peric 2012-12-13 15:36:40 UTC
Tested with type mirror and raid (mirror in clustered mode as well, raid not supported).

Marking the behaviour the same  as described in Comment #4.

tested with:

lvm2-2.02.98-5.el6.x86_64
lvm2-cluster-2.02.98-5.el6.x86_64
device-mapper-1.02.77-5.el6.x86_64
cmirror-2.02.98-5.el6.x86_64

Comment 8 errata-xmlrpc 2013-02-21 08:15:01 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.

http://rhn.redhat.com/errata/RHBA-2013-0501.html


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