commit
7cafe6c07f
|
@ -32,6 +32,7 @@ from subiquity.filesystem import (FilesystemView,
|
||||||
FilesystemModel)
|
FilesystemModel)
|
||||||
from subiquity.ui.dummy import DummyView
|
from subiquity.ui.dummy import DummyView
|
||||||
|
|
||||||
|
BIOS_GRUB_SIZE_BYTES = 2 * 1024 * 1024 # 2MiB
|
||||||
log = logging.getLogger('subiquity.core')
|
log = logging.getLogger('subiquity.core')
|
||||||
|
|
||||||
|
|
||||||
|
@ -272,6 +273,16 @@ class Controller:
|
||||||
|
|
||||||
def add_disk_partition_handler(self, disk, spec):
|
def add_disk_partition_handler(self, disk, spec):
|
||||||
current_disk = self.models["filesystem"].get_disk(disk)
|
current_disk = self.models["filesystem"].get_disk(disk)
|
||||||
|
|
||||||
|
''' create a gpt boot partition if one doesn't exist '''
|
||||||
|
if current_disk.parttype == 'gpt' and \
|
||||||
|
len(current_disk.disk.partitions) == 0:
|
||||||
|
log.debug('Adding grub_bios gpt partition first')
|
||||||
|
current_disk.add_partition(partnum=1,
|
||||||
|
size=BIOS_GRUB_SIZE_BYTES,
|
||||||
|
fstype=None,
|
||||||
|
flag='bios_grub')
|
||||||
|
|
||||||
if spec["fstype"] in ["swap"]:
|
if spec["fstype"] in ["swap"]:
|
||||||
current_disk.add_partition(partnum=spec["partnum"],
|
current_disk.add_partition(partnum=spec["partnum"],
|
||||||
size=spec["bytes"],
|
size=spec["bytes"],
|
||||||
|
|
|
@ -53,6 +53,10 @@ class PartitionAction(DiskAction):
|
||||||
self._action_id = "{}{}_part".format(self.parent.action_id,
|
self._action_id = "{}{}_part".format(self.parent.action_id,
|
||||||
self.partnumber)
|
self.partnumber)
|
||||||
|
|
||||||
|
''' rename action_id for readability '''
|
||||||
|
if self.flags in ['bios_grub']:
|
||||||
|
self._action_id = 'bios_boot_partition'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def size(self):
|
def size(self):
|
||||||
return self._size
|
return self._size
|
||||||
|
|
|
@ -63,7 +63,7 @@ class Bcachedev():
|
||||||
|
|
||||||
|
|
||||||
class Blockdev():
|
class Blockdev():
|
||||||
def __init__(self, devpath, serial, parttype='msdos'):
|
def __init__(self, devpath, serial, parttype='gpt'):
|
||||||
self.serial = serial
|
self.serial = serial
|
||||||
self.devpath = devpath
|
self.devpath = devpath
|
||||||
self._parttype = parttype
|
self._parttype = parttype
|
||||||
|
|
Loading…
Reference in New Issue