Bug 1732328 - Backport PR 2194
Summary: Backport PR 2194
Keywords:
Status: VERIFIED
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: rear
Version: 7.6
Hardware: All
OS: Linux
urgent
medium
Target Milestone: rc
: ---
Assignee: Pavel Cahyna
QA Contact: David Jež
URL:
Whiteboard:
Depends On:
Blocks: 1732308 1734705 1734707
TreeView+ depends on / blocked
 
Reported: 2019-07-23 07:41 UTC by Renaud Métrich
Modified: 2020-02-15 20:03 UTC (History)
7 users (show)

Fixed In Version: rear-2.4-8.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1734705 1734707 (view as bug list)
Environment:
Last Closed:
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Github rear rear issues 2187 'None' closed disklayout.conf file contains duplicate lines 2020-02-15 20:03:13 UTC
Red Hat Knowledge Base (Solution) 4393351 None None None 2019-09-04 15:16:13 UTC

Description Renaud Métrich 2019-07-23 07:41:00 UTC
Description of problem:

We need to backport Upstream PR https://github.com/rear/rear/pull/2194 to our ReaR-2.4 to fix an issue when recovering a system in Migration Mode (happens when a different system is used or disks have not same size) or when Thin Pools are used.
Without the fix, multiple "lvmvol" lines for same LV are added in disklayout.conf, causing multiple "lvcreate" commands for same LV to be used, which breaks the recovery.


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

rear-2.4


How reproducible:

Always


Steps to Reproduce:

1. Add 2 disks to an existing system (to enable creating stripes)

2. Create a VG with the disks

# vgcreate data /dev/sdb /dev/sdc

3. Create 2 LVs with segments

# lvcreate -n lv1 -L 1G data
# lvcreate -n lv2 -L 1G data
# lvextend /dev/data/lv1 -L +1G -i 2
# lvextend /dev/data/lv2 -L +1G -i 2
# lvextend /dev/data/lv1 -L +1G -i 1
# lvextend /dev/data/lv2 -L +1G -i 1

4. Format and mount the LVs

# mkdir -p /lv1 /lv2
# mkfs.ext4 /dev/data/lv1
# mkfs.ext4 /dev/data/lv2
# mount /dev/data/lv1 /lv1
# mount /dev/data/lv2 /lv2

5. Create rescue ISO

# rear mkrescue

6. Check /var/lib/rear/layout/disklayout.conf


Actual results:

(broken)
# lvmvol <volume_group> <name> <size(bytes)> <layout> [key:value ...]
lvmvol /dev/data lv1 3221225472b linear,striped stripes:1
lvmvol /dev/data lv1 3221225472b linear,striped stripesize:65536b stripes:2
lvmvol /dev/data lv1 3221225472b linear,striped stripes:1
lvmvol /dev/data lv2 2147483648b linear,striped stripes:1
lvmvol /dev/data lv2 2147483648b linear,striped stripesize:65536b stripes:2


Expected results:

(with the fix)
# lvmvol <volume_group> <name> <size(bytes)> <layout> [key:value ...]
# WARNING: Volume data/lv1 has multiple segments. Restoring it in Migration Mode using 'lvcreate' won't preserve segments and volume properties of the other segments!
lvmvol /dev/data lv1 3221225472b linear,striped segmentsize:1073741824b stripes:1
#lvmvol /dev/data lv1 3221225472b linear,striped stripesize:65536b segmentsize:1073741824b stripes:2
#lvmvol /dev/data lv1 3221225472b linear,striped segmentsize:1073741824b stripes:1
# WARNING: Volume data/lv2 has multiple segments. Restoring it in Migration Mode using 'lvcreate' won't preserve segments and volume properties of the other segments!
lvmvol /dev/data lv2 2147483648b linear,striped segmentsize:1073741824b stripes:1
#lvmvol /dev/data lv2 2147483648b linear,striped stripesize:65536b segmentsize:1073741824b stripes:2


Additional info:

When in Migration Mode or when recreating Thin Pools, the LV will be recreated using one segment only, which characteristics (e.g. "stripes") of the first segment only.
This is sub-optimal but too complicated to do differently.

Comment 2 Pavel Cahyna 2019-07-23 08:55:41 UTC
Thank you. Does it fix bz1672218 ?

Comment 3 Renaud Métrich 2019-07-23 09:20:17 UTC
bz1672218 was already fixed I guess, but we have no data in that bz to confirm.

Comment 8 Pavel Cahyna 2019-07-29 09:58:00 UTC
Do you really need stripes, thin pools, or migration mode to reproduce the problem?

