Merge pull request #20 from CanonicalLtd/add_gpt

Add gpt
This commit is contained in:
Adam Stokes 2015-07-23 16:31:45 -04:00
commit 7cafe6c07f
3 changed files with 16 additions and 1 deletions

View File

@ -32,6 +32,7 @@ from subiquity.filesystem import (FilesystemView,
FilesystemModel)
from subiquity.ui.dummy import DummyView
BIOS_GRUB_SIZE_BYTES = 2 * 1024 * 1024 # 2MiB
log = logging.getLogger('subiquity.core')
@ -272,6 +273,16 @@ class Controller:
def add_disk_partition_handler(self, disk, spec):
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"]:
current_disk.add_partition(partnum=spec["partnum"],
size=spec["bytes"],

View File

@ -53,6 +53,10 @@ class PartitionAction(DiskAction):
self._action_id = "{}{}_part".format(self.parent.action_id,
self.partnumber)
''' rename action_id for readability '''
if self.flags in ['bios_grub']:
self._action_id = 'bios_boot_partition'
@property
def size(self):
return self._size

View File

@ -63,7 +63,7 @@ class Bcachedev():
class Blockdev():
def __init__(self, devpath, serial, parttype='msdos'):
def __init__(self, devpath, serial, parttype='gpt'):
self.serial = serial
self.devpath = devpath
self._parttype = parttype