FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Fedora Directory

 
 
LinkBack Thread Tools
 
Old 04-02-2012, 06:00 PM
"Brian C. Lane"
 
Default restore the GPT blacklist code

From: "Brian C. Lane" <bcl@redhat.com>

It ends up that setting the pmbr on GPT labeled disks only fixes
some of the systems that have trouble booting from GPT. We still need
to blacklist Lenovo systems from using GPT on BIOS systems.

This also changes from using dmidecode to using /sys/class/dmi/ files.
---
pyanaconda/constants.py | 3 +++
pyanaconda/platform.py | 14 ++++++++++++++
2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/pyanaconda/constants.py b/pyanaconda/constants.py
index 9163d4d..f8d4628 100644
--- a/pyanaconda/constants.py
+++ b/pyanaconda/constants.py
@@ -92,3 +92,6 @@ ROOT_PATH = "/mnt/sysimage"
DEFAULT_LANG = "en_US.UTF-8"

DRACUT_SHUTDOWN_EJECT = "/run/initramfs/usr/lib/dracut/hooks/shutdown/99anaconda-eject.sh"
+
+# DMI information paths
+DMI_CHASSIS_VENDOR = "/sys/class/dmi/id/chassis_vendor"
diff --git a/pyanaconda/platform.py b/pyanaconda/platform.py
index cfadbb3..43c0574 100644
--- a/pyanaconda/platform.py
+++ b/pyanaconda/platform.py
@@ -26,6 +26,7 @@ import parted

from pyanaconda import bootloader
from pyanaconda.storage.devicelibs import mdraid
+from pyanaconda.constants import DMI_CHASSIS_VENDOR

import iutil
from flags import flags
@@ -163,6 +164,7 @@ class X86(Platform):

def __init__(self, anaconda):
super(X86, self).__init__(anaconda)
+ self.blackListGPT()

def setDefaultPartitioning(self):
"""Return the default platform-specific partitioning information."""
@@ -181,6 +183,18 @@ class X86(Platform):
else:
return 0

+ def blackListGPT(self):
+ """ Remove GPT disk label as an option on systems where their BIOS
+ doesn't boot from GPT labeled disks.
+
+ Currently this includes: Lenovo
+ """
+ if not os.path.isfile(DMI_CHASSIS_VENDOR):
+ return
+ buf = open(DMI_CHASSIS_VENDOR).read()
+ if "LENOVO" in buf.splitlines() and "gpt" in self._disklabel_types:
+ self._disklabel_types.remove("gpt")
+
class EFI(Platform):
_bootloaderClass = bootloader.EFIGRUB

--
1.7.7.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 04-03-2012, 11:33 PM
Will Woods
 
Default restore the GPT blacklist code

This looks good, but I have a possibly-minor concern about the matching,
below:

On Mon, 2012-04-02 at 11:00 -0700, Brian C. Lane wrote:

> + def blackListGPT(self):
> + """ Remove GPT disk label as an option on systems where their BIOS
> + doesn't boot from GPT labeled disks.
> +
> + Currently this includes: Lenovo
> + """
> + if not os.path.isfile(DMI_CHASSIS_VENDOR):
> + return
> + buf = open(DMI_CHASSIS_VENDOR).read()
> + if "LENOVO" in buf.splitlines() and "gpt" in self._disklabel_types:

The splitlines() is confusing here.. is LENOVO supposed to be a
substring match, or an exact match? Also: are you sure it's always
uppercase?

Maybe this should be a bit looser, and the match a bit clearer?

if "gpt" in self._disklabel_types:
vendor = open(DMI_CHASSIS_VENDOR).read().strip().lower()
if "lenovo" in vendor:

I'm sure it works as-is but I'd rather not have to revise the patch once
we find out that *some* Lenovo systems have "Lenovo" and some "LENOVO"
and some "Lenovo, Inc.", etc, etc.. Unless there's some standard/spec
that says that'll never happen?

-w



_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 01:27 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org