mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-24 23:36:29 +00:00
27 lines
693 B
Python
27 lines
693 B
Python
from ..partitions.single import SinglePartition
|
|
from common.fsm_proxy import FSMProxy
|
|
|
|
|
|
class NoPartitions(FSMProxy):
|
|
|
|
events = [{'name': 'create', 'src': 'nonexistent', 'dst': 'created'}]
|
|
|
|
def __init__(self, data):
|
|
root = data['root']
|
|
self.root = SinglePartition(root['size'], root['filesystem'])
|
|
self.partitions = [self.root]
|
|
|
|
cfg = {'initial': 'nonexistent', 'events': self.events, 'callbacks': {}}
|
|
super(NoPartitions, self).__init__(cfg)
|
|
|
|
def is_blocking(self):
|
|
return self.root.is_blocking()
|
|
|
|
def get_total_size(self):
|
|
return self.root.size
|
|
|
|
def create(self, volume):
|
|
self.fsm.create(volume=volume)
|
|
|
|
def _before_create(self, event):
|
|
self.root.create(event.volume)
|