From a523910f8b22cf8e5669820c2231bb32bfdc8ee8 Mon Sep 17 00:00:00 2001 From: Sachidananda Urs Date: Tue, 19 May 2015 16:53:30 +0530 Subject: [PATCH] Integrate GlusterFS drivers with manila module. Currently GlusterFS (FUSE, NFS, and NFS Ganesha) drivers have to be configured manually by adding entries in manila.conf. This patch installs and configures GlusterFS drivers, uses puppet-manila module for installation and configuration. Closes-Bug: #1460940 Change-Id: I982947902d96bb1165d9e4c0dab773a84a805c4d --- docs/packstack.rst | 31 ++++- packstack/plugins/manila_255.py | 127 +++++++++++++++++- .../puppet/templates/manila_glusternative.pp | 8 ++ .../puppet/templates/manila_glusternfs.pp | 13 ++ 4 files changed, 177 insertions(+), 2 deletions(-) create mode 100644 packstack/puppet/templates/manila_glusternative.pp create mode 100644 packstack/puppet/templates/manila_glusternfs.pp diff --git a/docs/packstack.rst b/docs/packstack.rst index 31cd2f4bd..4793eba35 100644 --- a/docs/packstack.rst +++ b/docs/packstack.rst @@ -590,7 +590,7 @@ Manila Config parameters Password to use for the OpenStack File Share service (manila) to authenticate with the Identity service. **CONFIG_MANILA_BACKEND** - Backend for the OpenStack File Share service (manila); valid options are: generic or netapp. ['generic', 'netapp'] + Backend for the OpenStack File Share service (manila); valid options are: generic, netapp, glusternative, or glusternfs. ['generic', 'netapp', 'glusternative', 'glusternfs'] Manila NetApp configuration --------------------------- @@ -1057,6 +1057,35 @@ If we need a answer file to tailor it and then debug: packstack --gen-answer-file=ans.txt packstack -d --answer-file=ans.txt +Glusterfs Native (FUSE) configuration info +------------------------------------------ + +**CONFIG_MANILA_GLUSTERFS_SERVERS** + List of GlusterFS servers that can be used to create shares. Each GlusterFS server should be of the form [remoteuser@], and they are assumed to belong to distinct Gluster clusters. + +**CONFIG_MANILA_GLUSTERFS_NATIVE_PATH_TO_PRIVATE_KEY** + Path of Manila host's private SSH key file. + +**CONFIG_MANILA_GLUSTERFS_VOLUME_PATTERN** + Regular expression template used to filter GlusterFS volumes for share creation. The regex template can optionally (ie. with support of the GlusterFS backend) contain the #{size} parameter which matches an integer (sequence of digits) in which case the value shall be intepreted as size of the volume in GB. Examples: "manila-share-volume-\d+$", "manila-share-volume-#{size}G-\d+$"; with matching volume names, respectively: "manila-share-volume-12", "manila-share-volume-3G-13". In latter example, the number that matches "#{size}", that is, 3, is an indication that the size of volume is 3G. + +GlusterNFS configuration info +----------------------------- + +**CONFIG_MANILA_GLUSTERFS_TARGET** + Specifies the GlusterFS volume to be mounted on the Manila host. For e.g: [remoteuser@]:/ + +**CONFIG_MANILA_GLUSTERFS_MOUNT_POINT_BASE** + Base directory containing mount points for Gluster volumes. + +**CONFIG_MANILA_GLUSTERFS_NFS_SERVER_TYPE** + Type of NFS server that mediate access to the Gluster volumes (Gluster or Ganesha). + +**CONFIG_MANILA_GLUSTERFS_PATH_TO_PRIVATE_KEY** + Path of Manila host's private SSH key file. + +**CONFIG_MANILA_GLUSTERFS_GANESHA_SERVER_IP** + Remote Ganesha server node's IP address. SOURCE ====== diff --git a/packstack/plugins/manila_255.py b/packstack/plugins/manila_255.py index 19acf70c6..1fa4ded08 100644 --- a/packstack/plugins/manila_255.py +++ b/packstack/plugins/manila_255.py @@ -65,7 +65,8 @@ def initConfig(controller): {"CMD_OPTION": "manila-backend", "PROMPT": "Enter the Manila backend to be configured", - "OPTION_LIST": ["generic", "netapp"], + "OPTION_LIST": ["generic", "netapp", "glusternative", + "glusternfs"], "VALIDATORS": [validators.validate_options], "DEFAULT_VALUE": "generic", "MASK_INPUT": False, @@ -372,6 +373,106 @@ def initConfig(controller): "NEED_CONFIRM": False, "CONDITION": False}, ], + + "MANILAGLUSTERNATIVE": [ + {"CMD_OPTION": "glusterfs-servers", + "PROMPT": ("Enter GlusterFS servers"), + "OPTION_LIST": [], + "VALIDATORS": [validators.validate_not_empty], + "DEFAULT_VALUE": "", + "MASK_INPUT": False, + "LOOSE_VALIDATION": False, + "CONF_NAME": "CONFIG_MANILA_GLUSTERFS_SERVERS", + "USE_DEFAULT": False, + "NEED_CONFIRM": False, + "CONDITION": False}, + + {"CMD_OPTION": "glusterfs-native-path-to-private_key", + "PROMPT": ("Enter path to the GlusterFS private key"), + "OPTION_LIST": [], + "VALIDATORS": [], + "DEFAULT_VALUE": "", + "MASK_INPUT": True, + "LOOSE_VALIDATION": False, + "CONF_NAME": "CONFIG_MANILA_GLUSTERFS_NATIVE_PATH_TO_PRIVATE_KEY", + "USE_DEFAULT": False, + "NEED_CONFIRM": False, + "CONDITION": False}, + + {"CMD_OPTION": "glusterfs-volume-pattern", + "PROMPT": ("Enter volume pattern for GlusterFS"), + "OPTION_LIST": [], + "VALIDATORS": [], + "DEFAULT_VALUE": "", + "MASK_INPUT": False, + "LOOSE_VALIDATION": False, + "CONF_NAME": "CONFIG_MANILA_GLUSTERFS_VOLUME_PATTERN", + "USE_DEFAULT": False, + "NEED_CONFIRM": False, + "CONDITION": False}, + ], + + "MANILAGLUSTERNFS": [ + {"CMD_OPTION": "glusterfs-target", + "PROMPT": ("Enter GlusterFS target"), + "OPTION_LIST": [], + "VALIDATORS": [validators.validate_not_empty], + "DEFAULT_VALUE": "", + "MASK_INPUT": False, + "LOOSE_VALIDATION": False, + "CONF_NAME": "CONFIG_MANILA_GLUSTERFS_TARGET", + "USE_DEFAULT": False, + "NEED_CONFIRM": False, + "CONDITION": False}, + + {"CMD_OPTION": "glusterfs-mount-point-base", + "PROMPT": ("Enter a mount point for GlusterFS mount"), + "OPTION_LIST": [], + "VALIDATORS": [], + "DEFAULT_VALUE": "", + "MASK_INPUT": False, + "LOOSE_VALIDATION": False, + "CONF_NAME": "CONFIG_MANILA_GLUSTERFS_MOUNT_POINT_BASE", + "USE_DEFAULT": False, + "NEED_CONFIRM": False, + "CONDITION": False}, + + {"CMD_OPTION": "glusterfs-nfs-server-type", + "PROMPT": ("Enter NFS server type (gluster/ganesha)"), + "OPTION_LIST": ['gluster', 'ganesha'], + "VALIDATORS": [validators.validate_options], + "DEFAULT_VALUE": "gluster", + "MASK_INPUT": False, + "LOOSE_VALIDATION": False, + "CONF_NAME": "CONFIG_MANILA_GLUSTERFS_NFS_SERVER_TYPE", + "USE_DEFAULT": False, + "NEED_CONFIRM": False, + "CONDITION": False}, + + {"CMD_OPTION": "glusterfs-path-to-private-key", + "PROMPT": ("Enter path to GlusterFS server private key"), + "OPTION_LIST": [], + "VALIDATORS": [], + "DEFAULT_VALUE": "", + "MASK_INPUT": False, + "LOOSE_VALIDATION": False, + "CONF_NAME": "CONFIG_MANILA_GLUSTERFS_PATH_TO_PRIVATE_KEY", + "USE_DEFAULT": False, + "NEED_CONFIRM": False, + "CONDITION": False}, + + {"CMD_OPTION": "glusterfs-ganesha-server-ip", + "PROMPT": ("Enter ip address of GlusterFS ganesha server"), + "OPTION_LIST": [], + "VALIDATORS": [], + "DEFAULT_VALUE": "", + "MASK_INPUT": False, + "LOOSE_VALIDATION": False, + "CONF_NAME": "CONFIG_MANILA_GLUSTERFS_GANESHA_SERVER_IP", + "USE_DEFAULT": False, + "NEED_CONFIRM": False, + "CONDITION": False}, + ], } update_params_usage(basedefs.PACKSTACK_DOC, conf_params) conf_groups = [ @@ -423,6 +524,20 @@ def initConfig(controller): "PRE_CONDITION_MATCH": True, "POST_CONDITION": False, "POST_CONDITION_MATCH": True}, + + {"GROUP_NAME": "MANILAGLUSTERNATIVE", + "DESCRIPTION": "Manila GlusterFS native configuration", + "PRE_CONDITION": check_glusternative_options, + "PRE_CONDITION_MATCH": True, + "POST_CONDITION": False, + "POST_CONDITION_MATCH": True}, + + {"GROUP_NAME": "MANILAGLUSTERNFS", + "DESCRIPTION": "Manila GlusterNFS configuration", + "PRE_CONDITION": check_glusternfs_options, + "PRE_CONDITION_MATCH": True, + "POST_CONDITION": False, + "POST_CONDITION_MATCH": True}, ] for group in conf_groups: params = conf_params[group["GROUP_NAME"]] @@ -477,6 +592,16 @@ def check_network_standalone_options(config): config['CONFIG_MANILA_NETWORK_TYPE'] == 'standalone') +def check_glusternative_options(config): + return (config['CONFIG_MANILA_INSTALL'] == 'y' and + 'glusternative' in config['CONFIG_MANILA_BACKEND']) + + +def check_glusternfs_options(config): + return (config['CONFIG_MANILA_INSTALL'] == 'y' and + 'glusternfs' in config['CONFIG_MANILA_BACKEND']) + + # -------------------------- step functions -------------------------- def create_keystone_manifest(config, messages): diff --git a/packstack/puppet/templates/manila_glusternative.pp b/packstack/puppet/templates/manila_glusternative.pp new file mode 100644 index 000000000..47e144bf1 --- /dev/null +++ b/packstack/puppet/templates/manila_glusternative.pp @@ -0,0 +1,8 @@ + +manila::backend::glusternative{ 'glusternative': + glusterfs_servers => hiera('CONFIG_MANILA_GLUSTERFS_SERVERS'), + glusterfs_native_path_to_private_key => hiera('CONFIG_MANILA_GLUSTERFS_NATIVE_PATH_TO_PRIVATE_KEY'), + glusterfs_volume_pattern => hiera('CONFIG_MANILA_GLUSTERFS_VOLUME_PATTERN'), +} + +packstack::manila::network{ 'glusternative': } diff --git a/packstack/puppet/templates/manila_glusternfs.pp b/packstack/puppet/templates/manila_glusternfs.pp new file mode 100644 index 000000000..0341a39e0 --- /dev/null +++ b/packstack/puppet/templates/manila_glusternfs.pp @@ -0,0 +1,13 @@ + +manila::backend::glusternfs{ 'glusternfs': + glusterfs_target => hiera('CONFIG_MANILA_GLUSTERFS_TARGET'), + glusterfs_mount_point_base => hiera('CONFIG_MANILA_GLUSTERFS_MOUNT_POINT_BASE'), + glusterfs_nfs_server_type => hiera('CONFIG_MANILA_GLUSTERFS_NFS_SERVER_TYPE'), + glusterfs_path_to_private_key => hiera('CONFIG_MANILA_GLUSTERFS_PATH_TO_PRIVATE_KEY'), + glusterfs_ganesha_server_ip => hiera('CONFIG_MANILA_GLUSTERFS_GANESHA_SERVER_IP'), +} + +packstack::manila::network{ 'glusternfs': } + +class { '::manila::ganesha': +}