1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

pvcreate: Use maximum metadata area size with --restorefile

If the PV was originally created with a larger-than-default
metadata area the restored one wasn't and might not even be
large enough to hold the metadata!
This commit is contained in:
Alasdair G Kergon 2017-08-11 20:41:37 +01:00
parent 4fa5add6b1
commit 42fa20d0d0
2 changed files with 10 additions and 0 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.174 -
=================================
Use maximum metadataarea size that fits with pvcreate --restorefile.
Always clear cached bootloaderarea when wiping label e.g. in pvcreate.
Disallow --bootloaderareasize with pvcreate --restorefile.
Fix lvmlockd check for running lock managers during lock adoption.

View File

@ -135,6 +135,15 @@ int pvcreate(struct cmd_context *cmd, int argc, char **argv)
if (!pvcreate_params_from_args(cmd, &pp))
return EINVALID_CMD_LINE;
/*
* If --metadatasize was not given with --restorefile, set it to pe_start.
* Later code treats this as a maximum size and reduces it to fit.
*/
if (!arg_is_set(cmd, metadatasize_ARG) && arg_is_set(cmd, restorefile_ARG))
pp.pva.pvmetadatasize = pp.pva.pe_start;
/* FIXME Also needs to check any 2nd metadata area isn't inside the data area! */
pp.pv_count = argc;
pp.pv_names = argv;