Commit 0805b8fb authored by Fabrice Roy's avatar Fabrice Roy

add cluster storage

add shortdescription for meso
parent 7b8ba624
......@@ -42,6 +42,14 @@ class cluster(nodes.General, nodes.Element):
""" cluster description """
class cluster_storage_list(nodes.General, nodes.Element):
""" storage list associated to clusters """
class cluster_storage(nodes.General, nodes.Element):
""" storage associated to cluster description """
class storage_list(nodes.General, nodes.Element):
""" storage list """
......@@ -137,6 +145,16 @@ class Meso(Directive):
self.state.nested_parse(self.content, self.content_offset, node)
if( 'fulldescription' in node ):
if( node['fulldescription'] is not None ):
phrase=node[ 'fulldescription'].split(".")
node['shortdescription'] = phrase[0]+'.'
if ( len(phrase) > 1 ):
node['fulldescription'] = ''
for p in phrase[1:]:
if (p.strip()):
node['fulldescription'] = node['fulldescription']+p+'.'
return [node]
......@@ -180,6 +198,44 @@ class Cluster(Directive):
return [node]
class ClusterStorageList(Directive):
required_arguments = 0
optional_arguments = 0
final_argument_whitespace = True
option_spec = {}
has_content = True
def run(self):
node = cluster_storage_list()
if self.content:
self.state.nested_parse(self.content, self.content_offset, node)
return [node]
class ClusterStorage(Directive):
required_arguments = 0
optional_arguments = 1
final_argument_whitespace = True
option_spec = { # Option name in lowercase!
'typename': str,
'name': str,
'filesystemtype': str,
'size': float,
}
has_content = True
def run(self):
node = cluster_storage()
node['name'] = self.arguments[0] if self.arguments else ''
for key in self.option_spec:
node[key] = self.options.get(key, None)
self.state.nested_parse(self.content, self.content_offset, node)
return [node]
class StorageList(Directive):
required_arguments = 0
optional_arguments = 0
......@@ -267,6 +323,8 @@ def register():
directives.register_directive('meso', Meso)
directives.register_directive('cluster_list', ClusterList)
directives.register_directive('cluster', Cluster)
directives.register_directive('cluster_storage_list', ClusterStorageList)
directives.register_directive('cluster_storage', ClusterStorage)
directives.register_directive('storage_list', StorageList)
directives.register_directive('storage', Storage)
directives.register_directive('node_type_list', NodeTypeList)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment