mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-24 07:26:29 +00:00
Document post-mbr gap and make it MBR-only
This commit is contained in:
parent
ceae489210
commit
754e414742
4 changed files with 11 additions and 2 deletions
|
@ -22,7 +22,7 @@ class AbstractPartitionMap(FSMProxy):
|
||||||
return self.fsm.current == 'mapped'
|
return self.fsm.current == 'mapped'
|
||||||
|
|
||||||
def get_total_size(self):
|
def get_total_size(self):
|
||||||
return sum(p.size for p in self.partitions) + 1
|
return sum(p.size for p in self.partitions)
|
||||||
|
|
||||||
def create(self, volume):
|
def create(self, volume):
|
||||||
self.fsm.create(volume=volume)
|
self.fsm.create(volume=volume)
|
||||||
|
|
|
@ -19,6 +19,9 @@ class MBRPartitionMap(AbstractPartitionMap):
|
||||||
|
|
||||||
super(MBRPartitionMap, self).__init__()
|
super(MBRPartitionMap, 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,
|
||||||
|
|
|
@ -26,7 +26,7 @@ class BasePartition(AbstractPartition):
|
||||||
|
|
||||||
def get_start(self):
|
def get_start(self):
|
||||||
if self.previous is None:
|
if self.previous is None:
|
||||||
return 1
|
return 0
|
||||||
else:
|
else:
|
||||||
return self.previous.get_start() + self.previous.size
|
return self.previous.get_start() + self.previous.size
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,12 @@ from base import BasePartition
|
||||||
|
|
||||||
class MBRPartition(BasePartition):
|
class MBRPartition(BasePartition):
|
||||||
|
|
||||||
|
def get_start(self):
|
||||||
|
if self.previous is None:
|
||||||
|
return 1 # Post-MBR gap for embedding grub
|
||||||
|
else:
|
||||||
|
return self.previous.get_start() + self.previous.size
|
||||||
|
|
||||||
def _before_create(self, e):
|
def _before_create(self, e):
|
||||||
start = self.get_start()
|
start = self.get_start()
|
||||||
parted_command = ('mkpart primary {start}MiB {end}MiB'
|
parted_command = ('mkpart primary {start}MiB {end}MiB'
|
||||||
|
|
Loading…
Add table
Reference in a new issue