Browse Source

Merge "Use new manila-service-image with public-key auth"

tags/1.0.0.0b1
Jenkins 3 years ago
parent
commit
7d16c9431d

+ 8
- 0
contrib/ci/pre_test_hook.sh View File

@@ -45,6 +45,14 @@ else
45 45
     echo "MANILA_MULTI_BACKEND=False" >> $localrc_path
46 46
 fi
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.
52
+echo '[[post-config|$Q_DHCP_CONF_FILE]]' >> $localrc_path
53
+echo '[DEFAULT]' >> $localrc_path
54
+echo "enable_isolated_metadata=True" >> $localrc_path
55
+
48 56
 # Go to Tempest dir and checkout stable commit to avoid possible
49 57
 # incompatibilities for plugin stored in Manila repo.
50 58
 TEMPEST_COMMIT="489f5e62"  # 15 June, 2015

+ 7
- 5
contrib/tempest/tempest/config_share.py View File

@@ -114,15 +114,17 @@ ShareGroup = [
114 114
                      "These test may leave orphaned resources, so be careful "
115 115
                      "enabling this opt."),
116 116
     cfg.StrOpt("image_with_share_tools",
117
-               default="ubuntu_1204_nfs_cifs",
117
+               default="manila-service-image",
118 118
                help="Image name for vm booting with nfs/smb clients tool."),
119 119
     cfg.StrOpt("image_username",
120
-               default="ubuntu",
120
+               default="manila",
121 121
                help="Image username."),
122
-    # HINT(mkoderer): workaround for bug #1421104
123 122
     cfg.StrOpt("image_password",
124
-               default="ubuntu",
125
-               help="Image password."),
123
+               help="Image password. Should be used for "
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 128
     cfg.BoolOpt("run_extend_tests",
127 129
                 default=True,
128 130
                 help="Defines whether to run share extend tests or not."

+ 11
- 6
contrib/tempest/tempest/scenario/manager_share.py View File

@@ -155,8 +155,9 @@ class ShareScenarioTest(manager.NetworkScenarioTest):
155 155
         if not CONF.share.image_with_share_tools:
156 156
             return super(ShareScenarioTest,
157 157
                          self).get_remote_client(*args, **kwargs)
158
-        # HINT(mkoderer): as workaround for bug #1421104 we have to ignore the
159
-        # keypair and use the configured username and password
158
+        # NOTE(u_glide): We need custom implementation of this method until
159
+        # original implementation depends on CONF.compute.ssh_auth_method
160
+        # option.
160 161
         server_or_ip = kwargs['server_or_ip']
161 162
         if isinstance(server_or_ip, six.string_types):
162 163
             ip = server_or_ip
@@ -164,11 +165,15 @@ class ShareScenarioTest(manager.NetworkScenarioTest):
164 165
             addr = server_or_ip['addresses'][CONF.compute.network_for_ssh][0]
165 166
             ip = addr['addr']
166 167
 
167
-        username = CONF.share.image_username
168
-        password = CONF.share.image_password
168
+        # NOTE(u_glide): Both options (pkey and password) are required here to
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,
171
-                                                  password=password, pkey=None)
176
+        linux_client = remote_client.RemoteClient(ip, **client_params)
172 177
         try:
173 178
             linux_client.validate_authentication()
174 179
         except Exception:

+ 42
- 7
contrib/tempest/tempest/scenario/test_share_basic_ops.py View File

@@ -26,7 +26,7 @@ CONF = config.CONF
26 26
 LOG = logging.getLogger(__name__)
27 27
 
28 28
 
29
-class TestShareBasicOps(manager.ShareScenarioTest):
29
+class ShareBasicOpsBase(manager.ShareScenarioTest):
30 30
 
31 31
     """This smoke test case follows this basic set of operations:
32 32
 
@@ -38,14 +38,14 @@ class TestShareBasicOps(manager.ShareScenarioTest):
38 38
      * Mount share
39 39
      * Terminate the instance
40 40
     """
41
-    protocol = "NFS"
41
+    protocol = None
42 42
 
43 43
     def setUp(self):
44
-        super(TestShareBasicOps, self).setUp()
44
+        super(ShareBasicOpsBase, self).setUp()
45 45
         # Setup image and flavor the test instance
46 46
         # Support both configured and injected values
47 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 49
         if CONF.share.image_with_share_tools:
50 50
             images = self.images_client.list_images()
51 51
             for img in images:
@@ -56,7 +56,7 @@ class TestShareBasicOps(manager.ShareScenarioTest):
56 56
                 msg = ("Image %s not found" %
57 57
                        CONF.share.image_with_share_tools)
58 58
                 raise exceptions.InvalidConfiguration(message=msg)
59
-        self.ssh_user = CONF.compute.image_ssh_user
59
+        self.ssh_user = CONF.share.image_username
60 60
         LOG.debug('Starting test for i:{image}, f:{flavor}. '
61 61
                   'user: {ssh_user}'.format(
62 62
                       image=self.image_ref, flavor=self.flavor_ref,
@@ -73,7 +73,8 @@ class TestShareBasicOps(manager.ShareScenarioTest):
73 73
             'security_groups': security_groups,
74 74
         }
75 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 78
         return instance
78 79
 
79 80
     def init_ssh(self, instance, do_ping=False):
@@ -90,6 +91,10 @@ class TestShareBasicOps(manager.ShareScenarioTest):
90 91
             server_or_ip=floating_ip['ip'],
91 92
             username=self.ssh_user,
92 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 98
         self.share = self.shares_client.get_share(self.share['id'])
94 99
         if do_ping:
95 100
             server_ip = self.share['export_location'].split(":")[0]
@@ -97,7 +102,7 @@ class TestShareBasicOps(manager.ShareScenarioTest):
97 102
         return ssh_client
98 103
 
99 104
     def mount_share(self, location, ssh_client):
100
-        ssh_client.exec_command("sudo mount \"%s\" /mnt" % location)
105
+        raise NotImplementedError
101 106
 
102 107
     def umount_share(self, ssh_client):
103 108
         ssh_client.exec_command("sudo umount /mnt")
@@ -180,3 +185,33 @@ class TestShareBasicOps(manager.ShareScenarioTest):
180 185
                         ssh_client_inst2)
