mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-24 07:26:29 +00:00

MAJOR refactor. The volume is now abstracted into a model along with a partitionmap and partitions. Volumes and partitions are now controlled via an FSM to ensure that commands are called in the proper sequence. GRUB can now be installed properly onto loop devices by using dmsetup to fake a proper harddisk.
20 lines
683 B
Python
20 lines
683 B
Python
from abstractpartition import AbstractPartition
|
|
|
|
|
|
class SinglePartition(AbstractPartition):
|
|
|
|
events = [{'name': 'create', 'src': 'nonexistent', 'dst': 'created'},
|
|
{'name': 'format', 'src': 'created', 'dst': 'formatted'},
|
|
{'name': 'mount', 'src': 'formatted', 'dst': 'mounted'},
|
|
{'name': 'unmount', 'src': 'mounted', 'dst': 'formatted'},
|
|
]
|
|
|
|
def __init__(self, size, filesystem, callbacks={}):
|
|
callbacks['oncreate'] = self._create
|
|
super(SinglePartition, self).__init__(size, filesystem, callbacks=callbacks)
|
|
|
|
def create(self, volume):
|
|
self.fsm.create(volume=volume)
|
|
|
|
def _create(self, e):
|
|
self.device_path = e.volume.device_path
|