mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-22 17:35:59 +03:00
metadata: import device name hint from metadata
Start by using it in a comment for a missing PV.
This commit is contained in:
parent
fcfabb26a5
commit
3a8e41a67b
@ -184,6 +184,7 @@ static int _read_pv(struct cmd_context *cmd,
|
|||||||
struct physical_volume *pv;
|
struct physical_volume *pv;
|
||||||
struct pv_list *pvl;
|
struct pv_list *pvl;
|
||||||
const struct dm_config_value *cv;
|
const struct dm_config_value *cv;
|
||||||
|
const char *device_hint;
|
||||||
uint64_t size, ba_start;
|
uint64_t size, ba_start;
|
||||||
|
|
||||||
if (!(pvl = dm_pool_zalloc(mem, sizeof(*pvl))) ||
|
if (!(pvl = dm_pool_zalloc(mem, sizeof(*pvl))) ||
|
||||||
@ -228,6 +229,11 @@ static int _read_pv(struct cmd_context *cmd,
|
|||||||
return 0;
|
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)) {
|
if (!_read_uint64(pvn, "pe_start", &pv->pe_start)) {
|
||||||
log_error("Couldn't read extent start value (pe_start) "
|
log_error("Couldn't read extent start value (pe_start) "
|
||||||
"for physical volume.");
|
"for physical volume.");
|
||||||
|
@ -4971,6 +4971,9 @@ struct volume_group *vg_read(struct cmd_context *cmd, const char *vg_name, const
|
|||||||
if (!pvl->pv->dev) {
|
if (!pvl->pv->dev) {
|
||||||
/* The obvious and common case of a missing device. */
|
/* The obvious and common case of a missing device. */
|
||||||
|
|
||||||
|
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);
|
log_warn("WARNING: VG %s is missing PV %s.", vg_name, uuidstr);
|
||||||
missing_pv_dev++;
|
missing_pv_dev++;
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ struct physical_volume {
|
|||||||
struct id id;
|
struct id id;
|
||||||
struct id old_id; /* Set during pvchange -u. */
|
struct id old_id; /* Set during pvchange -u. */
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
|
const char *device_hint; /* primary name last time metadata was written */
|
||||||
const struct format_type *fmt;
|
const struct format_type *fmt;
|
||||||
struct format_instance *fid;
|
struct format_instance *fid;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user