grub2/grub2-getroot-scan-disk-pv.patch
Michael Chang c7ddc4afcf Accepting request 569425 from home:michael-chang:branches:Base:System
- Check if default entry need to be corrected for updated distributor version
  and/or use fallback entry if default kernel entry removed (bsc#1065349)
  * grub2-check-default.sh
  * grub2-mkconfig-default-entry-correction.patch
- Fix grub2-mkconfig warning when disk is LVM PV (bsc#1071239)
  * grub2-getroot-scan-disk-pv.patch

OBS-URL: https://build.opensuse.org/request/show/569425
OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=287
2018-02-01 04:09:06 +00:00

44 lines
1.2 KiB
Diff

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);