[PATCH anaconda:rhel7/master] Change the string used to test for serial console (#1054951)
David Marlin
dmarlin at redhat.com
Tue Jan 28 17:42:26 UTC 2014
Vratislav Podzimek wrote:
> On Mon, 2014-01-27 at 16:33 -0600, d.marlin wrote:
>> The string used to test for serial console is a literal ("ttyS"). To support
>> serial consoles other than those starting with "ttyS", such as ttyAMA0 for ARM,
>> create a list of string values that may be used. Add a property to test if
>> the console device starts with any of these strings.
>>
>> Note: 64-bit ARM (aarch64) hardware may use either ttyS0 or ttyAMA0 for the
>> serial console. The Foundation Model simulator currently uses ttyAMA0.
>>
>> Resolves: rhbz#1054951
>>
>> Signed-off-by: David A. Marlin <dmarlin at redhat.com>
>> ---
>> pyanaconda/bootloader.py | 20 +++++++++++++++++---
>> 1 files changed, 17 insertions(+), 3 deletions(-)
>>
>> diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py
>> index 1fe292f..cab0c1b 100644
>> --- a/pyanaconda/bootloader.py
>> +++ b/pyanaconda/bootloader.py
>> @@ -1004,6 +1004,8 @@ class GRUB(BootLoader):
>>
>> packages = ["grub"]
>>
>> + _serial_console = ["ttyS"]
> This should be '_serial_consoles' (and the same applies below).
>> +
>> def __init__(self):
>> super(GRUB, self).__init__()
>> self.encrypted_password = ""
>> @@ -1055,9 +1057,18 @@ class GRUB(BootLoader):
>> return GRUB._config_dir
>>
>> @property
>> + def hasSerialConsole(self):
> This should be 'has_serial_console' as the other property's name uses
> underscores.
>
>> + """ true if the console is a serial console. """
>> + for _console in self._serial_console:
>> + if self.console.startswith(_console):
>> + return True
>> + return False
>> +
>> +
>> + @property
>> def serial_command(self):
>> command = ""
>> - if self.console and self.console.startswith("ttyS"):
>> + if self.console and self.hasSerialConsole:
>> unit = self.console[-1]
>> command = ["serial"]
>> s = parse_serial_opt(self.console_options)
>> @@ -1082,7 +1093,7 @@ class GRUB(BootLoader):
>> if not self.console:
>> return
>>
>> - if self.console.startswith("ttyS"):
>> + if self.hasSerialConsole:
>> config.write("%s\n" % self.serial_command)
>> config.write("terminal --timeout=%s serial console\n"
>> % self.timeout)
>> @@ -1462,7 +1473,7 @@ class GRUB2(GRUB):
>> defaults.write("GRUB_DISTRIBUTOR=\"$(sed 's, release .*$,,g' /etc/system-release)\"\n")
>> defaults.write("GRUB_DEFAULT=saved\n")
>> defaults.write("GRUB_DISABLE_SUBMENU=true\n")
>> - if self.console and self.console.startswith("ttyS"):
>> + if self.console and self.hasSerialConsole:
>> defaults.write("GRUB_TERMINAL=\"serial console\"\n")
>> defaults.write("GRUB_SERIAL_COMMAND=\"%s\"\n" % self.serial_command)
>> else:
>> @@ -1730,6 +1741,9 @@ class EFIGRUB(GRUB2):
>> class Aarch64EFIGRUB(EFIGRUB):
>> packages = ["grub2-efi", "grubby"]
>>
>> + _serial_console = ["ttyAMA", "ttyS"]
>> +
>> +
>> class MacEFIGRUB(EFIGRUB):
>> def mactel_config(self):
>> if os.path.exists(ROOT_PATH + "/usr/libexec/mactel-boot-setup"):
> Otherwise this looks good to me. If you send the fixed version, I'm
> gonna push it for you.
Thank you for the prompt review. Changes made and new patch (v2) sent.
d.marlin
More information about the anaconda-patches
mailing list