From cc9e683adcb6c56332d708baf02dec63eba4fba9 Mon Sep 17 00:00:00 2001 From: Peter Rajnoha Date: Mon, 15 Feb 2016 15:11:54 +0100 Subject: [PATCH] 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. --- WHATS_NEW | 1 + tools/toollib.c | 6 ++++++ 2 files changed, 7 insertions(+) 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. */