[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[linux-lvm] [PATCH] 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

-- 
  Jens Wilke
  Linux on zSeries - Application Development Tools + GCC
  phone +49-(0)7031-16-3936 - tl *120-3936 - email jens wilke de ibm com
  IBM Germany Lab, Schoenaicher Str. 220, 71032 Boeblingen


Signed-Off-By: Jens Wilke <jens wilke de ibm com>

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;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]