mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-24 07:26:29 +00:00
Post-MBR size increased to 2.
Also, move the size addition into the volume model
This commit is contained in:
parent
1e97600013
commit
81a4ec78eb
6 changed files with 7 additions and 7 deletions
|
@ -22,9 +22,6 @@ class MSDOSPartitionMap(AbstractPartitionMap):
|
||||||
|
|
||||||
super(MSDOSPartitionMap, self).__init__()
|
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):
|
def _before_create(self, event):
|
||||||
volume = event.volume
|
volume = event.volume
|
||||||
log_check_call(['/sbin/parted', '--script', '--align', 'none', volume.device_path,
|
log_check_call(['/sbin/parted', '--script', '--align', 'none', volume.device_path,
|
||||||
|
|
|
@ -6,7 +6,7 @@ class MSDOSPartition(BasePartition):
|
||||||
|
|
||||||
def get_start(self):
|
def get_start(self):
|
||||||
if self.previous is None:
|
if self.previous is None:
|
||||||
return 1 # Post-MBR gap for embedding grub
|
return 2 # Post-MBR gap for embedding grub
|
||||||
else:
|
else:
|
||||||
return self.previous.get_start() + self.previous.size
|
return self.previous.get_start() + self.previous.size
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ from common.fsm_proxy import FSMProxy
|
||||||
from common.tools import log_check_call
|
from common.tools import log_check_call
|
||||||
from exceptions import VolumeError
|
from exceptions import VolumeError
|
||||||
from partitionmaps.none import NoPartitions
|
from partitionmaps.none import NoPartitions
|
||||||
|
from partitionmaps.mbr import MSDOSPartitionMap
|
||||||
|
|
||||||
|
|
||||||
class Volume(FSMProxy):
|
class Volume(FSMProxy):
|
||||||
|
@ -22,6 +23,8 @@ class Volume(FSMProxy):
|
||||||
self.real_device_path = None
|
self.real_device_path = None
|
||||||
self.partition_map = partition_map
|
self.partition_map = partition_map
|
||||||
self.size = self.partition_map.get_total_size()
|
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}
|
callbacks = {'onbeforedetach': self._check_blocking}
|
||||||
if isinstance(self.partition_map, NoPartitions):
|
if isinstance(self.partition_map, NoPartitions):
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
"partitions": {
|
"partitions": {
|
||||||
"type": "msdos",
|
"type": "msdos",
|
||||||
"root": {
|
"root": {
|
||||||
"size": 1023,
|
"size": 1022,
|
||||||
"filesystem": "ext4"
|
"filesystem": "ext4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
"filesystem": "ext2"
|
"filesystem": "ext2"
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"size": 1855,
|
"size": 1854,
|
||||||
"filesystem": "ext4"
|
"filesystem": "ext4"
|
||||||
},
|
},
|
||||||
"swap": {"size": 128}
|
"swap": {"size": 128}
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
"filesystem": "ext2"
|
"filesystem": "ext2"
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"size": 991,
|
"size": 990,
|
||||||
"filesystem": "ext4"
|
"filesystem": "ext4"
|
||||||
},
|
},
|
||||||
"swap": {"size": 128}
|
"swap": {"size": 128}
|
||||||
|
|
Loading…
Add table
Reference in a new issue