lvm metadata handling, warn only once about missing PV
PATCH 1/1 lvm metadata handling, warn only once about missing PV
Hi,
When a disk is missing the messages of the lvm tools are quite verbose. Example output for a VG with a mirror LV:
Without patch:
# vgchange -ay -P Partial mode. Incomplete volume groups will be activated read-only. Couldn't find device with uuid 'egDxmo-sVp7-OQGB-6mgt-84mk-xioM-ahdzBw'. Couldn't find device with uuid 'egDxmo-sVp7-OQGB-6mgt-84mk-xioM-ahdzBw'. Couldn't find device with uuid 'egDxmo-sVp7-OQGB-6mgt-84mk-xioM-ahdzBw'. Couldn't find device with uuid 'egDxmo-sVp7-OQGB-6mgt-84mk-xioM-ahdzBw'. Couldn't find device with uuid 'egDxmo-sVp7-OQGB-6mgt-84mk-xioM-ahdzBw'. Couldn't find device with uuid 'egDxmo-sVp7-OQGB-6mgt-84mk-xioM-ahdzBw'. Couldn't find device with uuid 'egDxmo-sVp7-OQGB-6mgt-84mk-xioM-ahdzBw'. Couldn't find device with uuid 'egDxmo-sVp7-OQGB-6mgt-84mk-xioM-ahdzBw'. Couldn't find device with uuid 'egDxmo-sVp7-OQGB-6mgt-84mk-xioM-ahdzBw'. Couldn't find device with uuid 'egDxmo-sVp7-OQGB-6mgt-84mk-xioM-ahdzBw'. Couldn't find device with uuid 'egDxmo-sVp7-OQGB-6mgt-84mk-xioM-ahdzBw'. Couldn't find device with uuid 'egDxmo-sVp7-OQGB-6mgt-84mk-xioM-ahdzBw'. Couldn't find device with uuid 'egDxmo-sVp7-OQGB-6mgt-84mk-xioM-ahdzBw'. Couldn't find device with uuid 'egDxmo-sVp7-OQGB-6mgt-84mk-xioM-ahdzBw'. Couldn't find device with uuid 'egDxmo-sVp7-OQGB-6mgt-84mk-xioM-ahdzBw'. Couldn't find device with uuid 'egDxmo-sVp7-OQGB-6mgt-84mk-xioM-ahdzBw'. 2 logical volume(s) in volume group "main" now active
With patch:
# vgchange -ay -P Partial mode. Incomplete volume groups will be activated read-only. Missing PV with uuid 'egDxmo-sVp7-OQGB-6mgt-84mk-xioM-ahdzBw' in VG main 2 logical volume(s) in volume group "main" now active
Regards,
Jens
Signature · 63 lines
Jens Wilke Linux on zSeries - Application Development Tools + GCC phone +49-(0)7031-16-3936 - tl *120-3936 - email [email protected] IBM Germany Lab, Schoenaicher Str. 220, 71032 Boeblingen Signed-Off-By: Jens Wilke <[email protected]> Index: lib/format_text/import_vsn1.c =================================================================== --- lib/format_text/import_vsn1.c 9 May 2006 12:29:44 -0000 1.2 +++ lib/format_text/import_vsn1.c 8 Jun 2006 14:25:44 -0000 @@ -151,9 +151,9 @@ char buffer[64]; if (!id_write_format(&pv->id, buffer, sizeof(buffer))) - log_error("Couldn't find device."); + log_verbose("Couldn't find device."); else - log_error("Couldn't find device with uuid '%s'.", + log_verbose("Couldn't find device with uuid '%s'.", buffer); if (partial_mode()) Index: lib/metadata/metadata.c =================================================================== --- lib/metadata/metadata.c 9 May 2006 12:29:45 -0000 1.2 +++ lib/metadata/metadata.c 8 Jun 2006 14:25:44 -0000 @@ -1096,6 +1096,25 @@ return correct_vg; } +static void warn_pv_missing(struct volume_group *vg) +{ + struct physical_volume *pv; + struct pv_list *pvl; + char buffer[64]; + + list_iterate_items(pvl, &vg->pvs) { + pv = pvl->pv; + if (!pv->dev) { + if (!id_write_format(&pv->id, buffer, sizeof(buffer))) { + log_error("Volume group %s has missing PVs", vg->name); + } else { + log_error("Missing PV with uuid '%s' in VG %s", + buffer, vg->name); + } + } + } +} + struct volume_group *vg_read(struct cmd_context *cmd, const char *vgname, const char *vgid, int *consistent) { @@ -1118,6 +1137,8 @@ return NULL; } } + + warn_pv_missing(vg); return vg; }
Quoted 6 lines · Jens Wilke
With patch:
# vgchange -ay -P Partial mode. Incomplete volume groups will be activated read-only. Missing PV with uuid 'egDxmo-sVp7-OQGB-6mgt-84mk-xioM-ahdzBw' in VG main 2 logical volume(s) in volume group "main" now active
the metadata backup also shows the device name as a hint. Is this saved by the on-disk MD, too? Might be helpful to see.
Dieter.
Quoted 10 lines · Dieter St�ken
Quoted 6 lines · Jens Wilke
With patch:
# vgchange -ay -P Partial mode. Incomplete volume groups will be activated read-only. Missing PV with uuid 'egDxmo-sVp7-OQGB-6mgt-84mk-xioM-ahdzBw' in VG main 2 logical volume(s) in volume group "main" now activethe metadata backup also shows the device name as a hint. Is this saved by the on-disk MD, too? Might be helpful to see.
Dieter,
Yes, the on-disk and backup metadata is identical so we have the device hint. But I don't think that it is really a good idea to show it, because this would make up a bit pitfall and confusing in stress situations.
But it would be usefull to add a list of lvs that are partially available or degraded in case of mirrors, so you have a quick info what is the actual state of your system.
Best,
Jens
Signature · 4 lines
Jens Wilke Linux on zSeries - Application Development Tools + GCC phone +49-(0)7031-16-3936 - tl *120-3936 - email [email protected] IBM Germany Lab, Schoenaicher Str. 220, 71032 Boeblingen