Bug 2035238

Summary: [RFE] $lvconvert -m 0 should print warnings while unmirror the device from the mirroring and it should remove the device which mention in the lvconvert command only not the all device or any other devices
Product: Red Hat Enterprise Linux 8 Reporter: pratapsingh <pmahale>
Component: lvm2Assignee: Heinz Mauelshagen <heinzm>
lvm2 sub component: Mirroring and RAID QA Contact: cluster-qe <cluster-qe>
Status: CLOSED WONTFIX Docs Contact:
Severity: low    
Priority: low CC: agk, heinzm, jbrassow, msnitzer, prajnoha, zkabelac
Version: 8.0Keywords: FutureFeature, Triaged
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-08-25 14:07:24 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 pratapsingh 2021-12-23 10:53:11 UTC
Description of problem:

$lvconvert -m 0 command should print warnings while unmirror the device from the mirroring  and it should only remove the device which mention in the lvconvert command not the all device or any other devices.

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

RHEL ALL

How reproducible:


Steps to Reproduce:


1. I mirrored sdf and sdc and the original was on sdd and sdb

I ran the command to remove FROM sdb and sdf (instead of sdd) and it removed it from sdf and sdc, the new mirror.


[root@rhel8-3 ~]# pvs
  PV         VG    Fmt  Attr PSize   PFree  
  /dev/sdb   vgapp lvm2 a--  100.00m      0 
  /dev/sdc   vgapp lvm2 a--  100.00m 100.00m
  /dev/sdd   vgapp lvm2 a--  100.00m      0 
  /dev/sdf   vgapp lvm2 a--  100.00m 100.00m

[root@rhel8-3 ~]# lvs --all --segments -o lv_name,vg_name,stripes,segtype,seg_size,copy_percent,devices  vgapp
  LV            VG    #Str Type   SSize   Cpy%Sync Devices    
  lvapplication vgapp    1 linear 100.00m          /dev/sdb(0)
  lvapplication vgapp    1 linear 100.00m          /dev/sdd(0)

--> Added /dev/sdf & /dev/sdc

[root@rhel8-3 ~]# lvconvert -m 1 --type mirror --mirrorlog core /dev/vgapp/lvapplication /dev/sdf /dev/sdc
  Logical volume vgapp/lvapplication being converted.
  vgapp/lvapplication: Converted: 8.00%
  vgapp/lvapplication: Converted: 100.00%

[root@rhel8-3 ~]# lvs --all --segments -o lv_name,vg_name,stripes,segtype,seg_size,copy_percent,devices  vgapp
  LV                       VG    #Str Type   SSize   Cpy%Sync Devices                                            
  lvapplication            vgapp    2 mirror 200.00m 100.00   lvapplication_mimage_0(0),lvapplication_mimage_1(0)
  [lvapplication_mimage_0] vgapp    1 linear 100.00m          /dev/sdb(0)                                        
  [lvapplication_mimage_0] vgapp    1 linear 100.00m          /dev/sdd(0)                                        
  [lvapplication_mimage_1] vgapp    1 linear 100.00m          /dev/sdf(0)                                        
  [lvapplication_mimage_1] vgapp    1 linear 100.00m          /dev/sdc(0)  

--> I ran the command to remove from the /dev/sdb and /dev/sdf 

[root@rhel8-3 ~]#  lvconvert -m 0 /dev/vgapp/lvapplication /dev/sdb /dev/sdf
  Logical volume vgapp/lvapplication converted.


-->But it removed it from sdf and sdc, the new mirror instead of /dev/sdb.

  [root@rhel8-3 ~]# lvs --all --segments -o lv_name,vg_name,stripes,segtype,seg_size,copy_percent,devices  vgapp
  LV            VG    #Str Type   SSize   Cpy%Sync Devices    
  lvapplication vgapp    1 linear 100.00m          /dev/sdb(0)
  lvapplication vgapp    1 linear 100.00m          /dev/sdd(0)
[root@rhel8-3 ~]# 

2. Second example 

I mirrored to sdf and sdc again and then unmirrored from just one of the old disks, sdb, and it removed the mirror from sdf and sdc again.

[root@rhel8-3 ~]# lvconvert -m 1 --type mirror --mirrorlog core /dev/vgapp/lvapplication /dev/sdf /dev/sdc
  Logical volume vgapp/lvapplication being converted.
  vgapp/lvapplication: Converted: 8.00%
  vgapp/lvapplication: Converted: 100.00%

[root@rhel8-3 ~]# lvs --all --segments -o lv_name,vg_name,stripes,segtype,seg_size,copy_percent,devices  vgapp
  LV                       VG    #Str Type   SSize   Cpy%Sync Devices                                            
  lvapplication            vgapp    2 mirror 200.00m 100.00   lvapplication_mimage_0(0),lvapplication_mimage_1(0)
  [lvapplication_mimage_0] vgapp    1 linear 100.00m          /dev/sdb(0)                                        
  [lvapplication_mimage_0] vgapp    1 linear 100.00m          /dev/sdd(0)                                        
  [lvapplication_mimage_1] vgapp    1 linear 100.00m          /dev/sdf(0)                                        
  [lvapplication_mimage_1] vgapp    1 linear 100.00m          /dev/sdc(0)                                        

[root@rhel8-3 ~]# lvconvert -m 0 /dev/vgapp/lvapplication /dev/sdb
  Logical volume vgapp/lvapplication converted.

[root@rhel8-3 ~]# lvs --all --segments -o lv_name,vg_name,stripes,segtype,seg_size,copy_percent,devices  vgapp
  LV            VG    #Str Type   SSize   Cpy%Sync Devices    
  lvapplication vgapp    1 linear 100.00m          /dev/sdb(0) -----------> the device which I mentioned that device still lvm showing. 
  lvapplication vgapp    1 linear 100.00m          /dev/sdd(0)
~~~~


Actual results:

$lvconvert command unmirror newly added mirror device
$lvconvert unmirror the device which accidentally mentioned while removing the device without warning. 


Expected results:

$lvconvert command should print warning prior to unmirror device.
$lvconvert should remove the device that's only mentioned in the command not the other device.


Additional info: