Skip to contentSkip to conversation

add error message if vgcfg fails because og missing PVs

PATCH New Milan Broz 2 participants 2 messages May 15, 2009 – May 19, 2009

lore
Share & tools
lore

Milan Broz

author
#0 lore raw

PATCH 1/1 add error message if vgcfg fails because og missing PVs

vgcfgrestore should not quietly fail when backup file has missing PVs.

(my previous comment in code is wrong, there are situation when vg_read prints nothing)

---
 lib/format_text/archiver.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
lib/format_text/archiver.c +6 -5
index 5362adb..d80c0ba 100644
@@ -335,7 +335,7 @@ int backup_restore_from_file(struct cmd_context *cmd, const char *vg_name,
 			     const char *file)
 {
 	struct volume_group *vg;
-	int r = 0;
+	int missing_pvs, r = 0;
 
 	/*
 	 * Read in the volume group from the text file.
@@ -343,11 +343,12 @@ int backup_restore_from_file(struct cmd_context *cmd, const char *vg_name,
 	if (!(vg = backup_read_vg(cmd, vg_name, file)))
 		return_0;
 
-	/*
-	 * If PV is missing, there is already message from read above
-	 */
-	if (!vg_missing_pv_count(vg))
+	missing_pvs = vg_missing_pv_count(vg);
+	if (missing_pvs == 0)
 		r = backup_restore_vg(cmd, vg);
+	else
+		log_error("Cannot restore Volume Group %s with %i PVs "
+			  "marked as missing.", vg->name, missing_pvs);
 
 	vg_release(vg);
 	return r;
#1 lore raw

PATCH 1/1 add error message if vgcfg fails because og missing PVs

Quoted 1 line · Milan Broz
Quoted 30 lines
lib/format_text/archiver.c +6 -5
index 5362adb..d80c0ba 100644
@@ -335,7 +335,7 @@ int backup_restore_from_file(struct cmd_context *cmd, const char *vg_name,
 			     const char *file)
 {
 	struct volume_group *vg;
-	int r = 0;
+	int missing_pvs, r = 0;
 
 	/*
 	 * Read in the volume group from the text file.
@@ -343,11 +343,12 @@ int backup_restore_from_file(struct cmd_context *cmd, const char *vg_name,
 	if (!(vg = backup_read_vg(cmd, vg_name, file)))
 		return_0;
 
-	/*
-	 * If PV is missing, there is already message from read above
-	 */
-	if (!vg_missing_pv_count(vg))
+	missing_pvs = vg_missing_pv_count(vg);
+	if (missing_pvs == 0)
 		r = backup_restore_vg(cmd, vg);
+	else
+		log_error("Cannot restore Volume Group %s with %i PVs "
+			  "marked as missing.", vg->name, missing_pvs);
 
 	vg_release(vg);
 	return r;
Signature · 6 lines
Peter Rockai | me()mornfall!net | prockai()redhat!com
 http://blog.mornfall.net | http://web.mornfall.net

"In My Egotistical Opinion, most people's C programs should be
 indented six feet downward and covered with dirt."
     -- Blair P. Houghton on the subject of C program indentation