summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2017-10-20 18:08:26 +0000
committerGerrit Code Review <review@openstack.org>2017-10-20 18:08:26 +0000
commit33c763e0b987bf25f36870ddb45d9e16c1d4c3e7 (patch)
tree71494512146950fe9efb03e008408bebd3cb9abe
parent09be7d540477bd6e2e7f0a1f8636530c97eb3fcf (diff)
parent62786f90723eaf17b6c1f1240d249771cb083c43 (diff)
Merge "rally: rework plugin"
-rw-r--r--rally-scenarios/plugins/context_plugin_ec2_creds.py2
-rw-r--r--rally-scenarios/plugins/context_plugin_ec2_objects.py4
-rw-r--r--rally-scenarios/plugins/context_plugin_images.py2
-rw-r--r--rally-scenarios/plugins/ec2api_plugin.py104
4 files changed, 63 insertions, 49 deletions
diff --git a/rally-scenarios/plugins/context_plugin_ec2_creds.py b/rally-scenarios/plugins/context_plugin_ec2_creds.py
index 01370e9..d56bdea 100644
--- a/rally-scenarios/plugins/context_plugin_ec2_creds.py
+++ b/rally-scenarios/plugins/context_plugin_ec2_creds.py
@@ -25,7 +25,7 @@ from rally.task import context
25LOG = logging.getLogger(__name__) 25LOG = logging.getLogger(__name__)
26 26
27 27
28@context.configure(name="prepare_ec2_client", order=110) 28@context.configure(name="prepare_ec2_client", platform="openstack", order=110)
29class PrepareEC2ClientContext(context.Context): 29class PrepareEC2ClientContext(context.Context):
30 30
31 def __init__(self, ctx): 31 def __init__(self, ctx):
diff --git a/rally-scenarios/plugins/context_plugin_ec2_objects.py b/rally-scenarios/plugins/context_plugin_ec2_objects.py
index 4e7479a..fe6ad45 100644
--- a/rally-scenarios/plugins/context_plugin_ec2_objects.py
+++ b/rally-scenarios/plugins/context_plugin_ec2_objects.py
@@ -222,7 +222,7 @@ class EC2Objects(context.Context):
222 LOG.exception('') 222 LOG.exception('')
223 223
224 224
225@context.configure(name="ec2api_networks", order=451) 225@context.configure(name="ec2api_networks", platform="openstack", order=451)
226class FakeNetworkGenerator(EC2Objects): 226class FakeNetworkGenerator(EC2Objects):
227 """Context class for adding temporary networks for benchmarks. 227 """Context class for adding temporary networks for benchmarks.
228 228
@@ -277,7 +277,7 @@ class FakeNetworkGenerator(EC2Objects):
277 self.cleanup_networks(tenant_id, client) 277 self.cleanup_networks(tenant_id, client)
278 278
279 279
280@context.configure(name="ec2api_servers", order=450) 280@context.configure(name="ec2api_servers", platform="openstack", order=450)
281class FakeServerGenerator(EC2Objects): 281class FakeServerGenerator(EC2Objects):
282 """Context class for adding temporary servers for benchmarks. 282 """Context class for adding temporary servers for benchmarks.
283 283
diff --git a/rally-scenarios/plugins/context_plugin_images.py b/rally-scenarios/plugins/context_plugin_images.py
index f797d94..aedf819 100644
--- a/rally-scenarios/plugins/context_plugin_images.py
+++ b/rally-scenarios/plugins/context_plugin_images.py
@@ -25,7 +25,7 @@ from ec2api.tests.functional import botocoreclient
25LOG = logging.getLogger(__name__) 25LOG = logging.getLogger(__name__)
26 26
27 27
28@context.configure(name="fake_images", order=411) 28@context.configure(name="fake_images", platform="openstack", order=411)
29class FakeImageGenerator(context.Context): 29class FakeImageGenerator(context.Context):
30 """Context class for adding images to each user for benchmarks.""" 30 """Context class for adding images to each user for benchmarks."""
31 31
diff --git a/rally-scenarios/plugins/ec2api_plugin.py b/rally-scenarios/plugins/ec2api_plugin.py
index 2ec5cd1..7039827 100644
--- a/rally-scenarios/plugins/ec2api_plugin.py
+++ b/rally-scenarios/plugins/ec2api_plugin.py
@@ -64,57 +64,16 @@ class EC2APIPlugin(scenario.OpenStackScenario):
64 args['url'], args['region'], args['access'], args['secret']) 64 args['url'], args['region'], args['access'], args['secret'])
65 return client 65 return client
66 66
67 @scenario.configure()
68 def describe_images(self):
69 self.describe_images_ec2api()
70 self.describe_images_nova()
71
72 def describe_images_ec2api(self): 67 def describe_images_ec2api(self):
73 client = self.get_ec2_client() 68 client = self.get_ec2_client()
74 with atomic.ActionTimer(self, 'describe_images_ec2api'): 69 with atomic.ActionTimer(self, 'describe_images_ec2api'):
75 data = client.describe_images() 70 data = client.describe_images()
76 71
77 def describe_images_nova(self): 72 def describe_images_glance(self):
78 client = osclients.Clients( 73 client = osclients.Clients(
79 self.context['user']['credential']).nova().images 74 self.context['user']['credential']).glance().images
80 with atomic.ActionTimer(self, 'describe_images_nova'): 75 with atomic.ActionTimer(self, 'describe_images_glance'):
81 client.list() 76 data = list(client.list())
82
83 @scenario.configure()
84 def describe_regions(self):
85 client = self.get_ec2_client()
86 with atomic.ActionTimer(self, 'describe_regions_ec2api'):
87 data = client.describe_regions()
88
89 @scenario.configure()
90 def describe_all_in_one(self):
91 self.describe_addresses_ec2api()
92 self.describe_floatingips_neutron()
93 self.describe_instances_ec2api()
94 self.describe_one_instance_ec2api()
95 self.describe_instances_nova()
96 self.describe_one_instance_nova()
97 self.describe_vpcs_ec2api()
98 self.describe_subnets_ec2api()
99 self.describe_network_interfaces_ec2api()
100 self.describe_route_tables_ec2api()
101 self.describe_security_groups_ec2api()
102 self.describe_networks_neutron()
103 self.describe_subnets_neutron()
104 self.describe_ports_neutron()
105 self.describe_security_groups_neutron()
106
107 @scenario.configure()
108 def describe_networks(self):
109 self.describe_vpcs_ec2api()
110 self.describe_subnets_ec2api()
111 self.describe_network_interfaces_ec2api()
112 self.describe_route_tables_ec2api()
113 self.describe_security_groups_ec2api()
114 self.describe_networks_neutron()
115 self.describe_subnets_neutron()
116 self.describe_ports_neutron()
117 self.describe_security_groups_neutron()
118 77
119 def describe_addresses_ec2api(self): 78 def describe_addresses_ec2api(self):
120 client = self.get_ec2_client() 79 client = self.get_ec2_client()
@@ -207,3 +166,58 @@ class EC2APIPlugin(scenario.OpenStackScenario):
207 project_id = self.context["tenant"]["id"] 166 project_id = self.context["tenant"]["id"]
208 with atomic.ActionTimer(self, 'describe_security_groups_neutron'): 167 with atomic.ActionTimer(self, 'describe_security_groups_neutron'):
209 neutron.list_security_groups(tenant_id=project_id) 168 neutron.list_security_groups(tenant_id=project_id)
169
170
171@scenario.configure(name="EC2APIPlugin.describe_images", platform="openstack")
172class DescribeImages(EC2APIPlugin):
173
174 def run(self):
175 self.describe_images_ec2api()
176 self.describe_images_glance()
177
178
179@scenario.configure(name="EC2APIPlugin.describe_regions", platform="openstack")
180class DescribeRegions(EC2APIPlugin):
181
182 def run(self):
183 client = self.get_ec2_client()
184 with atomic.ActionTimer(self, 'describe_regions_ec2api'):
185 data = client.describe_regions()
186
187
188@scenario.configure(name="EC2APIPlugin.describe_all_in_one",
189 platform="openstack")
190class DescribeAllInOne(EC2APIPlugin):
191
192 def run(self):
193 self.describe_addresses_ec2api()
194 self.describe_floatingips_neutron()
195 self.describe_instances_ec2api()
196 self.describe_one_instance_ec2api()
197 self.describe_instances_nova()
198 self.describe_one_instance_nova()
199 self.describe_vpcs_ec2api()
200 self.describe_subnets_ec2api()
201 self.describe_network_interfaces_ec2api()
202 self.describe_route_tables_ec2api()
203 self.describe_security_groups_ec2api()
204 self.describe_networks_neutron()
205 self.describe_subnets_neutron()
206 self.describe_ports_neutron()
207 self.describe_security_groups_neutron()
208
209
210@scenario.configure(name="EC2APIPlugin.describe_networks",
211 platform="openstack")
212class DescribeNetworks(EC2APIPlugin):
213
214 def run(self):
215 self.describe_vpcs_ec2api()
216 self.describe_subnets_ec2api()
217 self.describe_network_interfaces_ec2api()
218 self.describe_route_tables_ec2api()
219 self.describe_security_groups_ec2api()
220 self.describe_networks_neutron()
221 self.describe_subnets_neutron()
222 self.describe_ports_neutron()
223 self.describe_security_groups_neutron()