It seems that the problem appears every time when a LV spans multiple disks (or multiple segments on the same disk, which can easily happen when creating smaller LVs and then extending them into the free space).

For example, I installed a machine with two disks and without any other special configuration. The installer created a LV for home which uses all the available space not used for / or swap, which means it spans the two disks. And behold:

cat /var/lib/rear/layout/disklayout.conf
...
# Format for LVM LVs
# lvmvol <volume_group> <name> <size(bytes)> <layout> [key:value ...]
lvmvol /dev/rhel_ibm-p9wr-08 home 3941727207424b linear 
lvmvol /dev/rhel_ibm-p9wr-08 home 3941727207424b linear 
lvmvol /dev/rhel_ibm-p9wr-08 root 53687091200b linear 

home LV is duplicated - this is because it spans both disks.

I haven't tried recovery yet, but I suspect this duplicate entry could be a problem even without stripes and thin pool, wouldn't it?

Comment 9 Renaud Métrich 2019-07-29 11:23:31 UTC
When not using migration mode or thin pools, there is no issue because the content of disklayout.conf related to LVM stuff (lvmvol, ...) is not used, vgcfgrestore is used instead.
The reproducer using "stripes" is not necessary but points to the real problem: when not using vgcfgrestore, the LV will be created (even with the fix) with the characteristics of the 1st stripe only.

Comment 11 Pavel Cahyna 2019-07-29 14:09:15 UTC
(In reply to Renaud Métrich from comment #9)
> The reproducer using "stripes" is not necessary but points to the real
> problem: when not using vgcfgrestore, the LV will be created (even with the
> fix) with the characteristics of the 1st stripe only.

ITYM "1st segment only".

Comment 13 Renaud Métrich 2019-07-29 14:36:35 UTC
(In reply to Pavel Cahyna from comment #11)
> (In reply to Renaud Métrich from comment #9)
> > The reproducer using "stripes" is not necessary but points to the real
> > problem: when not using vgcfgrestore, the LV will be created (even with the
> > fix) with the characteristics of the 1st stripe only.
> 
> ITYM "1st segment only".

Indeed, 1st segment ...

Comment 21 Pavel Cahyna 2019-07-30 16:55:49 UTC
(In reply to Renaud Métrich from comment #0)

> When in Migration Mode or when recreating Thin Pools, the LV will be
> recreated using one segment only, which characteristics (e.g. "stripes") of
> the first segment only.
> This is sub-optimal but too complicated to do differently.

One could use lvcreate for the first line for a given LV and lvextend for the subsequent duplicates. This would probably preserve most, if not all of the characteristics and maybe would not be that complicated.

Comment 24 Renaud Métrich 2019-07-31 07:28:58 UTC
(In reply to Pavel Cahyna from comment #21)
> (In reply to Renaud Métrich from comment #0)
> 
> > When in Migration Mode or when recreating Thin Pools, the LV will be
> > recreated using one segment only, which characteristics (e.g. "stripes") of
> > the first segment only.
> > This is sub-optimal but too complicated to do differently.
> 
> One could use lvcreate for the first line for a given LV and lvextend for
> the subsequent duplicates. This would probably preserve most, if not all of
> the characteristics and maybe would not be that complicated.

Using lvextend is not complicated, *but* this will not work most of the time since Migration Mode is likely to happen here, so probably due to having disks with different sizes and stuff like that.
Adding that code will be additional trouble for sure.

Comment 31 Pavel Cahyna 2019-09-02 12:45:06 UTC
(In reply to Renaud Métrich from comment #9)
> When not using migration mode or thin pools, there is no issue because the
> content of disklayout.conf related to LVM stuff (lvmvol, ...) is not used,
> vgcfgrestore is used instead.
> The reproducer using "stripes" is not necessary but points to the real
> problem: when not using vgcfgrestore, the LV will be created (even with the
> fix) with the characteristics of the 1st stripe only.

If we are not using vgcfgrestore with thin pools, where does bz1747470/bz1747468 originate from? Their description point to problems with vgcfgrestore on thin pools. Also, in light of bz1747470, does it make sense to fix this bug, since thin pools are still broken?

Comment 32 Renaud Métrich 2019-09-02 12:57:45 UTC
We are using "vgcfgrestore" if a backup "vg.cfg" file is available (which is always the case).
Then, after using this, we delete thin pools, to recreate them using lvcreate commands.
This causes bz1747470/bz1747468 to happen.

We still need to fix this BZ because it's better than nothing.


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