summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Malinovskiy <imalinovskiy@mirantis.com>2015-06-22 16:03:13 +0300
committerIgor Malinovskiy <imalinovskiy@mirantis.com>2015-06-22 16:03:13 +0300
commitd3d5d77ab61e0837aa0612482c9e0762999e0e0a (patch)
treede8b52bfe288a56fb9812fbb6c711d0c49923d34
parentcedb9f452791b0d70ffc7a9883e6ec483cd22652 (diff)
Use new manila-service-image with public-key auth
- Update devstack plugin - Update tempest scenario tests Implements bp reproducible-server-image Change-Id: I7c71ee2f20074e04021b5c95d8c18096d21b0404 Closes-Bug: #1421104
Notes
Notes (review): Verified+2: Jenkins Code-Review+2: Ben Swartzlander <ben@swartzlander.org> Code-Review+2: xing-yang <xing.yang@emc.com> Code-Review+2: Mark Sturdevant <mark.sturdevant@hp.com> Workflow+1: Mark Sturdevant <mark.sturdevant@hp.com> Submitted-by: Jenkins Submitted-at: Tue, 23 Jun 2015 17:06:24 +0000 Reviewed-on: https://review.openstack.org/187550 Project: openstack/manila Branch: refs/heads/master
-rwxr-xr-xcontrib/ci/pre_test_hook.sh8
-rw-r--r--contrib/tempest/tempest/config_share.py12
-rw-r--r--contrib/tempest/tempest/scenario/manager_share.py17
-rw-r--r--contrib/tempest/tempest/scenario/test_share_basic_ops.py49
-rwxr-xr-xdevstack/plugin.sh24
5 files changed, 85 insertions, 25 deletions
diff --git a/contrib/ci/pre_test_hook.sh b/contrib/ci/pre_test_hook.sh
index 88ee8dc..c5611bd 100755
--- a/contrib/ci/pre_test_hook.sh
+++ b/contrib/ci/pre_test_hook.sh
@@ -45,6 +45,14 @@ else
45 echo "MANILA_MULTI_BACKEND=False" >> $localrc_path 45 echo "MANILA_MULTI_BACKEND=False" >> $localrc_path
46fi 46fi
47 47
48# Enabling isolated metadata in Neutron is required because
49# Tempest creates isolated networks and created vm's in scenario tests don't
50# have access to Nova Metadata service. This leads to unavailability of
51# created vm's in scenario tests.
52echo '[[post-config|$Q_DHCP_CONF_FILE]]' >> $localrc_path
53echo '[DEFAULT]' >> $localrc_path
54echo "enable_isolated_metadata=True" >> $localrc_path
55
48# Go to Tempest dir and checkout stable commit to avoid possible 56# Go to Tempest dir and checkout stable commit to avoid possible
49# incompatibilities for plugin stored in Manila repo. 57# incompatibilities for plugin stored in Manila repo.
50TEMPEST_COMMIT="489f5e62" # 15 June, 2015 58TEMPEST_COMMIT="489f5e62" # 15 June, 2015
diff --git a/contrib/tempest/tempest/config_share.py b/contrib/tempest/tempest/config_share.py
index 54961a2..5d916d8 100644
--- a/contrib/tempest/tempest/config_share.py
+++ b/contrib/tempest/tempest/config_share.py
@@ -114,15 +114,17 @@ ShareGroup = [
114 "These test may leave orphaned resources, so be careful " 114 "These test may leave orphaned resources, so be careful "
115 "enabling this opt."), 115 "enabling this opt."),
116 cfg.StrOpt("image_with_share_tools", 116 cfg.StrOpt("image_with_share_tools",
117 default="ubuntu_1204_nfs_cifs", 117 default="manila-service-image",
118 help="Image name for vm booting with nfs/smb clients tool."), 118 help="Image name for vm booting with nfs/smb clients tool."),
119 cfg.StrOpt("image_username", 119 cfg.StrOpt("image_username",
120 default="ubuntu", 120 default="manila",
121 help="Image username."), 121 help="Image username."),
122 # HINT(mkoderer): workaround for bug #1421104
123 cfg.StrOpt("image_password", 122 cfg.StrOpt("image_password",
124 default="ubuntu", 123 help="Image password. Should be used for "
125 help="Image password."), 124 "'image_with_share_tools' without Nova Metadata support."),
125 cfg.StrOpt("client_vm_flavor_ref",
126 default="100",
127 help="Flavor used for client vm in scenario tests."),
126 cfg.BoolOpt("run_extend_tests", 128 cfg.BoolOpt("run_extend_tests",
127 default=True, 129 default=True,
128 help="Defines whether to run share extend tests or not." 130 help="Defines whether to run share extend tests or not."
diff --git a/contrib/tempest/tempest/scenario/manager_share.py b/contrib/tempest/tempest/scenario/manager_share.py
index 67e2419..6702fd3 100644
--- a/contrib/tempest/tempest/scenario/manager_share.py
+++ b/contrib/tempest/tempest/scenario/manager_share.py
@@ -155,8 +155,9 @@ class ShareScenarioTest(manager.NetworkScenarioTest):
155 if not CONF.share.image_with_share_tools: 155 if not CONF.share.image_with_share_tools:
156 return super(ShareScenarioTest, 156 return super(ShareScenarioTest,
157 self).get_remote_client(*args, **kwargs) 157 self).get_remote_client(*args, **kwargs)
158 # HINT(mkoderer): as workaround for bug #1421104 we have to ignore the 158 # NOTE(u_glide): We need custom implementation of this method until
159 # keypair and use the configured username and password 159 # original implementation depends on CONF.compute.ssh_auth_method
160 # option.
160 server_or_ip = kwargs['server_or_ip'] 161 server_or_ip = kwargs['server_or_ip']
161 if isinstance(server_or_ip, six.string_types): 162 if isinstance(server_or_ip, six.string_types):
162 ip = server_or_ip 163 ip = server_or_ip
@@ -164,11 +165,15 @@ class ShareScenarioTest(manager.NetworkScenarioTest):
164 addr = server_or_ip['addresses'][CONF.compute.network_for_ssh][0] 165 addr = server_or_ip['addresses'][CONF.compute.network_for_ssh][0]
165 ip = addr['addr'] 166 ip = addr['addr']
166 167
167 username = CONF.share.image_username 168 # NOTE(u_glide): Both options (pkey and password) are required here to
168 password = CONF.share.image_password 169 # support service images without Nova metadata support
170 client_params = {
171 'username': kwargs['username'],
172 'password': CONF.share.image_password,
173 'pkey': kwargs.get('private_key'),
174 }
169 175
170 linux_client = remote_client.RemoteClient(ip, username=username, 176 linux_client = remote_client.RemoteClient(ip, **client_params)
171 password=password, pkey=None)
172 try: 177 try:
173 linux_client.validate_authentication() 178 linux_client.validate_authentication()
174 except Exception: 179 except Exception:
diff --git a/contrib/tempest/tempest/scenario/test_share_basic_ops.py b/contrib/tempest/tempest/scenario/test_share_basic_ops.py
index 8280d68..35a2d8e 100644
--- a/contrib/tempest/tempest/scenario/test_share_basic_ops.py
+++ b/contrib/tempest/tempest/scenario/test_share_basic_ops.py
@@ -26,7 +26,7 @@ CONF = config.CONF
26LOG = logging.getLogger(__name__) 26LOG = logging.getLogger(__name__)
27 27
28 28
29class TestShareBasicOps(manager.ShareScenarioTest): 29class ShareBasicOpsBase(manager.ShareScenarioTest):
30 30
31 """This smoke test case follows this basic set of operations: 31 """This smoke test case follows this basic set of operations:
32 32
@@ -38,14 +38,14 @@ class TestShareBasicOps(manager.ShareScenarioTest):
38 * Mount share 38 * Mount share
39 * Terminate the instance 39 * Terminate the instance
40 """ 40 """
41 protocol = "NFS" 41 protocol = None
42 42
43 def setUp(self): 43 def setUp(self):
44 super(TestShareBasicOps, self).setUp() 44 super(ShareBasicOpsBase, self).setUp()
45 # Setup image and flavor the test instance 45 # Setup image and flavor the test instance
46 # Support both configured and injected values 46 # Support both configured and injected values
47 if not hasattr(self, 'flavor_ref'): 47 if not hasattr(self, 'flavor_ref'):
48 self.flavor_ref = CONF.compute.flavor_ref 48 self.flavor_ref = CONF.share.client_vm_flavor_ref
49 if CONF.share.image_with_share_tools: 49 if CONF.share.image_with_share_tools:
50 images = self.images_client.list_images() 50 images = self.images_client.list_images()
51 for img in images: 51 for img in images:
@@ -56,7 +56,7 @@ class TestShareBasicOps(manager.ShareScenarioTest):
56 msg = ("Image %s not found" % 56 msg = ("Image %s not found" %
57 CONF.share.image_with_share_tools) 57 CONF.share.image_with_share_tools)
58 raise exceptions.InvalidConfiguration(message=msg) 58 raise exceptions.InvalidConfiguration(message=msg)
59 self.ssh_user = CONF.compute.image_ssh_user 59 self.ssh_user = CONF.share.image_username
60 LOG.debug('Starting test for i:{image}, f:{flavor}. ' 60 LOG.debug('Starting test for i:{image}, f:{flavor}. '
61 'user: {ssh_user}'.format( 61 'user: {ssh_user}'.format(
62 image=self.image_ref, flavor=self.flavor_ref, 62 image=self.image_ref, flavor=self.flavor_ref,
@@ -73,7 +73,8 @@ class TestShareBasicOps(manager.ShareScenarioTest):
73 'security_groups': security_groups, 73 'security_groups': security_groups,
74 } 74 }
75 instance = self.create_server(image=self.image_ref, 75 instance = self.create_server(image=self.image_ref,
76 create_kwargs=create_kwargs) 76 create_kwargs=create_kwargs,
77 flavor=self.flavor_ref)
77 return instance 78 return instance
78 79
79 def init_ssh(self, instance, do_ping=False): 80 def init_ssh(self, instance, do_ping=False):
@@ -90,6 +91,10 @@ class TestShareBasicOps(manager.ShareScenarioTest):
90 server_or_ip=floating_ip['ip'], 91 server_or_ip=floating_ip['ip'],
91 username=self.ssh_user, 92 username=self.ssh_user,
92 private_key=self.keypair['private_key']) 93 private_key=self.keypair['private_key'])
94
95 # NOTE(u_glide): Workaround for bug #1465682
96 ssh_client = ssh_client.ssh_client
97
93 self.share = self.shares_client.get_share(self.share['id']) 98 self.share = self.shares_client.get_share(self.share['id'])
94 if do_ping: 99 if do_ping:
95 server_ip = self.share['export_location'].split(":")[0] 100 server_ip = self.share['export_location'].split(":")[0]
@@ -97,7 +102,7 @@ class TestShareBasicOps(manager.ShareScenarioTest):
97 return ssh_client 102 return ssh_client
98 103
99 def mount_share(self, location, ssh_client): 104 def mount_share(self, location, ssh_client):
100 ssh_client.exec_command("sudo mount \"%s\" /mnt" % location) 105 raise NotImplementedError
101 106
102 def umount_share(self, ssh_client): 107 def umount_share(self, ssh_client):
103 ssh_client.exec_command("sudo umount /mnt") 108 ssh_client.exec_command("sudo umount /mnt")
@@ -180,3 +185,33 @@ class TestShareBasicOps(manager.ShareScenarioTest):
180 ssh_client_inst2) 185 ssh_client_inst2)
181 data = self.read_data(ssh_client_inst2) 186 data = self.read_data(ssh_client_inst2)
182 self.assertEqual(test_data, data) 187 self.assertEqual(test_data, data)
188
189
190class TestShareBasicOpsNFS(ShareBasicOpsBase):
191 protocol = "NFS"
192
193 def mount_share(self, location, ssh_client):
194 ssh_client.exec_command("sudo mount \"%s\" /mnt" % location)
195
196
197class TestShareBasicOpsCIFS(ShareBasicOpsBase):
198 protocol = "CIFS"
199
200 def mount_share(self, location, ssh_client):
201 location = location.replace("\\", "/")
202 ssh_client.exec_command(
203 "sudo mount.cifs \"%s\" /mnt -o guest" % location
204 )
205
206
207# NOTE(u_glide): this function is required to exclude ShareBasicOpsBase from
208# executed test cases.
209# See: https://docs.python.org/2/library/unittest.html#load-tests-protocol
210# for details.
211def load_tests(loader, tests, _):
212 result = []
213 for test_case in tests:
214 if type(test_case._tests[0]) is ShareBasicOpsBase:
215 continue
216 result.append(test_case)
217 return loader.suiteClass(result)
diff --git a/devstack/plugin.sh b/devstack/plugin.sh
index 9e2bbc9..f9626f7 100755
--- a/devstack/plugin.sh
+++ b/devstack/plugin.sh
@@ -85,15 +85,15 @@ SHARE_DRIVER=${SHARE_DRIVER:-manila.share.drivers.generic.GenericShareDriver}
85eval USER_HOME=~ 85eval USER_HOME=~
86MANILA_PATH_TO_PUBLIC_KEY=${MANILA_PATH_TO_PUBLIC_KEY:-"$USER_HOME/.ssh/id_rsa.pub"} 86MANILA_PATH_TO_PUBLIC_KEY=${MANILA_PATH_TO_PUBLIC_KEY:-"$USER_HOME/.ssh/id_rsa.pub"}
87MANILA_PATH_TO_PRIVATE_KEY=${MANILA_PATH_TO_PRIVATE_KEY:-"$USER_HOME/.ssh/id_rsa"} 87MANILA_PATH_TO_PRIVATE_KEY=${MANILA_PATH_TO_PRIVATE_KEY:-"$USER_HOME/.ssh/id_rsa"}
88MANILA_SERVICE_KEYPAIR_NAME=${MANILA_SERVICE_KEYPAIR_NAME:-"manila-service"}
88 89
89MANILA_SERVICE_INSTANCE_USER=${MANILA_SERVICE_INSTANCE_USER:-"ubuntu"} 90MANILA_SERVICE_INSTANCE_USER=${MANILA_SERVICE_INSTANCE_USER:-"manila"}
90MANILA_SERVICE_INSTANCE_PASSWORD=${MANILA_SERVICE_INSTANCE_PASSWORD:-"ubuntu"} 91MANILA_SERVICE_IMAGE_URL=${MANILA_SERVICE_IMAGE_URL:-"https://github.com/uglide/manila-image-elements/releases/download/0.1.0/manila-service-image.qcow2"}
91MANILA_SERVICE_IMAGE_URL=${MANILA_SERVICE_IMAGE_URL:-"https://www.dropbox.com/s/vi5oeh10q1qkckh/ubuntu_1204_nfs_cifs.qcow2"} 92MANILA_SERVICE_IMAGE_NAME=${MANILA_SERVICE_IMAGE_NAME:-"manila-service-image"}
92MANILA_SERVICE_IMAGE_NAME=${MANILA_SERVICE_IMAGE_NAME:-"ubuntu_1204_nfs_cifs"}
93 93
94MANILA_SERVICE_VM_FLAVOR_REF=${MANILA_SERVICE_VM_FLAVOR_REF:-100} 94MANILA_SERVICE_VM_FLAVOR_REF=${MANILA_SERVICE_VM_FLAVOR_REF:-100}
95MANILA_SERVICE_VM_FLAVOR_NAME=${MANILA_SERVICE_VM_FLAVOR_NAME:-"manila-service-flavor"} 95MANILA_SERVICE_VM_FLAVOR_NAME=${MANILA_SERVICE_VM_FLAVOR_NAME:-"manila-service-flavor"}
96MANILA_SERVICE_VM_FLAVOR_RAM=${MANILA_SERVICE_VM_FLAVOR_RAM:-64} 96MANILA_SERVICE_VM_FLAVOR_RAM=${MANILA_SERVICE_VM_FLAVOR_RAM:-128}
97MANILA_SERVICE_VM_FLAVOR_DISK=${MANILA_SERVICE_VM_FLAVOR_DISK:-0} 97MANILA_SERVICE_VM_FLAVOR_DISK=${MANILA_SERVICE_VM_FLAVOR_DISK:-0}
98MANILA_SERVICE_VM_FLAVOR_VCPUS=${MANILA_SERVICE_VM_FLAVOR_VCPUS:-1} 98MANILA_SERVICE_VM_FLAVOR_VCPUS=${MANILA_SERVICE_VM_FLAVOR_VCPUS:-1}
99 99
@@ -141,7 +141,6 @@ function configure_default_backends {
141 iniset $MANILA_CONF $group_name path_to_private_key $MANILA_PATH_TO_PRIVATE_KEY 141 iniset $MANILA_CONF $group_name path_to_private_key $MANILA_PATH_TO_PRIVATE_KEY
142 iniset $MANILA_CONF $group_name service_image_name $MANILA_SERVICE_IMAGE_NAME 142 iniset $MANILA_CONF $group_name service_image_name $MANILA_SERVICE_IMAGE_NAME
143 iniset $MANILA_CONF $group_name service_instance_user $MANILA_SERVICE_INSTANCE_USER 143 iniset $MANILA_CONF $group_name service_instance_user $MANILA_SERVICE_INSTANCE_USER
144 iniset $MANILA_CONF $group_name service_instance_password $MANILA_SERVICE_INSTANCE_PASSWORD
145 iniset $MANILA_CONF $group_name driver_handles_share_servers True 144 iniset $MANILA_CONF $group_name driver_handles_share_servers True
146 done 145 done
147} 146}
@@ -273,6 +272,8 @@ function configure_manila {
273 ssh-keygen -N "" -t rsa -f $MANILA_PATH_TO_PRIVATE_KEY; 272 ssh-keygen -N "" -t rsa -f $MANILA_PATH_TO_PRIVATE_KEY;
274 fi 273 fi
275 274
275 iniset $MANILA_CONF DEFAULT manila_service_keypair_name $MANILA_SERVICE_KEYPAIR_NAME
276
276 if is_service_enabled tls-proxy; then 277 if is_service_enabled tls-proxy; then
277 # Set the service port for a proxy to take the original 278 # Set the service port for a proxy to take the original
278 iniset $MANILA_CONF DEFAULT osapi_share_listen_port $MANILA_SERVICE_PORT_INT 279 iniset $MANILA_CONF DEFAULT osapi_share_listen_port $MANILA_SERVICE_PORT_INT
@@ -315,6 +316,11 @@ function configure_manila_ui {
315} 316}
316 317
317 318
319function create_manila_service_keypair {
320 openstack keypair create $MANILA_SERVICE_KEYPAIR_NAME --public-key $MANILA_PATH_TO_PUBLIC_KEY
321}
322
323
318# create_service_share_servers - creates service Nova VMs, one per generic 324# create_service_share_servers - creates service Nova VMs, one per generic
319# driver, and only if it is configured to mode without handling of share servers. 325# driver, and only if it is configured to mode without handling of share servers.
320function create_service_share_servers { 326function create_service_share_servers {
@@ -329,7 +335,8 @@ function create_service_share_servers {
329 --flavor $MANILA_SERVICE_VM_FLAVOR_NAME \ 335 --flavor $MANILA_SERVICE_VM_FLAVOR_NAME \
330 --image $MANILA_SERVICE_IMAGE_NAME \ 336 --image $MANILA_SERVICE_IMAGE_NAME \
331 --nic net-id=$private_net_id \ 337 --nic net-id=$private_net_id \
332 --security-groups $MANILA_SERVICE_SECGROUP 338 --security-groups $MANILA_SERVICE_SECGROUP \
339 --key-name $MANILA_SERVICE_KEYPAIR_NAME
333 340
334 vm_id=$(nova show $vm_name | grep ' id ' | get_field 2) 341 vm_id=$(nova show $vm_name | grep ' id ' | get_field 2)
335 342
@@ -527,6 +534,9 @@ elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
527 echo_summary "Creating Manila service image" 534 echo_summary "Creating Manila service image"
528 create_manila_service_image 535 create_manila_service_image
529 536
537 echo_summary "Creating Manila service keypair"
538 create_manila_service_keypair
539
530 echo_summary "Creating Manila service VMs for generic driver \ 540 echo_summary "Creating Manila service VMs for generic driver \
531 backends for which handlng of share servers is disabled." 541 backends for which handlng of share servers is disabled."
532 create_service_share_servers 542 create_service_share_servers