mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
vgimport: Allow '--force' to import VGs with missing PVs.
When there are missing PVs in a volume group, most operations that alter the LVM metadata are disallowed. It turns out that 'vgimport' is one of those disallowed operations. This is bad because it creates a circular dependency. 'vgimport' will complain that the VG is inconsistent and that 'vgreduce --removemissing' must be run. However, 'vgreduce' cannot be run because it has not been imported. Therefore, 'vgimport' must be one of the operations allowed to change the metadata when PVs are missing. The '--force' option is the way to make 'vgimport' happen in spite of the missing PVs.
This commit is contained in:
parent
303e86adc8
commit
3ab46449f4
@ -1,5 +1,6 @@
|
|||||||
Version 2.02.99 -
|
Version 2.02.99 -
|
||||||
===================================
|
===================================
|
||||||
|
vgimport '--force' now allows users to import VGs with missing PVs.
|
||||||
Fix PV alignment to incorporate alignment offset if the PV has zero MDAs.
|
Fix PV alignment to incorporate alignment offset if the PV has zero MDAs.
|
||||||
Allow remove/replace of RAID sub-LVs that are composed of error targets.
|
Allow remove/replace of RAID sub-LVs that are composed of error targets.
|
||||||
Make 'vgreduce --removemissing' able to handle RAID LVs with missing PVs.
|
Make 'vgreduce --removemissing' able to handle RAID LVs with missing PVs.
|
||||||
|
@ -20,6 +20,11 @@ See \fBlvm\fP(8) for common options.
|
|||||||
.TP
|
.TP
|
||||||
.BR \-a ", " \-\-all
|
.BR \-a ", " \-\-all
|
||||||
Import all exported Volume Groups.
|
Import all exported Volume Groups.
|
||||||
|
.TP
|
||||||
|
.BR \-\-force
|
||||||
|
Import exported Volume Groups even if there are missing Physical Volumes.
|
||||||
|
This option should only be used if the missing devices are known to have
|
||||||
|
failed and they cannot be restored.
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR lvm (8),
|
.BR lvm (8),
|
||||||
.BR pvscan (8),
|
.BR pvscan (8),
|
||||||
|
@ -68,6 +68,23 @@ int vgimport(struct cmd_context *cmd, int argc, char **argv)
|
|||||||
return ECMD_FAILED;
|
return ECMD_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (arg_count(cmd, force_ARG)) {
|
||||||
|
/*
|
||||||
|
* The volume group cannot be repaired unless it is first
|
||||||
|
* imported. If we don't allow the user a way to import the
|
||||||
|
* VG while it is 'partial', then we will have created a
|
||||||
|
* circular dependency.
|
||||||
|
*
|
||||||
|
* The reason we don't just simply set 'handles_missing_pvs'
|
||||||
|
* by default is that we want to guard against the case
|
||||||
|
* where the user simply forgot to move one or more disks in
|
||||||
|
* the VG before running 'vgimport'.
|
||||||
|
*/
|
||||||
|
log_print("'--force' supplied. Volume groups with missing PVs"
|
||||||
|
" will be imported.");
|
||||||
|
cmd->handles_missing_pvs = 1;
|
||||||
|
}
|
||||||
|
|
||||||
return process_each_vg(cmd, argc, argv,
|
return process_each_vg(cmd, argc, argv,
|
||||||
READ_FOR_UPDATE | READ_ALLOW_EXPORTED,
|
READ_FOR_UPDATE | READ_ALLOW_EXPORTED,
|
||||||
NULL,
|
NULL,
|
||||||
|
Loading…
Reference in New Issue
Block a user