Post-MBR size increased to 2.

Also, move the size addition into the volume model
This commit is contained in:
Anders Ingemann 2014-01-18 23:31:40 +01:00
parent 1e97600013
commit 81a4ec78eb
6 changed files with 7 additions and 7 deletions

View file

@ -22,9 +22,6 @@ class MSDOSPartitionMap(AbstractPartitionMap):
super(MSDOSPartitionMap, self).__init__()
def get_total_size(self):
return sum(p.size for p in self.partitions) + 1 # Post-MBR gap for embedding grub
def _before_create(self, event):
volume = event.volume
log_check_call(['/sbin/parted', '--script', '--align', 'none', volume.device_path,

View file

@ -6,7 +6,7 @@ class MSDOSPartition(BasePartition):
def get_start(self):
if self.previous is None:
return 1 # Post-MBR gap for embedding grub
return 2 # Post-MBR gap for embedding grub
else:
return self.previous.get_start() + self.previous.size

View file

@ -3,6 +3,7 @@ from common.fsm_proxy import FSMProxy
from common.tools import log_check_call
from exceptions import VolumeError
from partitionmaps.none import NoPartitions
from partitionmaps.mbr import MSDOSPartitionMap
class Volume(FSMProxy):
@ -22,6 +23,8 @@ class Volume(FSMProxy):
self.real_device_path = None
self.partition_map = partition_map
self.size = self.partition_map.get_total_size()
if isinstance(self.partition_map, MSDOSPartitionMap):
self.size += 2 # Post-MBR gap for embedding bootloader
callbacks = {'onbeforedetach': self._check_blocking}
if isinstance(self.partition_map, NoPartitions):

View file

@ -29,7 +29,7 @@
"partitions": {
"type": "msdos",
"root": {
"size": 1023,
"size": 1022,
"filesystem": "ext4"
}
}

View file

@ -26,7 +26,7 @@
"filesystem": "ext2"
},
"root": {
"size": 1855,
"size": 1854,
"filesystem": "ext4"
},
"swap": {"size": 128}

View file

@ -26,7 +26,7 @@
"filesystem": "ext2"
},
"root": {
"size": 991,
"size": 990,
"filesystem": "ext4"
},
"swap": {"size": 128}