Initial implementation of strategies
There should be a way to declaratively describe each space type and strategy of its allocation. Implements blueprint: dynamic-allocation Change-Id: I66c2f0b90fb94b0496b5d341817688a042161318
This commit is contained in:
parent
b1cef8c4a0
commit
5ed0f74a9c
@ -31,6 +31,12 @@ class DynamicSchemaParser(object):
|
|||||||
self.rendered_spaces = []
|
self.rendered_spaces = []
|
||||||
self.disks = []
|
self.disks = []
|
||||||
self.spaces = []
|
self.spaces = []
|
||||||
|
# TODO(eli): In the future should be moved into config.
|
||||||
|
self.strategies = {
|
||||||
|
'vg': {'strategy': 'container'},
|
||||||
|
'lv': {'strategy': 'elastic'},
|
||||||
|
'partitions': {'strategy': 'elastic'}
|
||||||
|
}
|
||||||
|
|
||||||
self.parse()
|
self.parse()
|
||||||
self.post_parse()
|
self.post_parse()
|
||||||
@ -42,9 +48,12 @@ class DynamicSchemaParser(object):
|
|||||||
Disk(**disk)
|
Disk(**disk)
|
||||||
for disk in self.raw_disks]
|
for disk in self.raw_disks]
|
||||||
|
|
||||||
self.spaces = [
|
for s in self.rendered_spaces:
|
||||||
Space(**space)
|
strategy = self.strategies.get(s['type'], {}).get('strategy')
|
||||||
for space in self.rendered_spaces if space['type'] != 'vg']
|
if strategy == 'elastic':
|
||||||
|
self.spaces.append(Space(**s))
|
||||||
|
elif strategy is None:
|
||||||
|
LOG.warn('There is not strategy for space %s', s)
|
||||||
|
|
||||||
def post_parse(self):
|
def post_parse(self):
|
||||||
# Add fake volume Unallocated, in order to be able
|
# Add fake volume Unallocated, in order to be able
|
||||||
|
Loading…
Reference in New Issue
Block a user