Merge "glusterfs*: fix ssh credential options"

This commit is contained in:
Jenkins 2015-09-22 13:27:59 +00:00 committed by Gerrit Code Review
commit 929ab21ae7
5 changed files with 33 additions and 25 deletions

View File

@ -54,6 +54,7 @@ import manila.share.drivers.emc.driver
import manila.share.drivers.emc.plugins.isilon.isilon
import manila.share.drivers.generic
import manila.share.drivers.glusterfs
import manila.share.drivers.glusterfs.common
import manila.share.drivers.glusterfs.layout
import manila.share.drivers.glusterfs.layout_directory
import manila.share.drivers.glusterfs.layout_volume
@ -112,6 +113,7 @@ _global_opt_lists = [
manila.share.drivers_private_data.private_data_opts,
manila.share.drivers.emc.driver.EMC_NAS_OPTS,
manila.share.drivers.generic.share_opts,
manila.share.drivers.glusterfs.common.glusterfs_common_opts,
manila.share.drivers.glusterfs.GlusterfsManilaShare_opts,
manila.share.drivers.glusterfs.layout.glusterfs_share_layout_opts,
manila.share.drivers.glusterfs.layout_directory.

View File

@ -19,6 +19,7 @@
import re
import xml.etree.cElementTree as etree
from oslo_config import cfg
from oslo_log import log
import six
@ -31,6 +32,26 @@ from manila.share.drivers.ganesha import utils as ganesha_utils
LOG = log.getLogger(__name__)
glusterfs_common_opts = [
cfg.StrOpt('glusterfs_server_password',
default=None,
secret=True,
deprecated_name='glusterfs_native_server_password',
help='Remote GlusterFS server node\'s login password. '
'This is not required if '
'\'glusterfs_path_to_private_key\' is '
'configured.'),
cfg.StrOpt('glusterfs_path_to_private_key',
default=None,
deprecated_name='glusterfs_native_path_to_private_key',
help='Path of Manila host\'s private SSH key file.'),
]
CONF = cfg.CONF
CONF.register_opts(glusterfs_common_opts)
class GlusterManager(object):
"""Interface with a GlusterFS volume."""

View File

@ -38,15 +38,6 @@ glusterfs_directory_mapped_opts = [
default='$state_path/mnt',
help='Base directory containing mount points for Gluster '
'volumes.'),
cfg.StrOpt('glusterfs_server_password',
default=None,
secret=True,
help="Remote GlusterFS server node's login password. "
"This is not required if 'glusterfs_path_to_private_key'"
' is configured.'),
cfg.StrOpt('glusterfs_path_to_private_key',
default=None,
help='Path of Manila host\'s private SSH key file.'),
]
CONF = cfg.CONF
@ -58,6 +49,8 @@ class GlusterfsDirectoryMappedLayout(layout.GlusterfsShareLayoutBase):
def __init__(self, driver, *args, **kwargs):
super(GlusterfsDirectoryMappedLayout, self).__init__(
driver, *args, **kwargs)
self.configuration.append_config_values(
common.glusterfs_common_opts)
self.configuration.append_config_values(
glusterfs_directory_mapped_opts)

View File

@ -47,16 +47,6 @@ glusterfs_volume_mapped_opts = [
'shares. Each GlusterFS server should be of the form '
'[remoteuser@]<volserver>, and they are assumed to '
'belong to distinct Gluster clusters.'),
cfg.StrOpt('glusterfs_native_server_password',
default=None,
secret=True,
help='Remote GlusterFS server node\'s login password. '
'This is not required if '
'\'glusterfs_native_path_to_private_key\' is '
'configured.'),
cfg.StrOpt('glusterfs_native_path_to_private_key',
default=None,
help='Path of Manila host\'s private SSH key file.'),
cfg.StrOpt('glusterfs_volume_pattern',
default=None,
help='Regular expression template used to filter '
@ -97,6 +87,8 @@ class GlusterfsVolumeMappedLayout(layout.GlusterfsShareLayoutBase):
super(GlusterfsVolumeMappedLayout, self).__init__(
driver, *args, **kwargs)
self.gluster_used_vols = set()
self.configuration.append_config_values(
common.glusterfs_common_opts)
self.configuration.append_config_values(
glusterfs_volume_mapped_opts)
self.gluster_nosnap_vols_dict = {}
@ -186,8 +178,8 @@ class GlusterfsVolumeMappedLayout(layout.GlusterfsShareLayoutBase):
return common.GlusterManager(
gluster_address, self.driver._execute,
self.configuration.glusterfs_native_path_to_private_key,
self.configuration.glusterfs_native_server_password,
self.configuration.glusterfs_path_to_private_key,
self.configuration.glusterfs_server_password,
requires={'volume': req_volume})
def _share_manager(self, share):

View File

@ -96,9 +96,9 @@ class GlusterfsVolumeMappedLayoutTestCase(test.TestCase):
CONF.set_default('glusterfs_servers',
[self.glusterfs_server1, self.glusterfs_server2])
CONF.set_default('glusterfs_native_server_password',
CONF.set_default('glusterfs_server_password',
'fake_password')
CONF.set_default('glusterfs_native_path_to_private_key',
CONF.set_default('glusterfs_path_to_private_key',
'/fakepath/to/privatekey')
CONF.set_default('glusterfs_volume_pattern',
'manila-share-\d+-#{size}G$')
@ -141,8 +141,8 @@ class GlusterfsVolumeMappedLayoutTestCase(test.TestCase):
common.GlusterManager.assert_called_once_with(
self.glusterfs_target1, self._execute,
self._layout.configuration.glusterfs_native_path_to_private_key,
self._layout.configuration.glusterfs_native_server_password,
self._layout.configuration.glusterfs_path_to_private_key,
self._layout.configuration.glusterfs_server_password,
requires=requires)
self.assertEqual(fake_obj, ret)