summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2016-02-15 15:11:54 +0100
committerPeter Rajnoha <prajnoha@redhat.com>2016-02-15 15:17:36 +0100
commitcc9e683adcb6c56332d708baf02dec63eba4fba9 (patch)
tree1381415e7409b53d098cfbdde64478fa87b1c29b
parent0000db7f98a07aa31c5b1cf13938b612e7f2821b (diff)
downloadlvm2-cc9e683adcb6c56332d708baf02dec63eba4fba9.tar.gz
toollib: skip PV if system ID is used and PV marked as used but metadata missing
If we know that a PV belongs to some VG and we're missing metadata (because we have only those PV(s) from VG present in the system that don't have metadata areas), we should skip such PV when processing under system ID. This is because we know that the PV belongs to some VG, but we really can't decide whether it matches system ID unless the VG metadata is present again.
-rw-r--r--WHATS_NEW1
-rw-r--r--tools/toollib.c6
2 files changed, 7 insertions, 0 deletions
diff --git a/WHATS_NEW b/WHATS_NEW
index 47eb7351b..48f2fb377 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.143 -
=====================================
+ If PV belongs to some VG and metadata missing, skip it if system ID is used.
Automatically change PV header extension to latest version if writing PV/VG.
Identify used PVs in pv_attr field by new 'u' character.
Add pv_in_use reporting field to report if PV is used or not.
diff --git a/tools/toollib.c b/tools/toollib.c
index 7f8c2eb68..1bdc1133a 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -3067,6 +3067,12 @@ static int _process_pvs_in_vg(struct cmd_context *cmd,
pv = pvl->pv;
pv_name = pv_dev_name(pv);
+ if (cmd->system_id && is_orphan(pv) && is_used_pv(pv)) {
+ log_verbose("PV %s is belonging to a VG but its metadata is missing.", pv_name);
+ log_verbose("Skipping PV %s because it's not possible to decide whether it matches system id.", pv_name);
+ continue;
+ }
+
process_pv = process_all_pvs;
/* Remove each arg_devices entry as it is processed. */