From 45eb8e29c1b9f9bb92ce17cbc1d2fbc1c40c7f6b Mon Sep 17 00:00:00 2001
From: Richard W.M. Jones <rjones@redhat.com>
Date: Fri, 22 Jun 2012 10:06:47 +0100
Subject: [PATCH 20/37] EPEL 5: Fix blkid to return "LVM2_member" for PVs.
Old blkid in RHEL 5 didn't return the right thing for PVs.
---
daemon/blkid.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/daemon/blkid.c b/daemon/blkid.c
index 64919dd..cbd9b1f 100644
--- a/daemon/blkid.c
+++ b/daemon/blkid.c
@@ -51,6 +51,24 @@ get_blkid_tag (const char *device, const char *tag)
}
if (r == 2) { /* means UUID etc not found */
+ if (STREQ (tag, "TYPE") && STREQ (out, "")) {
+ /* RHEL 5 blkid doesn't return "LVM2_member" for PVs. Instead we
+ * get to this point. Detect if the device is really a PV and return
+ * the right thing instead.
+ */
+ free (out);
+ if (command (&out, &err, "file", "-bsL", device, NULL) == -1) {
+ reply_with_error ("file: %s", err);
+ free (out);
+ return NULL;
+ }
+ if (STRPREFIX (out, "LVM2 (Linux Logical Volume Manager)")) {
+ strcpy (out, "LVM2_member");
+ return out;
+ }
+ /*FALLTHROUGH*/
+ }
+
free (out);
out = strdup ("");
if (out == NULL)
--
1.7.4.1