grub2/grub2-getroot-scan-disk-pv.patch

44 lines
1.2 KiB
Diff
Raw Permalink Normal View History

From: Michael Chang <mchang@suse.com>
Subject: Fix grub2-mkconfig warning when disk is LVM PV
References: bsc#1071239
When a disk device was found in grub_util_biosdisk_get_grub_dev, its grub
hostdisk device name just returned. Since the disk could also be used as PV
disk, use grub_util_get_ldm to kick scanning of on disk metadata and adding it
to VG array.
---
Index: grub-2.02/util/getroot.c
===================================================================
--- grub-2.02.orig/util/getroot.c
+++ grub-2.02/util/getroot.c
@@ -272,8 +272,28 @@ grub_util_biosdisk_get_grub_dev (const c
grub_util_info ("%s is a parent of %s", sys_disk, os_dev);
if (!is_part)
{
+#if defined(__APPLE__)
free (sys_disk);
return make_device_name (drive);
+#else
+ char *name, *ldm_name;
+ grub_disk_t disk;
+
+ free (sys_disk);
+ name = make_device_name (drive);
+ disk = grub_disk_open (name);
+ if (!disk)
+ return name;
+ ldm_name = grub_util_get_ldm (disk, 0);
+ if (ldm_name)
+ {
+ grub_disk_close (disk);
+ grub_free (name);
+ return ldm_name;
+ }
+ grub_disk_close (disk);
+ return name;
+#endif
}
free (sys_disk);