Bug 1479084 - vgcfgbackup does not save the PV metadata size originally specified by --metadatasize
vgcfgbackup does not save the PV metadata size originally specified by --meta...
Status: ON_QA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: lvm2 (Show other bugs)
7.3
x86_64 Linux
unspecified Severity unspecified
: rc
: ---
Assigned To: LVM and device-mapper development team
cluster-qe@redhat.com
: FutureFeature
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-08-07 18:10 EDT by bugzilla
Modified: 2017-10-13 07:51 EDT (History)
10 users (show)

See Also:
Fixed In Version: lvm2-2.02.175-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description bugzilla 2017-08-07 18:10:13 EDT
Description of problem:

When restoring a VG onto PVs that were restored using "pvcreate --restorefile" and the original PVs were formatted using a larger metadata size than the default, vgcfgrestore gives the error "VG data metadata too large for circular buffer" when a larger metadata size is needed.

This is resolved by passing --metadatasize <orig_size> when calling "pvcreate --restorefile", however this is not intuitive and the error is not helpful in determining this.

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

lvm2-2.02.166-1.el7_3.3.x86_64

How reproducible:

Probably easy

Steps to Reproduce:
1. create a PV with larger than default metadata size: pvcreate --metadatasize 128MiB /dev/foo
2. create lots of LVs and exceed the default metadata size
3. vgcfgbackup VG
4. pvcreate -ff --uuid UUID --restorefile /etc/lvm/backup/VG /dev/foo
5. vgcfgrestore -f /etc/lvm/backup/VG

  VG data metadata too large for circular buffer
  Failed to write VG data.
  Restore failed.

Actual results:

VG is not restored.

Expected results:

VG should be restored.

Additional info:

vgcfgbackup should save the metadata size into the backup file and pvcreate should use that size when using --restorefile.

# This does not work:

[root@testsys archive]# pvcreate -ff --uuid KbTpgc-MzKT-e1dK-02Cw-yhgS-2JD6-3hKIj8 --restorefile data_01161-240815845.vg /dev/ssd/pv-tmeta
  Physical volume "/dev/ssd/pv-tmeta" successfully created.

[root@testsys archive]# pvcreate -ff --uuid 06kvOm-xN2Y-iX1y-Tt69-LfFh-ltkG-TtRsgy --restorefile data_01161-240815845.vg /dev/bcache0
  Physical volume "/dev/bcache0" successfully created.

[root@testsys archive]# vgcfgrestore -f data_01161-240815845.vg data --force
  VG data metadata too large for circular buffer
  Failed to write VG data.
  Restore failed.


# This works:

[root@testsys archive]# pvcreate -ff --uuid KbTpgc-MzKT-e1dK-02Cw-yhgS-2JD6-3hKIj8 --restorefile data_01161-240815845.vg /dev/ssd/pv-tmeta --metadatasize 128MiB
  Physical volume "/dev/ssd/pv-tmeta" successfully created.

[root@testsys archive]# pvcreate -ff --uuid 06kvOm-xN2Y-iX1y-Tt69-LfFh-ltkG-TtRsgy --restorefile data_01161-240815845.vg /dev/bcache0 --metadatasize 128MiB
  Physical volume "/dev/bcache0" successfully created.

[root@testsys archive]# vgcfgrestore -f data_01161-240815845.vg data --force
  Restored volume group data
Comment 2 Alasdair Kergon 2017-08-07 18:20:42 EDT
Please would you attach a (compressed?) copy of the actual backup file you're restoring from?

If there's anything you want to hide (like LV names) in it, please overtype those characters keeping the number of characters everywhere the same.  (eg 'hideme' -> 'lvol01')  (If the compressed file is too big, upload it somewhere and post a link.)
Comment 3 Alasdair Kergon 2017-08-08 12:46:12 EDT
I've reproduced something similar.
Comment 4 bugzilla 2017-08-08 13:08:49 EDT
(In reply to Alasdair Kergon from comment #3)
> I've reproduced something similar.

Does that mean you do not need the upload?
Comment 5 Alasdair Kergon 2017-08-08 13:11:43 EDT
       --restorefile file
              In  conjunction with --uuid, this extracts the location and size
              of the data on the PV from the file  (produced  by  vgcfgbackup)
              and  ensures that the metadata that the program produces is con-
              sistent with the contents of the file i.e. the physical  extents
              will  be  in the same place and not get overwritten by new meta-
              data.  This provides a mechanism to upgrade the metadata  format
              or  to add/remove metadata areas. Use with care. See also vgcon-
              vert(8).

So it is doing what it says it does, but if you don't specify the metadata size to use, it would make sense for it to use up the space right up to pe_start, making it similar in size to the original one.
Comment 6 Alasdair Kergon 2017-08-08 13:12:45 EDT
(In reply to bugzilla from comment #4)
> (In reply to Alasdair Kergon from comment #3)
> > I've reproduced something similar.
> 
> Does that mean you do not need the upload?

No, I was thinking at first it was a rounding error depending on the precise sizes in the calculations, but it wasn't even trying to get this right!
Comment 7 Alasdair Kergon 2017-08-09 10:43:02 EDT
Also problems with pvcreate -ff remembering bootareas instead of paying attention only to the new command line and restorefile contents.
Comment 8 Alasdair Kergon 2017-08-11 19:25:02 EDT
Pushed some patches upstream so it clears existing boot areas and uses the maximum size for the metadata area that fits.  There are still more bugs to fix (eg. if the number of mda copies is changed from 1 to 2).
Comment 9 Alasdair Kergon 2017-08-15 11:14:58 EDT
I think the upstream patches are sufficient to trap these cases earlier now.

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