mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-10-10 09:09:50 +00:00
Remove mountpoints from partitions
This commit is contained in:
parent
ecdc255752
commit
3c32310346
4 changed files with 12 additions and 13 deletions
|
@ -9,20 +9,17 @@ class GPTPartitionMap(AbstractPartitionMap):
|
||||||
def __init__(self, data):
|
def __init__(self, data):
|
||||||
self.boot = None
|
self.boot = None
|
||||||
self.swap = None
|
self.swap = None
|
||||||
self.mount_points = []
|
|
||||||
if 'boot' in data:
|
if 'boot' in data:
|
||||||
self.boot = GPTPartition(data['boot']['size'], data['boot']['filesystem'], 'boot', None)
|
self.boot = GPTPartition(data['boot']['size'], data['boot']['filesystem'], 'boot', None)
|
||||||
self.mount_points.append(('/boot', self.boot))
|
|
||||||
self.root = GPTPartition(data['root']['size'], data['root']['filesystem'], 'root', self.boot)
|
self.root = GPTPartition(data['root']['size'], data['root']['filesystem'], 'root', self.boot)
|
||||||
self.mount_points.append(('/', self.root))
|
|
||||||
if 'swap' in data:
|
if 'swap' in data:
|
||||||
self.swap = GPTSwapPartition(data['swap']['size'], self.root)
|
self.swap = GPTSwapPartition(data['swap']['size'], self.root)
|
||||||
self.mount_points.append(('none', self.root))
|
|
||||||
self.partitions = filter(lambda p: p is not None, [self.boot, self.root, self.swap])
|
self.partitions = filter(lambda p: p is not None, [self.boot, self.root, self.swap])
|
||||||
|
|
||||||
super(GPTPartitionMap, self).__init__()
|
super(GPTPartitionMap, self).__init__()
|
||||||
|
|
||||||
def _before_create(self, volume):
|
def _before_create(self, event):
|
||||||
|
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,
|
||||||
'--', 'mklabel', 'gpt'])
|
'--', 'mklabel', 'gpt'])
|
||||||
for partition in self.partitions:
|
for partition in self.partitions:
|
||||||
|
@ -31,7 +28,7 @@ class GPTPartitionMap(AbstractPartitionMap):
|
||||||
boot_idx = self.root.get_index()
|
boot_idx = self.root.get_index()
|
||||||
if self.boot is not None:
|
if self.boot is not None:
|
||||||
boot_idx = self.boot.get_index()
|
boot_idx = self.boot.get_index()
|
||||||
log_check_call(['/sbin/parted', '--script', volume.device_path,
|
|
||||||
'--', 'set ' + str(boot_idx) + ' bios_grub on'])
|
|
||||||
log_check_call(['/sbin/parted', '--script', volume.device_path,
|
log_check_call(['/sbin/parted', '--script', volume.device_path,
|
||||||
'--', 'set ' + str(boot_idx) + ' boot on'])
|
'--', 'set ' + str(boot_idx) + ' boot on'])
|
||||||
|
log_check_call(['/sbin/parted', '--script', volume.device_path,
|
||||||
|
'--', 'set ' + str(boot_idx) + ' bios_grub on'])
|
||||||
|
|
|
@ -9,15 +9,11 @@ class MBRPartitionMap(AbstractPartitionMap):
|
||||||
def __init__(self, data):
|
def __init__(self, data):
|
||||||
self.boot = None
|
self.boot = None
|
||||||
self.swap = None
|
self.swap = None
|
||||||
self.mount_points = []
|
|
||||||
if 'boot' in data:
|
if 'boot' in data:
|
||||||
self.boot = MBRPartition(data['boot']['size'], data['boot']['filesystem'], None)
|
self.boot = MBRPartition(data['boot']['size'], data['boot']['filesystem'], None)
|
||||||
self.mount_points.append(('/boot', self.boot))
|
|
||||||
self.root = MBRPartition(data['root']['size'], data['root']['filesystem'], self.boot)
|
self.root = MBRPartition(data['root']['size'], data['root']['filesystem'], self.boot)
|
||||||
self.mount_points.append(('/', self.root))
|
|
||||||
if 'swap' in data:
|
if 'swap' in data:
|
||||||
self.swap = MBRSwapPartition(data['swap']['size'], self.root)
|
self.swap = MBRSwapPartition(data['swap']['size'], self.root)
|
||||||
self.mount_points.append(('none', self.root))
|
|
||||||
self.partitions = filter(lambda p: p is not None, [self.boot, self.root, self.swap])
|
self.partitions = filter(lambda p: p is not None, [self.boot, self.root, self.swap])
|
||||||
|
|
||||||
super(MBRPartitionMap, self).__init__()
|
super(MBRPartitionMap, self).__init__()
|
||||||
|
|
|
@ -10,7 +10,6 @@ class NoPartitions(FSMProxy):
|
||||||
root = data['root']
|
root = data['root']
|
||||||
self.root = SinglePartition(root['size'], root['filesystem'])
|
self.root = SinglePartition(root['size'], root['filesystem'])
|
||||||
self.partitions = [self.root]
|
self.partitions = [self.root]
|
||||||
self.mount_points = [('/', self.root)]
|
|
||||||
|
|
||||||
cfg = {'initial': 'nonexistent', 'events': self.events, 'callbacks': {}}
|
cfg = {'initial': 'nonexistent', 'events': self.events, 'callbacks': {}}
|
||||||
super(NoPartitions, self).__init__(cfg)
|
super(NoPartitions, self).__init__(cfg)
|
||||||
|
|
|
@ -132,8 +132,15 @@ class FStab(Task):
|
||||||
# device = '/dev/sda'
|
# device = '/dev/sda'
|
||||||
# if info.manifest.virtualization == 'pvm':
|
# if info.manifest.virtualization == 'pvm':
|
||||||
# device = '/dev/xvda'
|
# device = '/dev/xvda'
|
||||||
|
p_map = info.volume.partition_map
|
||||||
|
mount_points = [('/root', p_map.root)]
|
||||||
|
if hasattr(p_map, 'boot'):
|
||||||
|
mount_points.append(('/boot', p_map.boot))
|
||||||
|
if hasattr(p_map, 'swap'):
|
||||||
|
mount_points.append(('none', p_map.swap))
|
||||||
|
|
||||||
fstab_lines = []
|
fstab_lines = []
|
||||||
for mount_point, partition in info.volume.partition_map.mount_points:
|
for mount_point, partition in mount_points:
|
||||||
mount_opts = ['defaults']
|
mount_opts = ['defaults']
|
||||||
if partition.filesystem in ['ext2', 'ext3', 'ext4']:
|
if partition.filesystem in ['ext2', 'ext3', 'ext4']:
|
||||||
mount_opts.append('barrier=0')
|
mount_opts.append('barrier=0')
|
||||||
|
|
Loading…
Add table
Reference in a new issue