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

Prevent pvcreate from overwriting MDA-less PVs belonging to active VGs.

This commit is contained in:
Petr Rockai 2008-01-09 00:18:36 +00:00
parent 51fa42daf5
commit 7415ef77a1
2 changed files with 13 additions and 0 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.30 -
===================================
Prevent pvcreate from overwriting MDA-less PVs belonging to active VGs.
Fix a segfault if using pvs with --all argument. (2.02.29)
Update --uuid argument description in man pages.
Fix vgreduce PV list processing not to process every PV in the VG. (2.02.29)

View File

@ -14,6 +14,7 @@
*/
#include "tools.h"
#include "metadata.h"
struct pvcreate_params {
int zero;
@ -43,6 +44,17 @@ static int pvcreate_check(struct cmd_context *cmd, const char *name)
/* FIXME Use partial mode here? */
pv = pv_read(cmd, name, NULL, NULL, 0);
/*
* If a PV has no MDAs it may appear to be an orphan until the
* metadata is read off another PV in the same VG. Detecting
* this means checking every VG by scanning every PV on the
* system.
*/
if (pv && is_orphan(pv)) {
(void) get_vgs(cmd, 1);
pv = pv_read(cmd, name, NULL, NULL, 0);
}
/* Allow partial & exported VGs to be destroyed. */
/* We must have -ff to overwrite a non orphan */
if (pv && !is_orphan(pv) && arg_count(cmd, force_ARG) != 2) {