blob: ed5743cc32348aa5179f5b63c1b7ba9f349cf984 [file] [log] [blame]
Joe Gordonb5e10cd2013-07-10 15:51:12 +00001# Copyright 2013 NEC Corporation
2# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
Masayuki Igawa259c1132013-10-31 17:48:44 +090016from tempest.common.utils import data_utils
Matthew Treinish6c072292014-01-29 19:15:52 +000017from tempest import config
Matthew Treinishf4a9b0f2013-07-26 16:58:26 -040018from tempest.openstack.common import log as logging
Joe Gordonb5e10cd2013-07-10 15:51:12 +000019from tempest.scenario import manager
Masayuki Igawa4ded9f02014-02-17 15:05:59 +090020from tempest import test
Joe Gordonb5e10cd2013-07-10 15:51:12 +000021
Matthew Treinish6c072292014-01-29 19:15:52 +000022CONF = config.CONF
23
Joe Gordonb5e10cd2013-07-10 15:51:12 +000024
25LOG = logging.getLogger(__name__)
26
27
Joe Gordon30684ef2013-10-08 17:09:09 -070028class TestLargeOpsScenario(manager.NetworkScenarioTest):
Joe Gordonb5e10cd2013-07-10 15:51:12 +000029
30 """
31 Test large operations.
32
33 This test below:
Joe Gordonfa29a622014-04-17 13:21:44 -070034 * Spin up multiple instances in one nova call, and repeat three times
Joe Gordonb5e10cd2013-07-10 15:51:12 +000035 * as a regular user
36 * TODO: same thing for cinder
37
38 """
39
Sylvain Afchain92064772014-01-16 02:45:57 +010040 @classmethod
41 def setUpClass(cls):
42 cls.set_network_resources()
43 super(TestLargeOpsScenario, cls).setUpClass()
44
Joe Gordonb5e10cd2013-07-10 15:51:12 +000045 def _wait_for_server_status(self, status):
46 for server in self.servers:
47 self.status_timeout(
48 self.compute_client.servers, server.id, status)
49
Joe Gordonb5e10cd2013-07-10 15:51:12 +000050 def nova_boot(self):
Masayuki Igawa259c1132013-10-31 17:48:44 +090051 name = data_utils.rand_name('scenario-server-')
Joe Gordonb5e10cd2013-07-10 15:51:12 +000052 client = self.compute_client
Matthew Treinish6c072292014-01-29 19:15:52 +000053 flavor_id = CONF.compute.flavor_ref
Yair Friedeb69f3f2013-10-10 13:18:16 +030054 secgroup = self._create_security_group_nova()
Joe Gordonb5e10cd2013-07-10 15:51:12 +000055 self.servers = client.servers.create(
56 name=name, image=self.image,
57 flavor=flavor_id,
Matthew Treinish6c072292014-01-29 19:15:52 +000058 min_count=CONF.scenario.large_ops_number,
Joe Gordon30684ef2013-10-08 17:09:09 -070059 security_groups=[secgroup.name])
Joe Gordonb5e10cd2013-07-10 15:51:12 +000060 # needed because of bug 1199788
61 self.servers = [x for x in client.servers.list() if name in x.name]
Joe Gordona3219652013-10-09 15:23:11 -070062 for server in self.servers:
63 self.set_resource(server.name, server)
Joe Gordonb5e10cd2013-07-10 15:51:12 +000064 self._wait_for_server_status('ACTIVE')
65
Joe Gordonb7f37cc2014-05-09 13:30:40 -070066 def _large_ops_scenario(self):
Matthew Treinish6c072292014-01-29 19:15:52 +000067 if CONF.scenario.large_ops_number < 1:
Joe Gordonb5e10cd2013-07-10 15:51:12 +000068 return
69 self.glance_image_create()
70 self.nova_boot()
Joe Gordonb7f37cc2014-05-09 13:30:40 -070071
72 @test.services('compute', 'image')
73 def test_large_ops_scenario_1(self):
74 self._large_ops_scenario()
75
76 @test.services('compute', 'image')
77 def test_large_ops_scenario_2(self):
78 self._large_ops_scenario()
79
80 @test.services('compute', 'image')
81 def test_large_ops_scenario_3(self):
82 self._large_ops_scenario()