1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00

metadata: add "Failed to write VG <vg_name>." on failed vg_write and revert previous patch

Better than previous patch which changed log_warn to log_error -
we can have multiple MDAs and if one of them fails to be written,
we can still continue with other MDAs if we're in a mode where
we can handle missing PVs - so keep the log_warn for single
failed MDA write as it was before.

However, add log_error with "Failed to write VG <vg_name>." in
case we're not handling missing PVs or no MDA was written at all
during VG write process. This also prevents an internal error in
which the vg_write fails and we're not issuing any other log_error
in vg_write caller or above, so we end up with:
  "Internal error: Failed command did not use log_error".
This commit is contained in:
Peter Rajnoha 2015-01-09 14:04:44 +01:00
parent db7351d313
commit fb7e2ff493

View File

@ -2795,7 +2795,7 @@ int vg_write(struct volume_group *vg)
}
if (!mda->ops->vg_write(vg->fid, vg, mda)) {
if (vg->cmd->handles_missing_pvs) {
log_error("Failed to write an MDA of VG %s.", vg->name);
log_warn("WARNING: Failed to write an MDA of VG %s.", vg->name);
mda->status |= MDA_FAILED;
} else {
stack;
@ -2807,6 +2807,7 @@ int vg_write(struct volume_group *vg)
}
if (revert || !wrote) {
log_error("Failed to write VG %s.", vg->name);
dm_list_uniterate(mdah, &vg->fid->metadata_areas_in_use, &mda->list) {
mda = dm_list_item(mdah, struct metadata_area);