Skip to content

Commit

Permalink
Don't allow to add more than 4 partitions on msdos disklabels
Browse files Browse the repository at this point in the history
Signed-off-by: Vojtech Trefny <vtrefny@redhat.com>
  • Loading branch information
vojtechtrefny committed Aug 11, 2015
1 parent bc0401f commit 1bab717
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions blivetgui/blivetgui.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,13 @@ def _allow_add_device(self, parent_device, parent_device_type):
"missing PVs.").format(name=parent_device.name)
return (False, msg)

if parent_device.isDisk and parent_device.format and parent_device.format.type == "disklabel":
disk = parent_device.format.partedDisk
if disk.primaryPartitionCount >= disk.maxPrimaryPartitionCount:
msg = _("Disk {name} already reached maximum allowed count of primary partitions " \
"for {label} disklabel.").format(name=parent_device.name, label=parent_device.format.labelType)
return (False, msg)

return (True, None)

def add_partition(self, _widget=None, btrfs_pt=False):
Expand Down

0 comments on commit 1bab717

Please sign in to comment.