summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2015-01-09 14:04:44 +0100
committerPeter Rajnoha <prajnoha@redhat.com>2015-01-09 14:04:44 +0100
commitfb7e2ff49368e547d597baf263e8cb7cca8b63fb (patch)
treeecb2d496b40fe8dce020e6a90ea420ec09028f50
parentdb7351d3133e237db01361fed8efd6b0fac85c32 (diff)
downloadlvm2-fb7e2ff49368e547d597baf263e8cb7cca8b63fb.tar.gz
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".
-rw-r--r--lib/metadata/metadata.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 39bd3258c..465eb84d5 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -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);