Skip to contentSkip to conversation

main - metadata: enhance internal error

PATCH Zdenek Kabelac 1 participant 1 message Oct 6, 2021

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=98c57f7ce44788f22499f10f8d6c3f320869aa16
Commit:        98c57f7ce44788f22499f10f8d6c3f320869aa16
Parent:        b7e9ec0cbf55e4a4e1f027be49bf45b11beb5a76
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Fri Oct 1 13:45:34 2021 +0200
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Wed Oct 6 15:39:58 2021 +0200

metadata: enhance internal error

Consider missing config tree from vg read to be an internal error since we do not want to 'regenerate' this one in expesive parsing way.

Also if there is any failure on recreating committed VG, make it also a 'vg_write' error.

---
 lib/metadata/metadata.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
lib/metadata/metadata.c +6 -6
index f29e73c7c..146ce476d 100644
@@ -5225,14 +5225,14 @@ struct volume_group *vg_read(struct cmd_context *cmd, const char *vg_name, const
 		}
 
 		if (!vg->committed_cft) {
-			log_warn("WARNING: vg_read no vg copy: copy export failed.");
-			if (!(vg->committed_cft = export_vg_to_config_tree(vg)))
-				goto out;
+			log_error(INTERNAL_ERROR "Missing committed config tree.");
+			goto out;
 		}
 
-		if (!(vg->vg_committed = import_vg_from_config_tree(cmd, vg->fid, vg->committed_cft)))
-			log_warn("WARNING: vg_read no vg copy: copy import failed.");
-
+		if (!(vg->vg_committed = import_vg_from_config_tree(cmd, vg->fid, vg->committed_cft))) {
+			log_error("Failed to import written VG.");
+			goto out;
+		}
 	} else {
 		if (vg->vg_precommitted)
 			log_error(INTERNAL_ERROR "vg_read vg %p vg_precommitted %p", (void *)vg, (void *)vg->vg_precommitted);