Bug 861456

Summary: mirrored thin pool volume creation attempt ignores --thinpool flag
Product: Red Hat Enterprise Linux 6 Reporter: Corey Marthaler <cmarthal>
Component: lvm2Assignee: Zdenek Kabelac <zkabelac>
Status: CLOSED ERRATA QA Contact: Cluster QE <mspqa-list>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.3CC: agk, dwysocha, heinzm, jbrassow, msnitzer, prajnoha, prockai, thornber, zkabelac
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: lvm2-2.02.98-1.el6 Doc Type: Bug Fix
Doc Text:
Usage of lvcreate options --thinpool together with --mirror caused unexpected mirrored lV being created. This behavior has been fixed by adding explicit check for this case and failing the command with proper error message.
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-21 08:13:58 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 Corey Marthaler 2012-09-28 16:19:58 UTC
Description of problem:
# Creates a linear Pool Volume
[root@taft-04 ~]# lvcreate --thinpool POOL_lin -L 100M taft
  Rounding up size to full physical extent 4.00 MiB
  WARNING: Thin pool target does not support discards (needs kernel >= 3.4).
  Logical volume "POOL_lin" created
[root@taft-04 ~]# lvs -a -o +devices
  LV               VG    Attr     LSize   Pool Data%  Devices
  POOL_lin         taft  twi-a-tz 100.00m        0.00 POOL_lin_tdata(0)
  [POOL_lin_tdata] taft  Twi-aot- 100.00m             /dev/sdb1(0)
  [POOL_lin_tmeta] taft  ewi-aot-   4.00m             /dev/sdh1(0)


# Creates a striped Pool Volume
[root@taft-04 ~]# lvcreate --thinpool POOL_str -i 2 -L 100M taft
  Using default stripesize 64.00 KiB
  Rounding up size to full physical extent 4.00 MiB
  Rounding size (25 extents) up to stripe boundary size (26 extents)
  WARNING: Thin pool target does not support discards (needs kernel >= 3.4).
  Logical volume "POOL_str" created
[root@taft-04 ~]# lvs -a -o +devices
  LV               VG    Attr     LSize   Pool Data%  Devices
  POOL_str         taft  twi-a-tz 104.00m        0.00 POOL_str_tdata(0)
  [POOL_str_tdata] taft  Twi-aot- 104.00m             /dev/sdb1(25),/dev/sdc1(0)
  [POOL_str_tmeta] taft  ewi-aot-   4.00m             /dev/sdh1(1)


# Creates just a regular Mirror, ignores --thinpool flag
[root@taft-04 ~]# lvcreate --thinpool POOL_mir -m 1 -L 100M taft
  Logical volume "lvol0" created
[root@taft-04 ~]# lvs -a -o +devices
  LV               VG    Attr     LSize   Pool Data% Log        Copy%  Devices
  lvol0            taft  mwi-a-m- 100.00m            lvol0_mlog 100.00 lvol0_mimage_0(0),lvol0_mimage_1(0)
  [lvol0_mimage_0] taft  iwi-aom- 100.00m                              /dev/sdb1(38)
  [lvol0_mimage_1] taft  iwi-aom- 100.00m                              /dev/sdc1(13)
  [lvol0_mlog]     taft  lwi-aom-   4.00m                              /dev/sdh1(2)


Version-Release number of selected component (if applicable):
2.6.32-279.el6.x86_64

lvm2-2.02.97-3.el6    BUILT: Tue Sep 11 05:06:56 CDT 2012
lvm2-libs-2.02.97-3.el6    BUILT: Tue Sep 11 05:06:56 CDT 2012
lvm2-cluster-2.02.97-3.el6    BUILT: Tue Sep 11 05:06:56 CDT 2012
udev-147-2.41.el6    BUILT: Thu Mar  1 13:01:08 CST 2012
device-mapper-1.02.76-3.el6    BUILT: Tue Sep 11 05:06:56 CDT 2012
device-mapper-libs-1.02.76-3.el6    BUILT: Tue Sep 11 05:06:56 CDT 2012
device-mapper-event-1.02.76-3.el6    BUILT: Tue Sep 11 05:06:56 CDT 2012
device-mapper-event-libs-1.02.76-3.el6    BUILT: Tue Sep 11 05:06:56 CDT 2012
cmirror-2.02.97-3.el6    BUILT: Tue Sep 11 05:06:56 CDT 2012

Comment 1 Zdenek Kabelac 2012-10-12 11:13:22 UTC
Prohibit --thinpool to be used with --mirrors with upstream commit:

https://www.redhat.com/archives/lvm-devel/2012-October/msg00100.html

Comment 3 Corey Marthaler 2013-01-24 23:46:04 UTC
Fix verified that --thinpool and --mirrors are no longer allowed:

[root@qalvm-01 ~]# lvcreate --thinpool POOL_mir -m 1 -L 100M taft
  --thin,--thinpool  and --mirrors are incompatible.
  Run `lvcreate --help' for more information.


However it is still possible to convert an existing mirror to a thin pool. Should that still be allowed? If so should this have been fixed to work with mirrors instead of just turning this options off. Are converted mirrored thin pool volumes supported?

# converted mirror to thin pool

[root@qalvm-01 ~]# lvs -a -o +devices
 LV                               Attr      LSize   Pool            Data%  Log                       Cpy%Sync Devices
 origin                           Vwi-a-tz- 500.00m to_pool_convert   0.00
 to_pool_convert                  twi-a-tz- 100.00m                   0.00                                    to_pool_convert_tdata(0)
 [to_pool_convert_tdata]          mwi-aot-- 100.00m                        to_pool_convert_tdata_mlog  100.00 to_pool_convert_tdata_mimage_0(0),to_pool_convert_tdata_mimage_1(0)
 [to_pool_convert_tdata_mimage_0] iwi-aom-- 100.00m                                                           /dev/vdc1(0)
 [to_pool_convert_tdata_mimage_1] iwi-aom-- 100.00m                                                           /dev/vdg1(0)
 [to_pool_convert_tdata_mlog]     lwi-aom--   4.00m                                                           /dev/vdg1(25)
 [to_pool_convert_tmeta]          mwi-aot-- 100.00m                        to_pool_convert_tmeta_mlog  100.00 to_pool_convert_tmeta_mimage_0(0),to_pool_convert_tmeta_mimage_1(0)
 [to_pool_convert_tmeta_mimage_0] iwi-aom-- 100.00m                                                           /dev/vdc1(25)
 [to_pool_convert_tmeta_mimage_1] iwi-aom-- 100.00m                                                           /dev/vdg1(26)
 [to_pool_convert_tmeta_mlog]     lwi-aom--   4.00m                                                           /dev/vdg1(51)

Comment 4 Zdenek Kabelac 2013-01-25 19:15:29 UTC
Yes - it's desired behavior - you could select some LV to be converted into thin pool data (--thinpool) and metadata (--poolmetadata) devices.

So you may create mirrored LV - and use it for data or metadata - since you cannot create them via one command.

Mirror devices are renamed to make it clear which pool they create.

Comment 5 errata-xmlrpc 2013-02-21 08:13:58 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