181 186
         data = self.read_data(ssh_client_inst2)
182 187
         self.assertEqual(test_data, data)
188
+
189
+
190
+class 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
+
197
+class 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.
211
+def 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)

+ 17
- 7
devstack/plugin.sh View File

@@ -85,15 +85,15 @@ SHARE_DRIVER=${SHARE_DRIVER:-manila.share.drivers.generic.GenericShareDriver}
85 85
 eval USER_HOME=~
86 86
 MANILA_PATH_TO_PUBLIC_KEY=${MANILA_PATH_TO_PUBLIC_KEY:-"$USER_HOME/.ssh/id_rsa.pub"}
87 87
 MANILA_PATH_TO_PRIVATE_KEY=${MANILA_PATH_TO_PRIVATE_KEY:-"$USER_HOME/.ssh/id_rsa"}
88
+MANILA_SERVICE_KEYPAIR_NAME=${MANILA_SERVICE_KEYPAIR_NAME:-"manila-service"}
88 89
 
89
-MANILA_SERVICE_INSTANCE_USER=${MANILA_SERVICE_INSTANCE_USER:-"ubuntu"}
90
-MANILA_SERVICE_INSTANCE_PASSWORD=${MANILA_SERVICE_INSTANCE_PASSWORD:-"ubuntu"}
91
-MANILA_SERVICE_IMAGE_URL=${MANILA_SERVICE_IMAGE_URL:-"https://www.dropbox.com/s/vi5oeh10q1qkckh/ubuntu_1204_nfs_cifs.qcow2"}
92
-MANILA_SERVICE_IMAGE_NAME=${MANILA_SERVICE_IMAGE_NAME:-"ubuntu_1204_nfs_cifs"}
90
+MANILA_SERVICE_INSTANCE_USER=${MANILA_SERVICE_INSTANCE_USER:-"manila"}
91
+MANILA_SERVICE_IMAGE_URL=${MANILA_SERVICE_IMAGE_URL:-"https://github.com/uglide/manila-image-elements/releases/download/0.1.0/manila-service-image.qcow2"}
92
+MANILA_SERVICE_IMAGE_NAME=${MANILA_SERVICE_IMAGE_NAME:-"manila-service-image"}
93 93
 
94 94
 MANILA_SERVICE_VM_FLAVOR_REF=${MANILA_SERVICE_VM_FLAVOR_REF:-100}
95 95
 MANILA_SERVICE_VM_FLAVOR_NAME=${MANILA_SERVICE_VM_FLAVOR_NAME:-"manila-service-flavor"}
96
-MANILA_SERVICE_VM_FLAVOR_RAM=${MANILA_SERVICE_VM_FLAVOR_RAM:-64}
96
+MANILA_SERVICE_VM_FLAVOR_RAM=${MANILA_SERVICE_VM_FLAVOR_RAM:-128}
97 97
 MANILA_SERVICE_VM_FLAVOR_DISK=${MANILA_SERVICE_VM_FLAVOR_DISK:-0}
98 98
 MANILA_SERVICE_VM_FLAVOR_VCPUS=${MANILA_SERVICE_VM_FLAVOR_VCPUS:-1}
99 99
 
@@ -141,7 +141,6 @@ function configure_default_backends {
141 141
         iniset $MANILA_CONF $group_name path_to_private_key $MANILA_PATH_TO_PRIVATE_KEY
142 142
         iniset $MANILA_CONF $group_name service_image_name $MANILA_SERVICE_IMAGE_NAME
143 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 144
         iniset $MANILA_CONF $group_name driver_handles_share_servers True
146 145
     done
147 146
 }
@@ -273,6 +272,8 @@ function configure_manila {
273 272
         ssh-keygen -N "" -t rsa -f $MANILA_PATH_TO_PRIVATE_KEY;
274 273
     fi
275 274
 
275
+    iniset $MANILA_CONF DEFAULT manila_service_keypair_name $MANILA_SERVICE_KEYPAIR_NAME
276
+
276 277
     if is_service_enabled tls-proxy; then
277 278
         # Set the service port for a proxy to take the original
278 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
 
319
+function create_manila_service_keypair {
320
+    openstack keypair create $MANILA_SERVICE_KEYPAIR_NAME --public-key $MANILA_PATH_TO_PUBLIC_KEY
321
+}
322
+
323
+
318 324
 # create_service_share_servers - creates service Nova VMs, one per generic
319 325
 # driver, and only if it is configured to mode without handling of share servers.
320 326
 function create_service_share_servers {
@@ -329,7 +335,8 @@ function create_service_share_servers {
329 335
                 --flavor $MANILA_SERVICE_VM_FLAVOR_NAME \
330 336
                 --image $MANILA_SERVICE_IMAGE_NAME \
331 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 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 534
     echo_summary "Creating Manila service image"
528 535
     create_manila_service_image
529 536
 
537
+    echo_summary "Creating Manila service keypair"
538
+    create_manila_service_keypair
539
+
530 540
     echo_summary "Creating Manila service VMs for generic driver \
531 541
         backends for which handlng of share servers is disabled."
532 542
     create_service_share_servers

Loading…
Cancel
Save