diff --git a/base/fs/partitionmaps/gpt.py b/base/fs/partitionmaps/gpt.py index 348fb0c..b884bd9 100644 --- a/base/fs/partitionmaps/gpt.py +++ b/base/fs/partitionmaps/gpt.py @@ -9,20 +9,17 @@ class GPTPartitionMap(AbstractPartitionMap): def __init__(self, data): self.boot = None self.swap = None - self.mount_points = [] if 'boot' in data: 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.mount_points.append(('/', self.root)) if 'swap' in data: 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]) 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, '--', 'mklabel', 'gpt']) for partition in self.partitions: @@ -31,7 +28,7 @@ class GPTPartitionMap(AbstractPartitionMap): boot_idx = self.root.get_index() if self.boot is not None: 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, '--', 'set ' + str(boot_idx) + ' boot on']) + log_check_call(['/sbin/parted', '--script', volume.device_path, + '--', 'set ' + str(boot_idx) + ' bios_grub on']) diff --git a/base/fs/partitionmaps/mbr.py b/base/fs/partitionmaps/mbr.py index 942f5b4..0bc4cfa 100644 --- a/base/fs/partitionmaps/mbr.py +++ b/base/fs/partitionmaps/mbr.py @@ -9,15 +9,11 @@ class MBRPartitionMap(AbstractPartitionMap): def __init__(self, data): self.boot = None self.swap = None - self.mount_points = [] if 'boot' in data: 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.mount_points.append(('/', self.root)) if 'swap' in data: 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]) super(MBRPartitionMap, self).__init__() diff --git a/base/fs/partitionmaps/none.py b/base/fs/partitionmaps/none.py index fd80f96..cc9a8b0 100644 --- a/base/fs/partitionmaps/none.py +++ b/base/fs/partitionmaps/none.py @@ -10,7 +10,6 @@ class NoPartitions(FSMProxy): root = data['root'] self.root = SinglePartition(root['size'], root['filesystem']) self.partitions = [self.root] - self.mount_points = [('/', self.root)] cfg = {'initial': 'nonexistent', 'events': self.events, 'callbacks': {}} super(NoPartitions, self).__init__(cfg) diff --git a/common/tasks/filesystem.py b/common/tasks/filesystem.py index 08dd86a..2fee046 100644 --- a/common/tasks/filesystem.py +++ b/common/tasks/filesystem.py @@ -132,8 +132,15 @@ class FStab(Task): # device = '/dev/sda' # if info.manifest.virtualization == 'pvm': # 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 = [] - for mount_point, partition in info.volume.partition_map.mount_points: + for mount_point, partition in mount_points: mount_opts = ['defaults'] if partition.filesystem in ['ext2', 'ext3', 'ext4']: mount_opts.append('barrier=0')