Merge pull request #401 from xnox/no-bios-grub

filesystem: do not create bios-grub partition on s390x.
This commit is contained in:
Dimitri John Ledkov 2018-11-28 12:10:57 +00:00 committed by GitHub
commit 953af11bad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 13 deletions

View File

@ -298,10 +298,10 @@ class FilesystemController(BaseController):
self.create_filesystem(partition, spec)
return
bootable = self.model.has_bootloader_partition()
log.debug('model has bootloader partition? {}'.format(bootable))
needs_boot = self.model.needs_bootloader_partition()
log.debug('model needs a bootloader partition? {}'.format(needs_boot))
can_be_boot = DeviceAction.MAKE_BOOT in disk.supported_actions
if not bootable and len(disk.partitions()) == 0 and can_be_boot:
if needs_boot and len(disk.partitions()) == 0 and can_be_boot:
part = self._create_boot_partition(disk)
# adjust downward the partition size (if necessary) to accommodate

View File

@ -22,6 +22,7 @@ import logging
import math
import os
import sys
import platform
log = logging.getLogger('subiquity.models.filesystem')
@ -439,8 +440,9 @@ class Disk(_Device):
DeviceAction.PARTITION,
DeviceAction.FORMAT,
DeviceAction.REMOVE,
DeviceAction.MAKE_BOOT,
]
if platform.machine() != 's390x':
supported_actions.append(DeviceAction.MAKE_BOOT)
_can_INFO = True
_can_PARTITION = property(lambda self: self.free_for_partitions > 0)
_can_FORMAT = property(
@ -1027,12 +1029,15 @@ class FilesystemModel(object):
def any_configuration_done(self):
return len(self._disks) > 0
def has_bootloader_partition(self):
''' true if one disk has a boot partition '''
for p in self._partitions:
if p.flag == 'bios_grub' or p.flag == 'boot':
return True
def needs_bootloader_partition(self):
'''true if no disk have a boot partition, and one is needed'''
# s390x has no such thing
if platform.machine() == 's390x':
return False
for p in self._partitions:
if p.flag in ('bios_grub', 'boot'):
return False
return True
def is_root_mounted(self):
for mount in self._mounts:
@ -1061,7 +1066,7 @@ class FilesystemModel(object):
def can_install(self):
# Do we need to check that there is a disk with the boot flag?
return (self.is_root_mounted()
and self.has_bootloader_partition()
and not self.needs_bootloader_partition()
and self.is_slash_boot_on_local_disk())
def add_swapfile(self):

View File

@ -195,7 +195,7 @@ class CompoundDiskForm(Form):
super().__init__(initial)
def validate_devices(self):
if not self.model.has_bootloader_partition():
if self.model.needs_bootloader_partition():
mdc = self.devices.widget
empty_disks = {d for d in self.model.all_disks() if d.used == 0}
if not empty_disks - set(mdc.value):

View File

@ -559,7 +559,7 @@ class FilesystemView(BaseView):
self.controller.ui.set_footer(
_("Select Done to begin the installation."))
else:
if not self.model.has_bootloader_partition():
if self.model.needs_bootloader_partition():
self.controller.ui.set_footer(self.footer)
elif not self.model.is_root_mounted():
self.controller.ui.set_footer(

View File

@ -41,6 +41,7 @@ from subiquitycore.ui.utils import (
from subiquitycore.view import BaseView
from subiquity.models.filesystem import (
DeviceAction,
dehumanize_size,
humanize_size,
)
@ -155,6 +156,7 @@ class GuidedDiskSelectionView(BaseView):
}
self.controller.partition_disk_handler(disk, None, result)
elif self.method == 'lvm':
if DeviceAction.MAKE_BOOT in disk.supported_actions:
self.controller.make_boot_disk(disk)
self.controller.create_partition(
device=disk, spec=dict(