summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2016-02-16 13:44:48 +0100
committerPeter Rajnoha <prajnoha@redhat.com>2016-02-16 13:44:48 +0100
commit13f3e926326ae528d1a62d9786f462e7d7c73037 (patch)
tree11345b41117197ae48a479504ba1ce67ad1cc818
parent45be3c875f4605f4f950e8abfa12cf422526f5db (diff)
downloadlvm2-13f3e926326ae528d1a62d9786f462e7d7c73037.tar.gz
refactor: add common _is_foreign_vg fn
-rw-r--r--lib/metadata/metadata.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index eb50c0a1f..4dbe38b63 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -3627,6 +3627,11 @@ static int _check_reappeared_pv(struct volume_group *correct_vg,
return rv;
}
+static int _is_foreign_vg(struct volume_group *vg)
+{
+ return vg->cmd->system_id && strcmp(vg->system_id, vg->cmd->system_id);
+}
+
static int _check_or_repair_pv_ext(struct cmd_context *cmd,
struct physical_volume *pv,
int repair, int *inconsistent_pvs)
@@ -3678,7 +3683,7 @@ static int _repair_inconsistent_vg(struct volume_group *vg)
unsigned saved_handles_missing_pvs = vg->cmd->handles_missing_pvs;
/* Cannot write foreign VGs, the owner will repair it. */
- if (vg->cmd->system_id && strcmp(vg->system_id, vg->cmd->system_id)) {
+ if (_is_foreign_vg(vg)) {
log_verbose("Skip metadata repair for foreign VG.");
return 0;
}
@@ -3718,7 +3723,7 @@ static int _wipe_outdated_pvs(struct cmd_context *cmd, struct volume_group *vg,
* some PVs look outdated to us just because we're reading
* the VG while it's only partially written out.
*/
- if (cmd->system_id && strcmp(vg->system_id, cmd->system_id)) {
+ if (_is_foreign_vg(vg)) {
log_debug_metadata("Skip wiping outdated PVs for foreign VG.");
return 0;
}