summaryrefslogtreecommitdiffstats
path: root/filter_plugins
diff options
context:
space:
mode:
authorSylvain Baubeau <sbaubeau@redhat.com>2016-01-15 11:16:44 +0100
committerSylvain Baubeau <sbaubeau@redhat.com>2016-05-10 11:20:51 +0200
commita48c955dfc1cfc8d12dc790e4fad63bbe21cfe3d (patch)
tree1acde80a66be09dcd5a29f1dc3bc33a28e616301 /filter_plugins
parent7cb05911b4214bfb75abf65dd19a55f73fe09982 (diff)
downloadopenshift-a48c955dfc1cfc8d12dc790e4fad63bbe21cfe3d.tar.gz
openshift-a48c955dfc1cfc8d12dc790e4fad63bbe21cfe3d.tar.bz2
openshift-a48c955dfc1cfc8d12dc790e4fad63bbe21cfe3d.tar.xz
openshift-a48c955dfc1cfc8d12dc790e4fad63bbe21cfe3d.zip
Add support for Openstack based persistent volumes
Signed-off-by: Sylvain Baubeau <sbaubeau@redhat.com>
Diffstat (limited to 'filter_plugins')
-rw-r--r--filter_plugins/oo_filters.py30
1 files changed, 23 insertions, 7 deletions
diff --git a/filter_plugins/oo_filters.py b/filter_plugins/oo_filters.py
index 3da4562ac..1230eca8f 100644
--- a/filter_plugins/oo_filters.py
+++ b/filter_plugins/oo_filters.py
@@ -693,21 +693,22 @@ class FilterModule(object):
if 'hosted' in hostvars['openshift']:
for component in hostvars['openshift']['hosted']:
if 'storage' in hostvars['openshift']['hosted'][component]:
- kind = hostvars['openshift']['hosted'][component]['storage']['kind']
- create_pv = hostvars['openshift']['hosted'][component]['storage']['create_pv']
+ params = hostvars['openshift']['hosted'][component]['storage']
+ kind = params['kind']
+ create_pv = params['create_pv']
if kind != None and create_pv:
if kind == 'nfs':
- host = hostvars['openshift']['hosted'][component]['storage']['host']
+ host = params['host']
if host == None:
if len(groups['oo_nfs_to_config']) > 0:
host = groups['oo_nfs_to_config'][0]
else:
raise errors.AnsibleFilterError("|failed no storage host detected")
- directory = hostvars['openshift']['hosted'][component]['storage']['nfs']['directory']
- volume = hostvars['openshift']['hosted'][component]['storage']['volume']['name']
+ directory = params['nfs']['directory']
+ volume = params['volume']['name']
path = directory + '/' + volume
- size = hostvars['openshift']['hosted'][component]['storage']['volume']['size']
- access_modes = hostvars['openshift']['hosted'][component]['storage']['access_modes']
+ size = params['volume']['size']
+ access_modes = params['access_modes']
persistent_volume = dict(
name="{0}-volume".format(volume),
capacity=size,
@@ -717,6 +718,21 @@ class FilterModule(object):
server=host,
path=path)))
persistent_volumes.append(persistent_volume)
+ elif kind == 'openstack':
+ volume = params['volume']['name']
+ size = params['volume']['size']
+ access_modes = params['access_modes']
+ filesystem = params['openstack']['filesystem']
+ volume_id = params['openstack']['volumeID']
+ persistent_volume = dict(
+ name="{0}-volume".format(volume),
+ capacity=size,
+ access_modes=access_modes,
+ storage=dict(
+ cinder=dict(
+ fsType=filesystem,
+ volumeID=volume_id)))
+ persistent_volumes.append(persistent_volume)
else:
msg = "|failed invalid storage kind '{0}' for component '{1}'".format(
kind,