From ecb74a38bc511924c7cb17d64b500fade7f1ed23 Mon Sep 17 00:00:00 2001 From: Richard W.M. Jones Date: Fri, 22 Jun 2012 10:06:47 +0100 Subject: [PATCH 15/19] 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 files changed, 20 insertions(+), 0 deletions(-) diff --git a/daemon/blkid.c b/daemon/blkid.c index 7cc7889..32168a3 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) -- 1.7.4.1