From 8d55f7a7b19e631a50ac34e01c4905f001ee5d78 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 22 Jun 2012 10:06:47 +0100 Subject: 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 | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/daemon/blkid.c b/daemon/blkid.c index 7cc7889d..32168a36 100644 --- a/daemon/blkid.c +++ b/daemon/blkid.c @@ -51,6 +51,26 @@ get_blkid_tag (const char *device, const char *tag) free (err); 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); + free (err); + return NULL; + } + free (err); + if (STRPREFIX (out, "LVM2 (Linux Logical Volume Manager)")) { + strcpy (out, "LVM2_member"); + return out; + } + /*FALLTHROUGH*/ + } + free (out); out = strdup (""); if (out == NULL) -- cgit