diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2012-06-22 10:06:47 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2012-06-27 16:36:16 +0100 |
commit | 8d55f7a7b19e631a50ac34e01c4905f001ee5d78 (patch) | |
tree | a5c4a40f20e005e80d7e674964f81f7f768b53d9 | |
parent | bc2657ab1c52ae52464769457352719ad2adb1eb (diff) | |
download | libguestfs-8d55f7a7b19e631a50ac34e01c4905f001ee5d78.tar.gz libguestfs-8d55f7a7b19e631a50ac34e01c4905f001ee5d78.tar.xz libguestfs-8d55f7a7b19e631a50ac34e01c4905f001ee5d78.zip |
EPEL 5: Fix blkid to return "LVM2_member" for PVs.
Old blkid in RHEL 5 didn't return the right thing for PVs.
-rw-r--r-- | daemon/blkid.c | 20 |
1 files changed, 20 insertions, 0 deletions
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) |