adds support for configuration of cinder nfs backend driver
a new config options is added: CONFIG_CINDER_NFS_MOUNTS , also adds validate_multi_regepx for use with both NFS mounts and GlusterFS mounts Change-Id: I5cf0ef0114c7eaa0bedd8528e6b1fe805221443a
This commit is contained in:
parent
dbb86c4a6e
commit
275fce4c94
@ -86,13 +86,28 @@ Cinder Config parameters
|
|||||||
|
|
||||||
**CONFIG_CINDER_KS_PW** : The password to use for the Cinder to authenticate with Keystone
|
**CONFIG_CINDER_KS_PW** : The password to use for the Cinder to authenticate with Keystone
|
||||||
|
|
||||||
**CONFIG_CINDER_VOLUMES_CREATE** : Create Cinder's volumes group ['y', 'n']
|
**CONFIG_CINDER_BACKEND** : The Cinder backend to use ['lvm', 'gluster', 'nfs']
|
||||||
|
|
||||||
Cinder volume create Config parameters
|
Cinder volume create Config parameters
|
||||||
--------------------------------------
|
--------------------------------------
|
||||||
|
|
||||||
|
**CONFIG_CINDER_VOLUMES_CREATE** : Create Cinder's volumes group ['y', 'n']
|
||||||
|
|
||||||
|
Cinder volume size Config parameters
|
||||||
|
------------------------------------
|
||||||
|
|
||||||
**CONFIG_CINDER_VOLUMES_SIZE** : Cinder's volumes group size
|
**CONFIG_CINDER_VOLUMES_SIZE** : Cinder's volumes group size
|
||||||
|
|
||||||
|
Cinder gluster Config parameters
|
||||||
|
--------------------------------
|
||||||
|
|
||||||
|
**CONFIG_CINDER_GLUSTER_MOUNTS** : A single or comma separated list of gluster volume shares
|
||||||
|
|
||||||
|
Cinder NFS Config parameters
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
**CONFIG_CINDER_NFS_MOUNTS** : A single or comma seprated list of NFS exports to mount
|
||||||
|
|
||||||
Nova Options
|
Nova Options
|
||||||
------------
|
------------
|
||||||
|
|
||||||
|
@ -46,3 +46,19 @@ def process_ssh_key(param, process_args=None):
|
|||||||
param = param.endswith('.pub') and param or ('%s.pub' % param)
|
param = param.endswith('.pub') and param or ('%s.pub' % param)
|
||||||
create_key(key_file)
|
create_key(key_file)
|
||||||
return param
|
return param
|
||||||
|
|
||||||
|
|
||||||
|
def process_add_quotes_around_values(param, process_args=None):
|
||||||
|
"""
|
||||||
|
Add a single quote character around each element of a comma
|
||||||
|
separated list of values
|
||||||
|
"""
|
||||||
|
params_list = param.split(',')
|
||||||
|
for index, elem in enumerate(params_list):
|
||||||
|
if not elem.startswith("'"):
|
||||||
|
elem = "'" + elem
|
||||||
|
if not elem.endswith("'"):
|
||||||
|
elem = elem + "'"
|
||||||
|
params_list[index] = elem
|
||||||
|
param = ','.join(params_list)
|
||||||
|
return param
|
||||||
|
@ -69,6 +69,16 @@ def validate_regexp(param, options=None):
|
|||||||
raise ParamValidationError(msg % param)
|
raise ParamValidationError(msg % param)
|
||||||
|
|
||||||
|
|
||||||
|
def validate_multi_regexp(param, options=None):
|
||||||
|
"""
|
||||||
|
Raises ParamValidationError if any of the comma separated values given
|
||||||
|
in param doesn't match one of the regular expressions given in options.
|
||||||
|
"""
|
||||||
|
options = options or []
|
||||||
|
for i in param.split(','):
|
||||||
|
validate_regexp(i.strip(), options=options)
|
||||||
|
|
||||||
|
|
||||||
def validate_port(param, options=None):
|
def validate_port(param, options=None):
|
||||||
"""
|
"""
|
||||||
Raises ParamValidationError if given param is not a decimal number
|
Raises ParamValidationError if given param is not a decimal number
|
||||||
|
@ -7,6 +7,7 @@ import uuid
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
from packstack.installer import exceptions
|
from packstack.installer import exceptions
|
||||||
|
from packstack.installer import processors
|
||||||
from packstack.installer import validators
|
from packstack.installer import validators
|
||||||
|
|
||||||
from packstack.installer import basedefs
|
from packstack.installer import basedefs
|
||||||
@ -70,9 +71,9 @@ def initConfig(controllerObject):
|
|||||||
"CONDITION" : False },
|
"CONDITION" : False },
|
||||||
{"CMD_OPTION" : "cinder-backend",
|
{"CMD_OPTION" : "cinder-backend",
|
||||||
"USAGE" : ("The Cinder backend to use, valid options are: "
|
"USAGE" : ("The Cinder backend to use, valid options are: "
|
||||||
"lvm, gluster"),
|
"lvm, gluster, nfs"),
|
||||||
"PROMPT" : "Enter the Cinder backend to be configured",
|
"PROMPT" : "Enter the Cinder backend to be configured",
|
||||||
"OPTION_LIST" : ["lvm", "gluster"],
|
"OPTION_LIST" : ["lvm", "gluster", "nfs"],
|
||||||
"VALIDATORS" : [validators.validate_options],
|
"VALIDATORS" : [validators.validate_options],
|
||||||
"DEFAULT_VALUE" : "lvm",
|
"DEFAULT_VALUE" : "lvm",
|
||||||
"MASK_INPUT" : False,
|
"MASK_INPUT" : False,
|
||||||
@ -159,13 +160,13 @@ def initConfig(controllerObject):
|
|||||||
|
|
||||||
paramsList = [
|
paramsList = [
|
||||||
{"CMD_OPTION" : "cinder-gluster-mounts",
|
{"CMD_OPTION" : "cinder-gluster-mounts",
|
||||||
"USAGE" : ("A gluster volume to mount, eg: "
|
"USAGE" : ("A single or comma separated list of gluster volume shares "
|
||||||
"ip-address:/vol-name "
|
"to mount, eg: ip-address:/vol-name "),
|
||||||
"You don't need to create a local volume group when "
|
"PROMPT" : ("Enter a single or comma separated list of gluster volume "
|
||||||
"using gluster."),
|
"shares to use with Cinder"),
|
||||||
"PROMPT" : "Enter a gluster volume for use with Cinder",
|
"OPTION_LIST" : ["^'([\d]{1,3}\.){3}[\d]{1,3}:/.*'"],
|
||||||
"OPTION_LIST" : ["^([\d]{1,3}\.){3}[\d]{1,3}:/.*"],
|
"VALIDATORS" : [validators.validate_multi_regexp],
|
||||||
"VALIDATORS" : [validators.validate_regexp],
|
"PROCESSORS" : [processors.process_add_quotes_around_values],
|
||||||
"DEFAULT_VALUE" : "",
|
"DEFAULT_VALUE" : "",
|
||||||
"MASK_INPUT" : False,
|
"MASK_INPUT" : False,
|
||||||
"LOOSE_VALIDATION": True,
|
"LOOSE_VALIDATION": True,
|
||||||
@ -176,7 +177,7 @@ def initConfig(controllerObject):
|
|||||||
]
|
]
|
||||||
|
|
||||||
groupDict = { "GROUP_NAME" : "CINDERGLUSTERMOUNTS",
|
groupDict = { "GROUP_NAME" : "CINDERGLUSTERMOUNTS",
|
||||||
"DESCRIPTION" : "Cinder gluster mounts",
|
"DESCRIPTION" : "Cinder gluster Config parameters",
|
||||||
"PRE_CONDITION" : check_gluster_options,
|
"PRE_CONDITION" : check_gluster_options,
|
||||||
"PRE_CONDITION_MATCH" : True,
|
"PRE_CONDITION_MATCH" : True,
|
||||||
"POST_CONDITION" : False,
|
"POST_CONDITION" : False,
|
||||||
@ -184,6 +185,37 @@ def initConfig(controllerObject):
|
|||||||
|
|
||||||
controller.addGroup(groupDict, paramsList)
|
controller.addGroup(groupDict, paramsList)
|
||||||
|
|
||||||
|
def check_nfs_options(config):
|
||||||
|
return (config.get('CONFIG_CINDER_INSTALL', 'n') == 'y' and
|
||||||
|
config.get('CONFIG_CINDER_BACKEND', 'lvm') == 'nfs')
|
||||||
|
|
||||||
|
paramsList = [
|
||||||
|
{"CMD_OPTION" : "cinder-nfs-mounts",
|
||||||
|
"USAGE" : ("A single or comma seprated list of NFS exports to mount, "
|
||||||
|
"eg: ip-address:/export-name "),
|
||||||
|
"PROMPT" : ("Enter a single or comma seprated list of NFS exports to "
|
||||||
|
"use with Cinder"),
|
||||||
|
"OPTION_LIST" : ["^'([\d]{1,3}\.){3}[\d]{1,3}:/.*'"],
|
||||||
|
"VALIDATORS" : [validators.validate_multi_regexp],
|
||||||
|
"PROCESSORS" : [processors.process_add_quotes_around_values],
|
||||||
|
"DEFAULT_VALUE" : "",
|
||||||
|
"MASK_INPUT" : False,
|
||||||
|
"LOOSE_VALIDATION": True,
|
||||||
|
"CONF_NAME" : "CONFIG_CINDER_NFS_MOUNTS",
|
||||||
|
"USE_DEFAULT" : False,
|
||||||
|
"NEED_CONFIRM" : False,
|
||||||
|
"CONDITION" : False },
|
||||||
|
]
|
||||||
|
|
||||||
|
groupDict = { "GROUP_NAME" : "CINDERNFSMOUNTS",
|
||||||
|
"DESCRIPTION" : "Cinder NFS Config parameters",
|
||||||
|
"PRE_CONDITION" : check_nfs_options,
|
||||||
|
"PRE_CONDITION_MATCH" : True,
|
||||||
|
"POST_CONDITION" : False,
|
||||||
|
"POST_CONDITION_MATCH" : True}
|
||||||
|
|
||||||
|
controller.addGroup(groupDict, paramsList)
|
||||||
|
|
||||||
|
|
||||||
def initSequences(controller):
|
def initSequences(controller):
|
||||||
if controller.CONF['CONFIG_CINDER_INSTALL'] != 'y':
|
if controller.CONF['CONFIG_CINDER_INSTALL'] != 'y':
|
||||||
@ -316,5 +348,7 @@ def create_manifest(config):
|
|||||||
|
|
||||||
if controller.CONF['CONFIG_CINDER_BACKEND'] == "gluster":
|
if controller.CONF['CONFIG_CINDER_BACKEND'] == "gluster":
|
||||||
manifestdata += getManifestTemplate("cinder_gluster.pp")
|
manifestdata += getManifestTemplate("cinder_gluster.pp")
|
||||||
|
if controller.CONF['CONFIG_CINDER_BACKEND'] == "nfs":
|
||||||
|
manifestdata += getManifestTemplate("cinder_nfs.pp")
|
||||||
|
|
||||||
appendManifestFile(manifestfile, manifestdata)
|
appendManifestFile(manifestfile, manifestdata)
|
||||||
|
@ -370,6 +370,8 @@ def createcomputemanifest(config):
|
|||||||
manifestdata = getManifestTemplate("nova_compute.pp")
|
manifestdata = getManifestTemplate("nova_compute.pp")
|
||||||
if controller.CONF['CONFIG_CINDER_INSTALL'] == 'y' and controller.CONF['CONFIG_CINDER_BACKEND'] == 'gluster':
|
if controller.CONF['CONFIG_CINDER_INSTALL'] == 'y' and controller.CONF['CONFIG_CINDER_BACKEND'] == 'gluster':
|
||||||
manifestdata += getManifestTemplate("nova_gluster.pp")
|
manifestdata += getManifestTemplate("nova_gluster.pp")
|
||||||
|
if controller.CONF['CONFIG_CINDER_INSTALL'] == 'y' and controller.CONF['CONFIG_CINDER_BACKEND'] == 'nfs':
|
||||||
|
manifestdata += getManifestTemplate("nova_nfs.pp")
|
||||||
manifestfile = "%s_nova.pp"%host
|
manifestfile = "%s_nova.pp"%host
|
||||||
|
|
||||||
nova_config_options = NovaConfig()
|
nova_config_options = NovaConfig()
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package { 'glusterfs-fuse': ensure => present }
|
package { 'glusterfs-fuse': ensure => present }
|
||||||
|
|
||||||
class { 'cinder::volume::glusterfs':
|
class { 'cinder::volume::glusterfs':
|
||||||
glusterfs_shares => ['%(CONFIG_CINDER_GLUSTER_MOUNTS)s'],
|
glusterfs_shares => [%(CONFIG_CINDER_GLUSTER_MOUNTS)s],
|
||||||
require => Package['glusterfs-fuse'],
|
require => Package['glusterfs-fuse'],
|
||||||
}
|
}
|
||||||
|
6
packstack/puppet/templates/cinder_nfs.pp
Normal file
6
packstack/puppet/templates/cinder_nfs.pp
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
package { 'nfs-utils': ensure => present }
|
||||||
|
|
||||||
|
class { 'cinder::volume::nfs':
|
||||||
|
nfs_servers => [%(CONFIG_CINDER_NFS_MOUNTS)s],
|
||||||
|
require => Package['nfs-utils'],
|
||||||
|
}
|
1
packstack/puppet/templates/nova_nfs.pp
Normal file
1
packstack/puppet/templates/nova_nfs.pp
Normal file
@ -0,0 +1 @@
|
|||||||
|
package { 'nfs-utils': ensure => present }
|
Loading…
x
Reference in New Issue
Block a user