summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2019-09-04 14:13:14 -0500
committerDavid Teigland <teigland@redhat.com>2019-09-30 11:38:10 -0500
commit3a8e41a67b3f0edb0fcb27302351f7d58b6ef8c5 (patch)
treee598cc12c921d300dc75fadee293c0ca6256c6cb
parentfcfabb26a535f9b967e96ad44300377598622c0d (diff)
downloadlvm2-3a8e41a67b3f0edb0fcb27302351f7d58b6ef8c5.tar.gz
metadata: import device name hint from metadata
Start by using it in a comment for a missing PV.
-rw-r--r--lib/format_text/import_vsn1.c6
-rw-r--r--lib/metadata/metadata.c5
-rw-r--r--lib/metadata/pv.h1
3 files changed, 11 insertions, 1 deletions
diff --git a/lib/format_text/import_vsn1.c b/lib/format_text/import_vsn1.c
index f29abce72..2785ab343 100644
--- a/lib/format_text/import_vsn1.c
+++ b/lib/format_text/import_vsn1.c
@@ -184,6 +184,7 @@ static int _read_pv(struct cmd_context *cmd,
struct physical_volume *pv;
struct pv_list *pvl;
const struct dm_config_value *cv;
+ const char *device_hint;
uint64_t size, ba_start;
if (!(pvl = dm_pool_zalloc(mem, sizeof(*pvl))) ||
@@ -228,6 +229,11 @@ static int _read_pv(struct cmd_context *cmd,
return 0;
}
+ if (dm_config_get_str(pvn, "device", &device_hint)) {
+ if (!(pv->device_hint = dm_pool_strdup(mem, device_hint)))
+ log_error("Failed to allocate memory for device hint in read_pv.");
+ }
+
if (!_read_uint64(pvn, "pe_start", &pv->pe_start)) {
log_error("Couldn't read extent start value (pe_start) "
"for physical volume.");
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index b43496793..cf5c563ec 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -4971,7 +4971,10 @@ struct volume_group *vg_read(struct cmd_context *cmd, const char *vg_name, const
if (!pvl->pv->dev) {
/* The obvious and common case of a missing device. */
- log_warn("WARNING: VG %s is missing PV %s.", vg_name, uuidstr);
+ if (pvl->pv->device_hint)
+ log_warn("WARNING: VG %s is missing PV %s (last written to %s).", vg_name, uuidstr, pvl->pv->device_hint);
+ else
+ log_warn("WARNING: VG %s is missing PV %s.", vg_name, uuidstr);
missing_pv_dev++;
} else if (pvl->pv->status & MISSING_PV) {
diff --git a/lib/metadata/pv.h b/lib/metadata/pv.h
index 3430c2e1f..efa13e04b 100644
--- a/lib/metadata/pv.h
+++ b/lib/metadata/pv.h
@@ -26,6 +26,7 @@ struct physical_volume {
struct id id;
struct id old_id; /* Set during pvchange -u. */
struct device *dev;
+ const char *device_hint; /* primary name last time metadata was written */
const struct format_type *fmt;
struct format_instance *fid;