summaryrefslogtreecommitdiffstats
path: root/filter_plugins
diff options
context:
space:
mode:
authorJason DeTiberus <detiber@gmail.com>2016-05-10 16:09:38 -0400
committerJason DeTiberus <detiber@gmail.com>2016-05-10 16:09:38 -0400
commit0df86f3a6aa585cf7582c2c8d6125f8a79cc295e (patch)
treea0f288e62fc91a7cb84d071d55937cd445630b72 /filter_plugins
parent88806a06a55f4eb5eb82493087660834e228c389 (diff)
parenta48c955dfc1cfc8d12dc790e4fad63bbe21cfe3d (diff)
downloadopenshift-0df86f3a6aa585cf7582c2c8d6125f8a79cc295e.tar.gz
openshift-0df86f3a6aa585cf7582c2c8d6125f8a79cc295e.tar.bz2
openshift-0df86f3a6aa585cf7582c2c8d6125f8a79cc295e.tar.xz
openshift-0df86f3a6aa585cf7582c2c8d6125f8a79cc295e.zip
Merge pull request #1192 from lebauce/storage-cinder-role
Add support for Openstack based persistent volumes
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 402103b09..e7409bf22 100644
--- a/filter_plugins/oo_filters.py
+++ b/filter_plugins/oo_filters.py
@@ -732,21 +732,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,
@@ -756,6 +757,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,