summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-09-22 13:27:59 +0000
committerGerrit Code Review <review@openstack.org>2015-09-22 13:27:59 +0000
commit929ab21ae71dd4a23d087a9a3ac162ada8242831 (patch)
tree492cc261d2709eba1ed80cbc197e95a1a61555cd
parentec1d7878858076c58001343a5127e96879fde04f (diff)
parent42f6a55c0a81cdc2b35bc48b452143e9a7a8bd20 (diff)
Merge "glusterfs*: fix ssh credential options"1.0.0.0rc1
-rw-r--r--manila/opts.py2
-rw-r--r--manila/share/drivers/glusterfs/common.py21
-rw-r--r--manila/share/drivers/glusterfs/layout_directory.py11
-rw-r--r--manila/share/drivers/glusterfs/layout_volume.py16
-rw-r--r--manila/tests/share/drivers/glusterfs/test_layout_volume.py8
5 files changed, 33 insertions, 25 deletions
diff --git a/manila/opts.py b/manila/opts.py
index c07a5f3..3c848b5 100644
--- a/manila/opts.py
+++ b/manila/opts.py
@@ -54,6 +54,7 @@ import manila.share.drivers.emc.driver
54import manila.share.drivers.emc.plugins.isilon.isilon 54import manila.share.drivers.emc.plugins.isilon.isilon
55import manila.share.drivers.generic 55import manila.share.drivers.generic
56import manila.share.drivers.glusterfs 56import manila.share.drivers.glusterfs
57import manila.share.drivers.glusterfs.common
57import manila.share.drivers.glusterfs.layout 58import manila.share.drivers.glusterfs.layout
58import manila.share.drivers.glusterfs.layout_directory 59import manila.share.drivers.glusterfs.layout_directory
59import manila.share.drivers.glusterfs.layout_volume 60import manila.share.drivers.glusterfs.layout_volume
@@ -112,6 +113,7 @@ _global_opt_lists = [
112 manila.share.drivers_private_data.private_data_opts, 113 manila.share.drivers_private_data.private_data_opts,
113 manila.share.drivers.emc.driver.EMC_NAS_OPTS, 114 manila.share.drivers.emc.driver.EMC_NAS_OPTS,
114 manila.share.drivers.generic.share_opts, 115 manila.share.drivers.generic.share_opts,
116 manila.share.drivers.glusterfs.common.glusterfs_common_opts,
115 manila.share.drivers.glusterfs.GlusterfsManilaShare_opts, 117 manila.share.drivers.glusterfs.GlusterfsManilaShare_opts,
116 manila.share.drivers.glusterfs.layout.glusterfs_share_layout_opts, 118 manila.share.drivers.glusterfs.layout.glusterfs_share_layout_opts,
117 manila.share.drivers.glusterfs.layout_directory. 119 manila.share.drivers.glusterfs.layout_directory.
diff --git a/manila/share/drivers/glusterfs/common.py b/manila/share/drivers/glusterfs/common.py
index 9044006..8882822 100644
--- a/manila/share/drivers/glusterfs/common.py
+++ b/manila/share/drivers/glusterfs/common.py
@@ -19,6 +19,7 @@
19import re 19import re
20import xml.etree.cElementTree as etree 20import xml.etree.cElementTree as etree
21 21
22from oslo_config import cfg
22from oslo_log import log 23from oslo_log import log
23import six 24import six
24 25
@@ -31,6 +32,26 @@ from manila.share.drivers.ganesha import utils as ganesha_utils
31LOG = log.getLogger(__name__) 32LOG = log.getLogger(__name__)
32 33
33 34
35glusterfs_common_opts = [
36 cfg.StrOpt('glusterfs_server_password',
37 default=None,
38 secret=True,
39 deprecated_name='glusterfs_native_server_password',
40 help='Remote GlusterFS server node\'s login password. '
41 'This is not required if '
42 '\'glusterfs_path_to_private_key\' is '
43 'configured.'),
44 cfg.StrOpt('glusterfs_path_to_private_key',
45 default=None,
46 deprecated_name='glusterfs_native_path_to_private_key',
47 help='Path of Manila host\'s private SSH key file.'),
48]
49
50
51CONF = cfg.CONF
52CONF.register_opts(glusterfs_common_opts)
53
54
34class GlusterManager(object): 55class GlusterManager(object):
35 """Interface with a GlusterFS volume.""" 56 """Interface with a GlusterFS volume."""
36 57
diff --git a/manila/share/drivers/glusterfs/layout_directory.py b/manila/share/drivers/glusterfs/layout_directory.py
index cbdab3f..5936eb6 100644
--- a/manila/share/drivers/glusterfs/layout_directory.py
+++ b/manila/share/drivers/glusterfs/layout_directory.py
@@ -38,15 +38,6 @@ glusterfs_directory_mapped_opts = [
38 default='$state_path/mnt', 38 default='$state_path/mnt',
39 help='Base directory containing mount points for Gluster ' 39 help='Base directory containing mount points for Gluster '
40 'volumes.'), 40 'volumes.'),
41 cfg.StrOpt('glusterfs_server_password',
42 default=None,
43 secret=True,
44 help="Remote GlusterFS server node's login password. "
45 "This is not required if 'glusterfs_path_to_private_key'"
46 ' is configured.'),
47 cfg.StrOpt('glusterfs_path_to_private_key',
48 default=None,
49 help='Path of Manila host\'s private SSH key file.'),
50] 41]
51 42
52CONF = cfg.CONF 43CONF = cfg.CONF
@@ -59,6 +50,8 @@ class GlusterfsDirectoryMappedLayout(layout.GlusterfsShareLayoutBase):
59 super(GlusterfsDirectoryMappedLayout, self).__init__( 50 super(GlusterfsDirectoryMappedLayout, self).__init__(
60 driver, *args, **kwargs) 51 driver, *args, **kwargs)
61 self.configuration.append_config_values( 52 self.configuration.append_config_values(
53 common.glusterfs_common_opts)
54 self.configuration.append_config_values(
62 glusterfs_directory_mapped_opts) 55 glusterfs_directory_mapped_opts)
63 56
64 def _glustermanager(self, gluster_address): 57 def _glustermanager(self, gluster_address):
diff --git a/manila/share/drivers/glusterfs/layout_volume.py b/manila/share/drivers/glusterfs/layout_volume.py
index 5bd6cf7..ec494f2 100644
--- a/manila/share/drivers/glusterfs/layout_volume.py
+++ b/manila/share/drivers/glusterfs/layout_volume.py
@@ -47,16 +47,6 @@ glusterfs_volume_mapped_opts = [
47 'shares. Each GlusterFS server should be of the form ' 47 'shares. Each GlusterFS server should be of the form '
48 '[remoteuser@]<volserver>, and they are assumed to ' 48 '[remoteuser@]<volserver>, and they are assumed to '
49 'belong to distinct Gluster clusters.'), 49 'belong to distinct Gluster clusters.'),
50 cfg.StrOpt('glusterfs_native_server_password',
51 default=None,
52 secret=True,
53 help='Remote GlusterFS server node\'s login password. '
54 'This is not required if '
55 '\'glusterfs_native_path_to_private_key\' is '
56 'configured.'),
57 cfg.StrOpt('glusterfs_native_path_to_private_key',
58 default=None,
59 help='Path of Manila host\'s private SSH key file.'),
60 cfg.StrOpt('glusterfs_volume_pattern', 50 cfg.StrOpt('glusterfs_volume_pattern',
61 default=None, 51 default=None,
62 help='Regular expression template used to filter ' 52 help='Regular expression template used to filter '
@@ -98,6 +88,8 @@ class GlusterfsVolumeMappedLayout(layout.GlusterfsShareLayoutBase):
98 driver, *args, **kwargs) 88 driver, *args, **kwargs)
99 self.gluster_used_vols = set() 89 self.gluster_used_vols = set()
100 self.configuration.append_config_values( 90 self.configuration.append_config_values(
91 common.glusterfs_common_opts)
92 self.configuration.append_config_values(
101 glusterfs_volume_mapped_opts) 93 glusterfs_volume_mapped_opts)
102 self.gluster_nosnap_vols_dict = {} 94 self.gluster_nosnap_vols_dict = {}
103 self.volume_pattern = self._compile_volume_pattern() 95 self.volume_pattern = self._compile_volume_pattern()
@@ -186,8 +178,8 @@ class GlusterfsVolumeMappedLayout(layout.GlusterfsShareLayoutBase):
186 178
187 return common.GlusterManager( 179 return common.GlusterManager(
188 gluster_address, self.driver._execute, 180 gluster_address, self.driver._execute,
189 self.configuration.glusterfs_native_path_to_private_key, 181 self.configuration.glusterfs_path_to_private_key,
190 self.configuration.glusterfs_native_server_password, 182 self.configuration.glusterfs_server_password,
191 requires={'volume': req_volume}) 183 requires={'volume': req_volume})
192 184
193 def _share_manager(self, share): 185 def _share_manager(self, share):
diff --git a/manila/tests/share/drivers/glusterfs/test_layout_volume.py b/manila/tests/share/drivers/glusterfs/test_layout_volume.py
index db3655f..f83b307 100644
--- a/manila/tests/share/drivers/glusterfs/test_layout_volume.py
+++ b/manila/tests/share/drivers/glusterfs/test_layout_volume.py
@@ -96,9 +96,9 @@ class GlusterfsVolumeMappedLayoutTestCase(test.TestCase):
96 96
97 CONF.set_default('glusterfs_servers', 97 CONF.set_default('glusterfs_servers',
98 [self.glusterfs_server1, self.glusterfs_server2]) 98 [self.glusterfs_server1, self.glusterfs_server2])
99 CONF.set_default('glusterfs_native_server_password', 99 CONF.set_default('glusterfs_server_password',
100 'fake_password') 100 'fake_password')
101 CONF.set_default('glusterfs_native_path_to_private_key', 101 CONF.set_default('glusterfs_path_to_private_key',
102 '/fakepath/to/privatekey') 102 '/fakepath/to/privatekey')
103 CONF.set_default('glusterfs_volume_pattern', 103 CONF.set_default('glusterfs_volume_pattern',
104 'manila-share-\d+-#{size}G$') 104 'manila-share-\d+-#{size}G$')
@@ -141,8 +141,8 @@ class GlusterfsVolumeMappedLayoutTestCase(test.TestCase):
141 141
142 common.GlusterManager.assert_called_once_with( 142 common.GlusterManager.assert_called_once_with(
143 self.glusterfs_target1, self._execute, 143 self.glusterfs_target1, self._execute,
144 self._layout.configuration.glusterfs_native_path_to_private_key, 144 self._layout.configuration.glusterfs_path_to_private_key,
145 self._layout.configuration.glusterfs_native_server_password, 145 self._layout.configuration.glusterfs_server_password,
146 requires=requires) 146 requires=requires)
147 self.assertEqual(fake_obj, ret) 147 self.assertEqual(fake_obj, ret)
148 148