Replace ' with " in rally/benchmark
Partial bug: 1405884 Change-Id: I2de902aa67c75ad09cd733926c94e216129fab6b
This commit is contained in:
parent
85f351fc04
commit
96fd52182a
@ -49,8 +49,8 @@ class ImageGenerator(base.Context):
|
||||
"minimum": 1
|
||||
},
|
||||
},
|
||||
'required': ['image_url', 'image_type', 'image_container',
|
||||
'images_per_tenant'],
|
||||
"required": ["image_url", "image_type", "image_container",
|
||||
"images_per_tenant"],
|
||||
"additionalProperties": False
|
||||
}
|
||||
|
||||
|
@ -71,10 +71,10 @@ def _prepare_open_secgroup(endpoint):
|
||||
in rally_open.rules):
|
||||
nova.security_group_rules.create(
|
||||
rally_open.id,
|
||||
from_port=new_rule['from_port'],
|
||||
to_port=new_rule['to_port'],
|
||||
ip_protocol=new_rule['ip_protocol'],
|
||||
cidr=new_rule['ip_range']['cidr'])
|
||||
from_port=new_rule["from_port"],
|
||||
to_port=new_rule["to_port"],
|
||||
ip_protocol=new_rule["ip_protocol"],
|
||||
cidr=new_rule["ip_range"]["cidr"])
|
||||
|
||||
return rally_open
|
||||
|
||||
|
@ -58,7 +58,7 @@ class ServerGenerator(base.Context):
|
||||
"minimum": 1
|
||||
},
|
||||
},
|
||||
'required': ['image', 'flavor'],
|
||||
"required": ["image", "flavor"],
|
||||
"additionalProperties": False
|
||||
}
|
||||
|
||||
|
@ -48,8 +48,8 @@ context_opts = [
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.register_opts(context_opts,
|
||||
group=cfg.OptGroup(name='users_context',
|
||||
title='benchmark context options'))
|
||||
group=cfg.OptGroup(name="users_context",
|
||||
title="benchmark context options"))
|
||||
|
||||
|
||||
@base.context(name="users", order=100)
|
||||
@ -115,7 +115,7 @@ class UserGenerator(base.Context):
|
||||
|
||||
nova_admin = clients.nova()
|
||||
|
||||
if not utils.check_service_status(nova_admin, 'nova-network'):
|
||||
if not utils.check_service_status(nova_admin, "nova-network"):
|
||||
return
|
||||
|
||||
for network in nova_admin.networks.list():
|
||||
|
@ -43,7 +43,7 @@ class VolumeGenerator(base.Context):
|
||||
"minimum": 1
|
||||
}
|
||||
},
|
||||
'required': ['size'],
|
||||
"required": ["size"],
|
||||
"additionalProperties": False
|
||||
}
|
||||
|
||||
|
@ -214,7 +214,7 @@ class BenchmarkEngine(object):
|
||||
self.task.update_status(consts.TaskStatus.RUNNING)
|
||||
for name in self.config:
|
||||
for n, kw in enumerate(self.config[name]):
|
||||
key = {'name': name, 'pos': n, 'kw': kw}
|
||||
key = {"name": name, "pos": n, "kw": kw}
|
||||
LOG.info("Running benchmark with key: \n%s"
|
||||
% json.dumps(key, indent=2))
|
||||
runner = self._get_runner(kw)
|
||||
|
@ -91,19 +91,19 @@ def hvariety(data):
|
||||
"for zero length array of data")
|
||||
return [
|
||||
{
|
||||
'method': 'Square Root Choice',
|
||||
'number_of_bins': calculate_number_of_bins_sqrt(data),
|
||||
"method": "Square Root Choice",
|
||||
"number_of_bins": calculate_number_of_bins_sqrt(data),
|
||||
},
|
||||
{
|
||||
'method': 'Sturges Formula',
|
||||
'number_of_bins': calculate_number_of_bins_sturges(data),
|
||||
"method": "Sturges Formula",
|
||||
"number_of_bins": calculate_number_of_bins_sturges(data),
|
||||
},
|
||||
{
|
||||
'method': 'Rice Rule',
|
||||
'number_of_bins': calculate_number_of_bins_rice(data),
|
||||
"method": "Rice Rule",
|
||||
"number_of_bins": calculate_number_of_bins_rice(data),
|
||||
},
|
||||
{
|
||||
'method': 'One Half',
|
||||
'number_of_bins': calculate_number_of_bins_half(data),
|
||||
"method": "One Half",
|
||||
"number_of_bins": calculate_number_of_bins_half(data),
|
||||
}
|
||||
]
|
||||
|
@ -109,8 +109,8 @@ def _process_main_duration(result, data):
|
||||
hvariety = histo.hvariety(histogram_data)
|
||||
for i in range(len(hvariety)):
|
||||
histograms.append(histo.Histogram(histogram_data,
|
||||
hvariety[i]['number_of_bins'],
|
||||
hvariety[i]['method']))
|
||||
hvariety[i]["number_of_bins"],
|
||||
hvariety[i]["method"]))
|
||||
|
||||
stacked_area = []
|
||||
for key in "duration", "idle_duration":
|
||||
@ -195,12 +195,12 @@ def _process_atomic(result, data):
|
||||
|
||||
histograms = [[] for atomic_action in range(len(histogram_data))]
|
||||
for i, atomic_action in enumerate(histogram_data):
|
||||
hvariety = histo.hvariety(atomic_action['values'])
|
||||
hvariety = histo.hvariety(atomic_action["values"])
|
||||
for v in range(len(hvariety)):
|
||||
histograms[i].append(histo.Histogram(atomic_action['values'],
|
||||
hvariety[v]['number_of_bins'],
|
||||
hvariety[v]['method'],
|
||||
atomic_action['key']))
|
||||
histograms[i].append(histo.Histogram(atomic_action["values"],
|
||||
hvariety[v]["number_of_bins"],
|
||||
hvariety[v]["method"],
|
||||
atomic_action["key"]))
|
||||
stacked_area = []
|
||||
for name, durations in six.iteritems(data["atomic_durations"]):
|
||||
stacked_area.append({
|
||||
@ -243,7 +243,7 @@ def _get_atomic_action_durations(result):
|
||||
else:
|
||||
data = [action, None, None, None, None, None, 0, len(raw)]
|
||||
|
||||
# Save `total' - it must be appended last
|
||||
# Save 'total' - it must be appended last
|
||||
if action == "total":
|
||||
total = data
|
||||
continue
|
||||
|
@ -47,7 +47,7 @@ class SerialScenarioRunner(base.ScenarioRunner):
|
||||
}
|
||||
|
||||
def _run_scenario(self, cls, method_name, context, args):
|
||||
times = self.config.get('times', 1)
|
||||
times = self.config.get("times", 1)
|
||||
|
||||
for i in range(times):
|
||||
run_args = (i, cls, method_name,
|
||||
|
@ -34,7 +34,7 @@ class CeilometerScenario(base.Scenario):
|
||||
alarm.update(kwargs)
|
||||
return alarm
|
||||
|
||||
@base.atomic_action_timer('ceilometer.list_alarms')
|
||||
@base.atomic_action_timer("ceilometer.list_alarms")
|
||||
def _list_alarms(self, alarm_id=None):
|
||||
"""List alarms.
|
||||
|
||||
@ -49,7 +49,7 @@ class CeilometerScenario(base.Scenario):
|
||||
else:
|
||||
return self.clients("ceilometer").alarms.list()
|
||||
|
||||
@base.atomic_action_timer('ceilometer.create_alarm')
|
||||
@base.atomic_action_timer("ceilometer.create_alarm")
|
||||
def _create_alarm(self, meter_name, threshold, kwargs):
|
||||
"""Create an alarm.
|
||||
|
||||
@ -64,7 +64,7 @@ class CeilometerScenario(base.Scenario):
|
||||
alarm = self.clients("ceilometer").alarms.create(**alarm_dict)
|
||||
return alarm
|
||||
|
||||
@base.atomic_action_timer('ceilometer.delete_alarm')
|
||||
@base.atomic_action_timer("ceilometer.delete_alarm")
|
||||
def _delete_alarm(self, alarm_id):
|
||||
"""Delete an alarm.
|
||||
|
||||
@ -72,7 +72,7 @@ class CeilometerScenario(base.Scenario):
|
||||
"""
|
||||
self.clients("ceilometer").alarms.delete(alarm_id)
|
||||
|
||||
@base.atomic_action_timer('ceilometer.update_alarm')
|
||||
@base.atomic_action_timer("ceilometer.update_alarm")
|
||||
def _update_alarm(self, alarm_id, alarm_dict_delta):
|
||||
"""Update an alarm.
|
||||
|
||||
@ -81,12 +81,12 @@ class CeilometerScenario(base.Scenario):
|
||||
"""
|
||||
self.clients("ceilometer").alarms.update(alarm_id, **alarm_dict_delta)
|
||||
|
||||
@base.atomic_action_timer('ceilometer.get_meters')
|
||||
@base.atomic_action_timer("ceilometer.get_meters")
|
||||
def _list_meters(self):
|
||||
"""Get list of user's meters."""
|
||||
return self.clients("ceilometer").meters.list()
|
||||
|
||||
@base.atomic_action_timer('ceilometer.list_resources')
|
||||
@base.atomic_action_timer("ceilometer.list_resources")
|
||||
def _list_resources(self):
|
||||
"""List all resources.
|
||||
|
||||
@ -94,7 +94,7 @@ class CeilometerScenario(base.Scenario):
|
||||
"""
|
||||
return self.clients("ceilometer").resources.list()
|
||||
|
||||
@base.atomic_action_timer('ceilometer.get_stats')
|
||||
@base.atomic_action_timer("ceilometer.get_stats")
|
||||
def _get_stats(self, meter_name):
|
||||
"""Get stats for a specific meter.
|
||||
|
||||
@ -102,7 +102,7 @@ class CeilometerScenario(base.Scenario):
|
||||
"""
|
||||
return self.clients("ceilometer").statistics.list(meter_name)
|
||||
|
||||
@base.atomic_action_timer('ceilometer.create_meter')
|
||||
@base.atomic_action_timer("ceilometer.create_meter")
|
||||
def _create_meter(self, **kwargs):
|
||||
"""Create a new meter.
|
||||
|
||||
@ -115,7 +115,7 @@ class CeilometerScenario(base.Scenario):
|
||||
counter_name=name, **kwargs)
|
||||
return samples[0]
|
||||
|
||||
@base.atomic_action_timer('ceilometer.query_alarms')
|
||||
@base.atomic_action_timer("ceilometer.query_alarms")
|
||||
def _query_alarms(self, filter, orderby, limit):
|
||||
"""Query alarms with specific parameters.
|
||||
|
||||
@ -130,7 +130,7 @@ class CeilometerScenario(base.Scenario):
|
||||
return self.clients("ceilometer").query_alarms.query(
|
||||
filter, orderby, limit)
|
||||
|
||||
@base.atomic_action_timer('ceilometer.query_alarm_history')
|
||||
@base.atomic_action_timer("ceilometer.query_alarm_history")
|
||||
def _query_alarm_history(self, filter, orderby, limit):
|
||||
"""Query history of an alarm.
|
||||
|
||||
@ -145,7 +145,7 @@ class CeilometerScenario(base.Scenario):
|
||||
return self.clients("ceilometer").query_alarm_history.query(
|
||||
filter, orderby, limit)
|
||||
|
||||
@base.atomic_action_timer('ceilometer.create_sample')
|
||||
@base.atomic_action_timer("ceilometer.create_sample")
|
||||
def _create_sample(self, counter_name, counter_type, counter_unit,
|
||||
counter_volume, resource_id, **kwargs):
|
||||
"""Create a Sample with specified parameters.
|
||||
@ -165,7 +165,7 @@ class CeilometerScenario(base.Scenario):
|
||||
"resource_id": resource_id})
|
||||
return self.clients("ceilometer").samples.create(**kwargs)
|
||||
|
||||
@base.atomic_action_timer('ceilometer.query_samples')
|
||||
@base.atomic_action_timer("ceilometer.query_samples")
|
||||
def _query_samples(self, filter, orderby, limit):
|
||||
"""Query samples with specified parameters.
|
||||
|
||||
|
@ -23,28 +23,28 @@ from rally.benchmark import utils as bench_utils
|
||||
|
||||
|
||||
cinder_benchmark_opts = [
|
||||
cfg.FloatOpt('cinder_volume_create_prepoll_delay',
|
||||
cfg.FloatOpt("cinder_volume_create_prepoll_delay",
|
||||
default=2.0,
|
||||
help='Time to sleep after creating a resource before'
|
||||
' polling for it status'),
|
||||
cfg.FloatOpt('cinder_volume_create_timeout',
|
||||
help="Time to sleep after creating a resource before"
|
||||
" polling for it status"),
|
||||
cfg.FloatOpt("cinder_volume_create_timeout",
|
||||
default=600.0,
|
||||
help='Time to wait for cinder volume to be created.'),
|
||||
cfg.FloatOpt('cinder_volume_create_poll_interval',
|
||||
help="Time to wait for cinder volume to be created."),
|
||||
cfg.FloatOpt("cinder_volume_create_poll_interval",
|
||||
default=2.0,
|
||||
help='Interval between checks when waiting for volume'
|
||||
' creation.'),
|
||||
cfg.FloatOpt('cinder_volume_delete_timeout',
|
||||
help="Interval between checks when waiting for volume"
|
||||
" creation."),
|
||||
cfg.FloatOpt("cinder_volume_delete_timeout",
|
||||
default=600.0,
|
||||
help='Time to wait for cinder volume to be deleted.'),
|
||||
cfg.FloatOpt('cinder_volume_delete_poll_interval',
|
||||
help="Time to wait for cinder volume to be deleted."),
|
||||
cfg.FloatOpt("cinder_volume_delete_poll_interval",
|
||||
default=2.0,
|
||||
help='Interval between checks when waiting for volume'
|
||||
' deletion.')
|
||||
help="Interval between checks when waiting for volume"
|
||||
" deletion.")
|
||||
]
|
||||
|
||||
CONF = cfg.CONF
|
||||
benchmark_group = cfg.OptGroup(name='benchmark', title='benchmark options')
|
||||
benchmark_group = cfg.OptGroup(name="benchmark", title="benchmark options")
|
||||
CONF.register_opts(cinder_benchmark_opts, group=benchmark_group)
|
||||
|
||||
|
||||
@ -53,19 +53,19 @@ class CinderScenario(base.Scenario):
|
||||
|
||||
RESOURCE_NAME_PREFIX = "rally_volume_"
|
||||
|
||||
@base.atomic_action_timer('cinder.list_volumes')
|
||||
@base.atomic_action_timer("cinder.list_volumes")
|
||||
def _list_volumes(self, detailed=True):
|
||||
"""Returns user volumes list."""
|
||||
|
||||
return self.clients("cinder").volumes.list(detailed)
|
||||
|
||||
@base.atomic_action_timer('cinder.list_snapshots')
|
||||
@base.atomic_action_timer("cinder.list_snapshots")
|
||||
def _list_snapshots(self, detailed=True):
|
||||
"""Returns user snapshots list."""
|
||||
|
||||
return self.clients("cinder").volume_snapshots.list(detailed)
|
||||
|
||||
@base.atomic_action_timer('cinder.create_volume')
|
||||
@base.atomic_action_timer("cinder.create_volume")
|
||||
def _create_volume(self, size, **kwargs):
|
||||
"""Create one volume.
|
||||
|
||||
@ -91,7 +91,7 @@ class CinderScenario(base.Scenario):
|
||||
)
|
||||
return volume
|
||||
|
||||
@base.atomic_action_timer('cinder.delete_volume')
|
||||
@base.atomic_action_timer("cinder.delete_volume")
|
||||
def _delete_volume(self, volume):
|
||||
"""Delete the given volume.
|
||||
|
||||
@ -107,7 +107,7 @@ class CinderScenario(base.Scenario):
|
||||
check_interval=CONF.benchmark.cinder_volume_delete_poll_interval
|
||||
)
|
||||
|
||||
@base.atomic_action_timer('cinder.extend_volume')
|
||||
@base.atomic_action_timer("cinder.extend_volume")
|
||||
def _extend_volume(self, volume, new_size):
|
||||
"""Extend the given volume.
|
||||
|
||||
@ -125,7 +125,7 @@ class CinderScenario(base.Scenario):
|
||||
check_interval=CONF.benchmark.cinder_volume_create_poll_interval
|
||||
)
|
||||
|
||||
@base.atomic_action_timer('cinder.create_snapshot')
|
||||
@base.atomic_action_timer("cinder.create_snapshot")
|
||||
def _create_snapshot(self, volume_id, force=False, **kwargs):
|
||||
"""Create one snapshot.
|
||||
|
||||
@ -153,7 +153,7 @@ class CinderScenario(base.Scenario):
|
||||
)
|
||||
return snapshot
|
||||
|
||||
@base.atomic_action_timer('cinder.delete_snapshot')
|
||||
@base.atomic_action_timer("cinder.delete_snapshot")
|
||||
def _delete_snapshot(self, snapshot):
|
||||
"""Delete the given snapshot.
|
||||
|
||||
|
@ -272,7 +272,7 @@ class CinderVolumes(utils.CinderScenario,
|
||||
volume_types.append(s.name)
|
||||
selected_type = random.choice(volume_types)
|
||||
|
||||
size = random.randint(size['min'], size['max'])
|
||||
size = random.randint(size["min"], size["max"])
|
||||
|
||||
volume = self._create_volume(size, volume_type=selected_type)
|
||||
snapshot = self._create_snapshot(volume.id, False, **kwargs)
|
||||
@ -324,8 +324,8 @@ class CinderVolumes(utils.CinderScenario,
|
||||
if nested_level is None:
|
||||
nested_level = {"min": 5, "max": 10}
|
||||
|
||||
size = random.randint(size['min'], size['max'])
|
||||
nested_level = random.randint(nested_level['min'], nested_level['max'])
|
||||
size = random.randint(size["min"], size["max"])
|
||||
nested_level = random.randint(nested_level["min"], nested_level["max"])
|
||||
|
||||
servers = [self.get_random_server()]
|
||||
volumes = [self._create_volume(size)]
|
||||
|
@ -66,7 +66,7 @@ class DesignateBasic(utils.DesignateScenario):
|
||||
with different level of load.
|
||||
"""
|
||||
domain = self._create_domain()
|
||||
self._delete_domain(domain['id'])
|
||||
self._delete_domain(domain["id"])
|
||||
|
||||
@validation.required_services(consts.Service.DESIGNATE)
|
||||
@validation.required_openstack(users=True)
|
||||
@ -93,7 +93,7 @@ class DesignateBasic(utils.DesignateScenario):
|
||||
with base.AtomicAction(self, key):
|
||||
for record in records:
|
||||
self._delete_record(
|
||||
domain['id'], record['id'], atomic_action=False)
|
||||
domain["id"], record["id"], atomic_action=False)
|
||||
|
||||
@validation.required_services(consts.Service.DESIGNATE)
|
||||
@validation.required_openstack(users=True)
|
||||
@ -134,4 +134,4 @@ class DesignateBasic(utils.DesignateScenario):
|
||||
for i in range(records_per_domain):
|
||||
self._create_record(domain, atomic_action=False)
|
||||
|
||||
self._list_records(domain['id'])
|
||||
self._list_records(domain["id"])
|
||||
|
@ -22,7 +22,7 @@ class DesignateScenario(base.Scenario):
|
||||
|
||||
RESOURCE_NAME_PREFIX = "rally_"
|
||||
|
||||
@base.atomic_action_timer('designate.create_domain')
|
||||
@base.atomic_action_timer("designate.create_domain")
|
||||
def _create_domain(self, domain=None):
|
||||
"""Create domain.
|
||||
|
||||
@ -31,16 +31,16 @@ class DesignateScenario(base.Scenario):
|
||||
"""
|
||||
domain = domain or {}
|
||||
|
||||
domain.setdefault('email', 'root@random.name')
|
||||
domain.setdefault('name', '%s.name.' % self._generate_random_name())
|
||||
domain.setdefault("email", "root@random.name")
|
||||
domain.setdefault("name", "%s.name." % self._generate_random_name())
|
||||
return self.clients("designate").domains.create(domain)
|
||||
|
||||
@base.atomic_action_timer('designate.list_domains')
|
||||
@base.atomic_action_timer("designate.list_domains")
|
||||
def _list_domains(self):
|
||||
"""Return user domain list."""
|
||||
return self.clients("designate").domains.list()
|
||||
|
||||
@base.atomic_action_timer('designate.delete_domain')
|
||||
@base.atomic_action_timer("designate.delete_domain")
|
||||
def _delete_domain(self, domain_id):
|
||||
"""Delete designate zone.
|
||||
|
||||
@ -58,20 +58,20 @@ class DesignateScenario(base.Scenario):
|
||||
:returns: Designate record dict
|
||||
"""
|
||||
record = record or {}
|
||||
record.setdefault('type', 'A')
|
||||
record.setdefault('name', '%s.%s' % (self._generate_random_name(),
|
||||
domain['name']))
|
||||
record.setdefault('data', '10.0.0.1')
|
||||
record.setdefault("type", "A")
|
||||
record.setdefault("name", "%s.%s" % (self._generate_random_name(),
|
||||
domain["name"]))
|
||||
record.setdefault("data", "10.0.0.1")
|
||||
|
||||
client = self.clients('designate')
|
||||
client = self.clients("designate")
|
||||
|
||||
if atomic_action:
|
||||
with base.AtomicAction(self, 'designate.create_record'):
|
||||
return client.records.create(domain['id'], record)
|
||||
with base.AtomicAction(self, "designate.create_record"):
|
||||
return client.records.create(domain["id"], record)
|
||||
|
||||
return client.records.create(domain['id'], record)
|
||||
return client.records.create(domain["id"], record)
|
||||
|
||||
@base.atomic_action_timer('designate.list_records')
|
||||
@base.atomic_action_timer("designate.list_records")
|
||||
def _list_records(self, domain_id):
|
||||
"""List domain records.
|
||||
|
||||
@ -88,10 +88,10 @@ class DesignateScenario(base.Scenario):
|
||||
:param atomic_action: True if the record creation should be tracked
|
||||
as an atomic action
|
||||
"""
|
||||
client = self.clients('designate')
|
||||
client = self.clients("designate")
|
||||
|
||||
if atomic_action:
|
||||
with base.AtomicAction(self, 'designate.delete_record'):
|
||||
with base.AtomicAction(self, "designate.delete_record"):
|
||||
client.records.create(domain_id, record_id)
|
||||
|
||||
client.records.delete(domain_id, record_id)
|
||||
|
@ -83,8 +83,8 @@ class Dummy(base.Scenario):
|
||||
output processing.
|
||||
"""
|
||||
out = {
|
||||
'value_1': random.randint(1, 100),
|
||||
'value_2': random.random()
|
||||
"value_1": random.randint(1, 100),
|
||||
"value_2": random.random()
|
||||
}
|
||||
err = ""
|
||||
return {"data": out, "errors": err}
|
||||
|
@ -23,41 +23,41 @@ from rally.benchmark import utils as bench_utils
|
||||
|
||||
|
||||
glance_benchmark_opts = [
|
||||
cfg.FloatOpt('glance_image_create_prepoll_delay',
|
||||
cfg.FloatOpt("glance_image_create_prepoll_delay",
|
||||
default=2.0,
|
||||
help='Time to sleep after creating a resource before '
|
||||
'polling for it status'),
|
||||
cfg.FloatOpt('glance_image_create_timeout',
|
||||
help="Time to sleep after creating a resource before "
|
||||
"polling for it status"),
|
||||
cfg.FloatOpt("glance_image_create_timeout",
|
||||
default=120.0,
|
||||
help='Time to wait for glance image to be created.'),
|
||||
cfg.FloatOpt('glance_image_create_poll_interval',
|
||||
help="Time to wait for glance image to be created."),
|
||||
cfg.FloatOpt("glance_image_create_poll_interval",
|
||||
default=1.0,
|
||||
help='Interval between checks when waiting for image '
|
||||
'creation.'),
|
||||
cfg.FloatOpt('glance_image_delete_timeout',
|
||||
help="Interval between checks when waiting for image "
|
||||
"creation."),
|
||||
cfg.FloatOpt("glance_image_delete_timeout",
|
||||
default=120.0,
|
||||
help='Time to wait for glance image to be deleted.'),
|
||||
cfg.FloatOpt('glance_image_delete_poll_interval',
|
||||
help="Time to wait for glance image to be deleted."),
|
||||
cfg.FloatOpt("glance_image_delete_poll_interval",
|
||||
default=1.0,
|
||||
help='Interval between checks when waiting for image '
|
||||
'deletion.')
|
||||
help="Interval between checks when waiting for image "
|
||||
"deletion.")
|
||||
]
|
||||
|
||||
|
||||
CONF = cfg.CONF
|
||||
benchmark_group = cfg.OptGroup(name='benchmark', title='benchmark options')
|
||||
benchmark_group = cfg.OptGroup(name="benchmark", title="benchmark options")
|
||||
CONF.register_opts(glance_benchmark_opts, group=benchmark_group)
|
||||
|
||||
|
||||
class GlanceScenario(base.Scenario):
|
||||
"""Base class for Glance scenarios with basic atomic actions."""
|
||||
|
||||
@base.atomic_action_timer('glance.list_images')
|
||||
@base.atomic_action_timer("glance.list_images")
|
||||
def _list_images(self):
|
||||
"""Returns user images list."""
|
||||
return list(self.clients("glance").images.list())
|
||||
|
||||
@base.atomic_action_timer('glance.create_image')
|
||||
@base.atomic_action_timer("glance.create_image")
|
||||
def _create_image(self, image_name, container_format,
|
||||
image_location, disk_format, **kwargs):
|
||||
"""Create a new image.
|
||||
@ -104,7 +104,7 @@ class GlanceScenario(base.Scenario):
|
||||
|
||||
return image
|
||||
|
||||
@base.atomic_action_timer('glance.delete_image')
|
||||
@base.atomic_action_timer("glance.delete_image")
|
||||
def _delete_image(self, image):
|
||||
"""Deletes given image.
|
||||
|
||||
|
@ -22,29 +22,29 @@ from rally.benchmark import utils as bench_utils
|
||||
|
||||
|
||||
heat_benchmark_opts = [
|
||||
cfg.FloatOpt('heat_stack_create_prepoll_delay',
|
||||
cfg.FloatOpt("heat_stack_create_prepoll_delay",
|
||||
default=2.0,
|
||||
help='Time to sleep after creating a resource before '
|
||||
'polling for it status'),
|
||||
cfg.FloatOpt('heat_stack_create_timeout',
|
||||
help="Time to sleep after creating a resource before "
|
||||
"polling for it status"),
|
||||
cfg.FloatOpt("heat_stack_create_timeout",
|
||||
default=3600.0,
|
||||
help='Time to wait for heat stack to be created.'),
|
||||
cfg.FloatOpt('heat_stack_create_poll_interval',
|
||||
help="Time to wait for heat stack to be created."),
|
||||
cfg.FloatOpt("heat_stack_create_poll_interval",
|
||||
default=1.0,
|
||||
help='Interval between checks when waiting for stack '
|
||||
'creation.'),
|
||||
cfg.FloatOpt('heat_stack_delete_timeout',
|
||||
help="Interval between checks when waiting for stack "
|
||||
"creation."),
|
||||
cfg.FloatOpt("heat_stack_delete_timeout",
|
||||
default=3600.0,
|
||||
help='Time to wait for heat stack to be deleted.'),
|
||||
cfg.FloatOpt('heat_stack_delete_poll_interval',
|
||||
help="Time to wait for heat stack to be deleted."),
|
||||
cfg.FloatOpt("heat_stack_delete_poll_interval",
|
||||
default=1.0,
|
||||
help='Interval between checks when waiting for stack '
|
||||
'deletion.')
|
||||
help="Interval between checks when waiting for stack "
|
||||
"deletion.")
|
||||
]
|
||||
|
||||
|
||||
CONF = cfg.CONF
|
||||
benchmark_group = cfg.OptGroup(name='benchmark', title='benchmark options')
|
||||
benchmark_group = cfg.OptGroup(name="benchmark", title="benchmark options")
|
||||
CONF.register_opts(heat_benchmark_opts, group=benchmark_group)
|
||||
|
||||
|
||||
@ -59,13 +59,13 @@ class HeatScenario(base.Scenario):
|
||||
|
||||
default_template = "HeatTemplateFormatVersion: '2012-12-12'"
|
||||
|
||||
@base.atomic_action_timer('heat.list_stacks')
|
||||
@base.atomic_action_timer("heat.list_stacks")
|
||||
def _list_stacks(self):
|
||||
"""Return user stack list."""
|
||||
|
||||
return list(self.clients("heat").stacks.list())
|
||||
|
||||
@base.atomic_action_timer('heat.create_stack')
|
||||
@base.atomic_action_timer("heat.create_stack")
|
||||
def _create_stack(self, stack_name, template=None):
|
||||
"""Create a new stack.
|
||||
|
||||
@ -101,7 +101,7 @@ class HeatScenario(base.Scenario):
|
||||
|
||||
return stack
|
||||
|
||||
@base.atomic_action_timer('heat.delete_stack')
|
||||
@base.atomic_action_timer("heat.delete_stack")
|
||||
def _delete_stack(self, stack):
|
||||
"""Delete given stack.
|
||||
|
||||
|
@ -27,7 +27,7 @@ class KeystoneScenario(base.Scenario):
|
||||
|
||||
RESOURCE_NAME_PREFIX = "rally_keystone_"
|
||||
|
||||
@base.atomic_action_timer('keystone.create_user')
|
||||
@base.atomic_action_timer("keystone.create_user")
|
||||
def _user_create(self, name_length=10, email=None, **kwargs):
|
||||
"""Creates keystone user with random name.
|
||||
|
||||
@ -51,7 +51,7 @@ class KeystoneScenario(base.Scenario):
|
||||
with base.AtomicAction(self, r):
|
||||
resource.delete()
|
||||
|
||||
@base.atomic_action_timer('keystone.create_tenant')
|
||||
@base.atomic_action_timer("keystone.create_tenant")
|
||||
def _tenant_create(self, name_length=10, **kwargs):
|
||||
"""Creates keystone tenant with random name.
|
||||
|
||||
@ -62,7 +62,7 @@ class KeystoneScenario(base.Scenario):
|
||||
name = self._generate_random_name(length=name_length)
|
||||
return self.admin_clients("keystone").tenants.create(name, **kwargs)
|
||||
|
||||
@base.atomic_action_timer('keystone.create_users')
|
||||
@base.atomic_action_timer("keystone.create_users")
|
||||
def _users_create(self, tenant, users_per_tenant, name_length=10):
|
||||
"""Adds users to a tenant.
|
||||
|
||||
@ -77,12 +77,12 @@ class KeystoneScenario(base.Scenario):
|
||||
self.admin_clients("keystone").users.create(
|
||||
name, password=password, email=email, tenant_id=tenant.id)
|
||||
|
||||
@base.atomic_action_timer('keystone.list_users')
|
||||
@base.atomic_action_timer("keystone.list_users")
|
||||
def _list_users(self):
|
||||
"""List users."""
|
||||
return self.admin_clients("keystone").users.list()
|
||||
|
||||
@base.atomic_action_timer('keystone.list_tenants')
|
||||
@base.atomic_action_timer("keystone.list_tenants")
|
||||
def _list_tenants(self):
|
||||
"""List tenants."""
|
||||
return self.admin_clients("keystone").tenants.list()
|
||||
|
@ -67,7 +67,7 @@ class NeutronNetworks(utils.NeutronScenario):
|
||||
:param network_create_args: dict, POST /v2.0/networks request options
|
||||
"""
|
||||
network = self._create_network(network_create_args or {})
|
||||
self._delete_network(network['network'])
|
||||
self._delete_network(network["network"])
|
||||
|
||||
@validation.number("subnets_per_network", minval=1, integer_only=True)
|
||||
@validation.required_services(consts.Service.NEUTRON)
|
||||
|
@ -29,7 +29,7 @@ class NeutronScenario(base.Scenario):
|
||||
RESOURCE_NAME_LENGTH = 16
|
||||
SUBNET_IP_VERSION = 4
|
||||
|
||||
@base.atomic_action_timer('neutron.create_network')
|
||||
@base.atomic_action_timer("neutron.create_network")
|
||||
def _create_network(self, network_create_args):
|
||||
"""Create neutron network.
|
||||
|
||||
@ -40,12 +40,12 @@ class NeutronScenario(base.Scenario):
|
||||
return self.clients("neutron").create_network(
|
||||
{"network": network_create_args})
|
||||
|
||||
@base.atomic_action_timer('neutron.list_networks')
|
||||
@base.atomic_action_timer("neutron.list_networks")
|
||||
def _list_networks(self):
|
||||
"""Return user networks list."""
|
||||
return self.clients("neutron").list_networks()['networks']
|
||||
return self.clients("neutron").list_networks()["networks"]
|
||||
|
||||
@base.atomic_action_timer('neutron.update_network')
|
||||
@base.atomic_action_timer("neutron.update_network")
|
||||
def _update_network(self, network, network_update_args):
|
||||
"""Update the network name and admin state.
|
||||
|
||||
@ -68,15 +68,15 @@ class NeutronScenario(base.Scenario):
|
||||
return self.clients("neutron").update_network(
|
||||
network["network"]["id"], body)
|
||||
|
||||
@base.atomic_action_timer('neutron.delete_network')
|
||||
@base.atomic_action_timer("neutron.delete_network")
|
||||
def _delete_network(self, network):
|
||||
"""Delete neutron network.
|
||||
|
||||
:param network: Network object
|
||||
"""
|
||||
self.clients("neutron").delete_network(network['id'])
|
||||
self.clients("neutron").delete_network(network["id"])
|
||||
|
||||
@base.atomic_action_timer('neutron.create_subnet')
|
||||
@base.atomic_action_timer("neutron.create_subnet")
|
||||
def _create_subnet(self, network, subnet_create_args, start_cidr=None):
|
||||
"""Create neutron subnet.
|
||||
|
||||
@ -99,12 +99,12 @@ class NeutronScenario(base.Scenario):
|
||||
return self.clients("neutron").create_subnet(
|
||||
{"subnet": subnet_create_args})
|
||||
|
||||
@base.atomic_action_timer('neutron.list_subnets')
|
||||
@base.atomic_action_timer("neutron.list_subnets")
|
||||
def _list_subnets(self):
|
||||
"""Returns user subnetworks list."""
|
||||
return self.clients("neutron").list_subnets()["subnets"]
|
||||
|
||||
@base.atomic_action_timer('neutron.update_subnet')
|
||||
@base.atomic_action_timer("neutron.update_subnet")
|
||||
def _update_subnet(self, subnet, subnet_update_args):
|
||||
"""Update the neutron subnet name and DHCP status.
|
||||
|
||||
@ -127,15 +127,15 @@ class NeutronScenario(base.Scenario):
|
||||
return self.clients("neutron").update_subnet(
|
||||
subnet["subnet"]["id"], body)
|
||||
|
||||
@base.atomic_action_timer('neutron.delete_subnet')
|
||||
@base.atomic_action_timer("neutron.delete_subnet")
|
||||
def _delete_subnet(self, subnet):
|
||||
"""Delete neutron subnet
|
||||
|
||||
:param subnet: Subnet object
|
||||
"""
|
||||
self.clients("neutron").delete_subnet(subnet['subnet']['id'])
|
||||
self.clients("neutron").delete_subnet(subnet["subnet"]["id"])
|
||||
|
||||
@base.atomic_action_timer('neutron.create_router')
|
||||
@base.atomic_action_timer("neutron.create_router")
|
||||
def _create_router(self, router_create_args, external_gw=False):
|
||||
"""Create neutron router.
|
||||
|
||||
@ -157,12 +157,12 @@ class NeutronScenario(base.Scenario):
|
||||
return self.clients("neutron").create_router(
|
||||
{"router": router_create_args})
|
||||
|
||||
@base.atomic_action_timer('neutron.list_routers')
|
||||
@base.atomic_action_timer("neutron.list_routers")
|
||||
def _list_routers(self):
|
||||
"""Returns user routers list."""
|
||||
return self.clients("neutron").list_routers()["routers"]
|
||||
|
||||
@base.atomic_action_timer('neutron.update_router')
|
||||
@base.atomic_action_timer("neutron.update_router")
|
||||
def _update_router(self, router, router_update_args):
|
||||
"""Update the neutron router name and admin state.
|
||||
|
||||
@ -185,7 +185,7 @@ class NeutronScenario(base.Scenario):
|
||||
return self.clients("neutron").update_router(
|
||||
router["router"]["id"], body)
|
||||
|
||||
@base.atomic_action_timer('neutron.create_port')
|
||||
@base.atomic_action_timer("neutron.create_port")
|
||||
def _create_port(self, network, port_create_args):
|
||||
"""Create neutron port.
|
||||
|
||||
@ -198,12 +198,12 @@ class NeutronScenario(base.Scenario):
|
||||
"name", self._generate_random_name("rally_port_"))
|
||||
return self.clients("neutron").create_port({"port": port_create_args})
|
||||
|
||||
@base.atomic_action_timer('neutron.list_ports')
|
||||
@base.atomic_action_timer("neutron.list_ports")
|
||||
def _list_ports(self):
|
||||
"""Return user ports list."""
|
||||
return self.clients("neutron").list_ports()["ports"]
|
||||
|
||||
@base.atomic_action_timer('neutron.update_port')
|
||||
@base.atomic_action_timer("neutron.update_port")
|
||||
def _update_port(self, port, port_update_args):
|
||||
"""Update the neutron port name, admin state, device id and owner.
|
||||
|
||||
@ -230,13 +230,13 @@ class NeutronScenario(base.Scenario):
|
||||
}
|
||||
return self.clients("neutron").update_port(port["port"]["id"], body)
|
||||
|
||||
@base.atomic_action_timer('neutron.delete_port')
|
||||
@base.atomic_action_timer("neutron.delete_port")
|
||||
def _delete_port(self, port):
|
||||
"""Delete neutron port.
|
||||
|
||||
:param port: Port object
|
||||
"""
|
||||
self.clients("neutron").delete_port(port['port']['id'])
|
||||
self.clients("neutron").delete_port(port["port"]["id"])
|
||||
|
||||
def _create_network_and_subnets(self,
|
||||
network_create_args=None,
|
||||
|
@ -131,7 +131,7 @@ class NovaServers(utils.NovaScenario,
|
||||
:param kwargs: Optional additional arguments for server creation
|
||||
"""
|
||||
volume = self._create_volume(volume_size, imageRef=image)
|
||||
block_device_mapping = {'vda': '%s:::1' % volume.id}
|
||||
block_device_mapping = {"vda": "%s:::1" % volume.id}
|
||||
server = self._boot_server(self._generate_random_name(),
|
||||
image, flavor,
|
||||
block_device_mapping=block_device_mapping,
|
||||
@ -169,7 +169,7 @@ class NovaServers(utils.NovaScenario,
|
||||
except jsonschema.exceptions.ValidationError as error:
|
||||
raise rally_exceptions.InvalidConfigException(
|
||||
"Invalid server actions configuration \'%(actions)s\' due to: "
|
||||
"%(error)s" % {'actions': str(actions), 'error': str(error)})
|
||||
"%(error)s" % {"actions": str(actions), "error": str(error)})
|
||||
server = self._boot_server(self._generate_random_name(),
|
||||
image, flavor, **kwargs)
|
||||
for action in action_builder.build_actions(actions, server):
|
||||
@ -241,21 +241,21 @@ class NovaServers(utils.NovaScenario,
|
||||
:param kwargs: Optional additional arguments for server creation
|
||||
"""
|
||||
volume = self._create_volume(volume_size, imageRef=image)
|
||||
block_device_mapping = {'vda': '%s:::1' % volume.id}
|
||||
block_device_mapping = {"vda": "%s:::1" % volume.id}
|
||||
self._boot_server(self._generate_random_name(),
|
||||
image, flavor, auto_assign_nic,
|
||||
block_device_mapping=block_device_mapping,
|
||||
**kwargs)
|
||||
|
||||
def _bind_actions(self):
|
||||
actions = ['hard_reboot', 'soft_reboot', 'stop_start',
|
||||
'rescue_unrescue']
|
||||
actions = ["hard_reboot", "soft_reboot", "stop_start",
|
||||
"rescue_unrescue"]
|
||||
action_builder = scenario_utils.ActionBuilder(actions)
|
||||
action_builder.bind_action('hard_reboot', self._reboot_server)
|
||||
action_builder.bind_action('soft_reboot', self._soft_reboot_server)
|
||||
action_builder.bind_action('stop_start',
|
||||
action_builder.bind_action("hard_reboot", self._reboot_server)
|
||||
action_builder.bind_action("soft_reboot", self._soft_reboot_server)
|
||||
action_builder.bind_action("stop_start",
|
||||
self._stop_and_start_server)
|
||||
action_builder.bind_action('rescue_unrescue',
|
||||
action_builder.bind_action("rescue_unrescue",
|
||||
self._rescue_and_unrescue_server)
|
||||
return action_builder
|
||||
|
||||
@ -312,7 +312,7 @@ class NovaServers(utils.NovaScenario,
|
||||
image, flavor, **kwargs)
|
||||
self._resize(server, to_flavor)
|
||||
# by default we confirm
|
||||
confirm = kwargs.get('confirm', True)
|
||||
confirm = kwargs.get("confirm", True)
|
||||
if confirm:
|
||||
self._resize_confirm(server)
|
||||
else:
|
||||
|
@ -27,21 +27,21 @@ from rally import exceptions
|
||||
nova_benchmark_opts = []
|
||||
option_names_and_defaults = [
|
||||
# action, prepoll delay, timeout, poll interval
|
||||
('start', 0, 300, 1),
|
||||
('stop', 0, 300, 2),
|
||||
('boot', 1, 300, 1),
|
||||
('delete', 2, 300, 2),
|
||||
('reboot', 2, 300, 2),
|
||||
('rescue', 2, 300, 2),
|
||||
('unrescue', 2, 300, 2),
|
||||
('suspend', 2, 300, 2),
|
||||
('image_create', 0, 300, 2),
|
||||
('image_delete', 0, 300, 2),
|
||||
('resize', 2, 400, 5),
|
||||
('resize_confirm', 0, 200, 2),
|
||||
('resize_revert', 0, 200, 2),
|
||||
('live_migrate', 1, 400, 2),
|
||||
('migrate', 1, 400, 2),
|
||||
("start", 0, 300, 1),
|
||||
("stop", 0, 300, 2),
|
||||
("boot", 1, 300, 1),
|
||||
("delete", 2, 300, 2),
|
||||
("reboot", 2, 300, 2),
|
||||
("rescue", 2, 300, 2),
|
||||
("unrescue", 2, 300, 2),
|
||||
("suspend", 2, 300, 2),
|
||||
("image_create", 0, 300, 2),
|
||||
("image_delete", 0, 300, 2),
|
||||
("resize", 2, 400, 5),
|
||||
("resize_confirm", 0, 200, 2),
|
||||
("resize_revert", 0, 200, 2),
|
||||
("live_migrate", 1, 400, 2),
|
||||
("migrate", 1, 400, 2),
|
||||
]
|
||||
|
||||
for action, prepoll, timeout, poll in option_names_and_defaults:
|
||||
@ -49,23 +49,23 @@ for action, prepoll, timeout, poll in option_names_and_defaults:
|
||||
cfg.FloatOpt(
|
||||
"nova_server_%s_prepoll_delay" % action,
|
||||
default=float(prepoll),
|
||||
help='Time to sleep after %s before polling for status' % action
|
||||
help="Time to sleep after %s before polling for status" % action
|
||||
),
|
||||
cfg.FloatOpt(
|
||||
"nova_server_%s_timeout" % action,
|
||||
default=float(timeout),
|
||||
help='Server %s timeout' % action
|
||||
help="Server %s timeout" % action
|
||||
),
|
||||
cfg.FloatOpt(
|
||||
"nova_server_%s_poll_interval" % action,
|
||||
default=float(poll),
|
||||
help='Server %s poll interval' % action
|
||||
help="Server %s poll interval" % action
|
||||
)
|
||||
])
|
||||
|
||||
CONF = cfg.CONF
|
||||
benchmark_group = cfg.OptGroup(name='benchmark',
|
||||
title='benchmark options')
|
||||
benchmark_group = cfg.OptGroup(name="benchmark",
|
||||
title="benchmark options")
|
||||
CONF.register_group(benchmark_group)
|
||||
CONF.register_opts(nova_benchmark_opts, group=benchmark_group)
|
||||
|
||||
@ -73,7 +73,7 @@ CONF.register_opts(nova_benchmark_opts, group=benchmark_group)
|
||||
class NovaScenario(base.Scenario):
|
||||
"""Base class for Nova scenarios with basic atomic actions."""
|
||||
|
||||
@base.atomic_action_timer('nova.list_servers')
|
||||
@base.atomic_action_timer("nova.list_servers")
|
||||
def _list_servers(self, detailed=True):
|
||||
"""Returns user servers list."""
|
||||
return self.clients("nova").servers.list(detailed)
|
||||
@ -137,7 +137,7 @@ class NovaScenario(base.Scenario):
|
||||
check_interval=CONF.benchmark.nova_server_reboot_poll_interval
|
||||
)
|
||||
|
||||
@base.atomic_action_timer('nova.soft_reboot_server')
|
||||
@base.atomic_action_timer("nova.soft_reboot_server")
|
||||
def _soft_reboot_server(self, server):
|
||||
"""Reboot a server with soft reboot.
|
||||
|
||||
@ -148,7 +148,7 @@ class NovaScenario(base.Scenario):
|
||||
"""
|
||||
self._do_server_reboot(server, "SOFT")
|
||||
|
||||
@base.atomic_action_timer('nova.reboot_server')
|
||||
@base.atomic_action_timer("nova.reboot_server")
|
||||
def _reboot_server(self, server):
|
||||
"""Reboot a server with hard reboot.
|
||||
|
||||
@ -159,7 +159,7 @@ class NovaScenario(base.Scenario):
|
||||
"""
|
||||
self._do_server_reboot(server, "HARD")
|
||||
|
||||
@base.atomic_action_timer('nova.start_server')
|
||||
@base.atomic_action_timer("nova.start_server")
|
||||
def _start_server(self, server):
|
||||
"""Start the given server.
|
||||
|
||||
@ -176,7 +176,7 @@ class NovaScenario(base.Scenario):
|
||||
check_interval=CONF.benchmark.nova_server_start_poll_interval
|
||||
)
|
||||
|
||||
@base.atomic_action_timer('nova.stop_server')
|
||||
@base.atomic_action_timer("nova.stop_server")
|
||||
def _stop_server(self, server):
|
||||
"""Stop the given server.
|
||||
|
||||
@ -193,7 +193,7 @@ class NovaScenario(base.Scenario):
|
||||
check_interval=CONF.benchmark.nova_server_stop_poll_interval
|
||||
)
|
||||
|
||||
@base.atomic_action_timer('nova.rescue_server')
|
||||
@base.atomic_action_timer("nova.rescue_server")
|
||||
def _rescue_server(self, server):
|
||||
"""Rescue the given server.
|
||||
|
||||
@ -211,7 +211,7 @@ class NovaScenario(base.Scenario):
|
||||
check_interval=CONF.benchmark.nova_server_rescue_poll_interval
|
||||
)
|
||||
|
||||
@base.atomic_action_timer('nova.unrescue_server')
|
||||
@base.atomic_action_timer("nova.unrescue_server")
|
||||
def _unrescue_server(self, server):
|
||||
"""Unrescue the given server.
|
||||
|
||||
@ -228,7 +228,7 @@ class NovaScenario(base.Scenario):
|
||||
check_interval=CONF.benchmark.nova_server_unrescue_poll_interval
|
||||
)
|
||||
|
||||
@base.atomic_action_timer('nova.suspend_server')
|
||||
@base.atomic_action_timer("nova.suspend_server")
|
||||
def _suspend_server(self, server):
|
||||
"""Suspends the given server.
|
||||
|
||||
@ -254,7 +254,7 @@ class NovaScenario(base.Scenario):
|
||||
:param server: Server object
|
||||
:param force: If True, force_delete will be used instead of delete.
|
||||
"""
|
||||
atomic_name = ('nova.%sdelete_server') % (force and "force_" or "")
|
||||
atomic_name = ("nova.%sdelete_server") % (force and "force_" or "")
|
||||
with base.AtomicAction(self, atomic_name):
|
||||
if force:
|
||||
server.force_delete()
|
||||
@ -273,14 +273,14 @@ class NovaScenario(base.Scenario):
|
||||
|
||||
:param force: If True, force_delete will be used instead of delete.
|
||||
"""
|
||||
atomic_name = ('nova.%sdelete_all_servers') % (force
|
||||
atomic_name = ("nova.%sdelete_all_servers") % (force
|
||||
and "force_" or "")
|
||||
with base.AtomicAction(self, atomic_name):
|
||||
servers = self.clients("nova").servers.list()
|
||||
for server in servers:
|
||||
self._delete_server(server, force)
|
||||
|
||||
@base.atomic_action_timer('nova.delete_image')
|
||||
@base.atomic_action_timer("nova.delete_image")
|
||||
def _delete_image(self, image):
|
||||
"""Delete the given image.
|
||||
|
||||
@ -297,7 +297,7 @@ class NovaScenario(base.Scenario):
|
||||
check_interval=check_interval
|
||||
)
|
||||
|
||||
@base.atomic_action_timer('nova.create_image')
|
||||
@base.atomic_action_timer("nova.create_image")
|
||||
def _create_image(self, server):
|
||||
"""Create an image from the given server
|
||||
|
||||
@ -321,7 +321,7 @@ class NovaScenario(base.Scenario):
|
||||
)
|
||||
return image
|
||||
|
||||
@base.atomic_action_timer('nova.boot_servers')
|
||||
@base.atomic_action_timer("nova.boot_servers")
|
||||
def _boot_servers(self, name_prefix, image_id, flavor_id,
|
||||
requests, instances_amount=1, **kwargs):
|
||||
"""Boot multiple servers.
|
||||
@ -339,7 +339,7 @@ class NovaScenario(base.Scenario):
|
||||
:returns: List of created server objects
|
||||
"""
|
||||
for i in range(requests):
|
||||
self.clients("nova").servers.create('%s_%d' % (name_prefix, i),
|
||||
self.clients("nova").servers.create("%s_%d" % (name_prefix, i),
|
||||
image_id, flavor_id,
|
||||
min_count=instances_amount,
|
||||
max_count=instances_amount,
|
||||
@ -360,17 +360,17 @@ class NovaScenario(base.Scenario):
|
||||
) for server in servers]
|
||||
return servers
|
||||
|
||||
@base.atomic_action_timer('nova.list_floating_ip_pools')
|
||||
@base.atomic_action_timer("nova.list_floating_ip_pools")
|
||||
def _list_floating_ip_pools(self):
|
||||
"""Return user floating ip pools list."""
|
||||
return self.clients("nova").floating_ip_pools.list()
|
||||
|
||||
@base.atomic_action_timer('nova.list_floating_ips')
|
||||
@base.atomic_action_timer("nova.list_floating_ips")
|
||||
def _list_floating_ips(self):
|
||||
"""Return user floating ips list."""
|
||||
return self.clients("nova").floating_ips.list()
|
||||
|
||||
@base.atomic_action_timer('nova.create_floating_ip')
|
||||
@base.atomic_action_timer("nova.create_floating_ip")
|
||||
def _create_floating_ip(self, pool):
|
||||
"""Create (allocate) a floating ip from the given pool
|
||||
|
||||
@ -380,7 +380,7 @@ class NovaScenario(base.Scenario):
|
||||
"""
|
||||
return self.clients("nova").floating_ips.create(pool)
|
||||
|
||||
@base.atomic_action_timer('nova.delete_floating_ip')
|
||||
@base.atomic_action_timer("nova.delete_floating_ip")
|
||||
def _delete_floating_ip(self, floating_ip):
|
||||
"""Delete (deallocate) a floating ip for a tenant
|
||||
|
||||
@ -392,7 +392,7 @@ class NovaScenario(base.Scenario):
|
||||
update_resource=bench_utils.get_from_manager()
|
||||
)
|
||||
|
||||
@base.atomic_action_timer('nova.associate_floating_ip')
|
||||
@base.atomic_action_timer("nova.associate_floating_ip")
|
||||
def _associate_floating_ip(self, server, address, fixed_address=None):
|
||||
"""Add floating IP to an instance
|
||||
|
||||
@ -410,7 +410,7 @@ class NovaScenario(base.Scenario):
|
||||
# Update server data
|
||||
server.addresses = server.manager.get(server.id).addresses
|
||||
|
||||
@base.atomic_action_timer('nova.dissociate_floating_ip')
|
||||
@base.atomic_action_timer("nova.dissociate_floating_ip")
|
||||
def _dissociate_floating_ip(self, server, address):
|
||||
"""Remove floating IP from an instance
|
||||
|
||||
@ -438,12 +438,12 @@ class NovaScenario(base.Scenario):
|
||||
return not must_exist
|
||||
return _check_addr
|
||||
|
||||
@base.atomic_action_timer('nova.list_networks')
|
||||
@base.atomic_action_timer("nova.list_networks")
|
||||
def _list_networks(self):
|
||||
"""Return user networks list."""
|
||||
return self.clients("nova").networks.list()
|
||||
|
||||
@base.atomic_action_timer('nova.resize')
|
||||
@base.atomic_action_timer("nova.resize")
|
||||
def _resize(self, server, flavor):
|
||||
server.resize(flavor)
|
||||
bench_utils.wait_for(
|
||||
@ -454,7 +454,7 @@ class NovaScenario(base.Scenario):
|
||||
check_interval=CONF.benchmark.nova_server_resize_poll_interval
|
||||
)
|
||||
|
||||
@base.atomic_action_timer('nova.resize_confirm')
|
||||
@base.atomic_action_timer("nova.resize_confirm")
|
||||
def _resize_confirm(self, server, status="ACTIVE"):
|
||||
server.confirm_resize()
|
||||
bench_utils.wait_for(
|
||||
@ -466,7 +466,7 @@ class NovaScenario(base.Scenario):
|
||||
CONF.benchmark.nova_server_resize_confirm_poll_interval)
|
||||
)
|
||||
|
||||
@base.atomic_action_timer('nova.resize_revert')
|
||||
@base.atomic_action_timer("nova.resize_revert")
|
||||
def _resize_revert(self, server, status="ACTIVE"):
|
||||
server.revert_resize()
|
||||
bench_utils.wait_for(
|
||||
@ -478,7 +478,7 @@ class NovaScenario(base.Scenario):
|
||||
CONF.benchmark.nova_server_resize_revert_poll_interval)
|
||||
)
|
||||
|
||||
@base.atomic_action_timer('nova.attach_volume')
|
||||
@base.atomic_action_timer("nova.attach_volume")
|
||||
def _attach_volume(self, server, volume, device=None):
|
||||
server_id = server.id
|
||||
volume_id = volume.id
|
||||
@ -494,7 +494,7 @@ class NovaScenario(base.Scenario):
|
||||
CONF.benchmark.nova_server_resize_revert_poll_interval)
|
||||
)
|
||||
|
||||
@base.atomic_action_timer('nova.detach_volume')
|
||||
@base.atomic_action_timer("nova.detach_volume")
|
||||
def _detach_volume(self, server, volume):
|
||||
server_id = server.id
|
||||
volume_id = volume.id
|
||||
@ -509,7 +509,7 @@ class NovaScenario(base.Scenario):
|
||||
CONF.benchmark.nova_server_resize_revert_poll_interval)
|
||||
)
|
||||
|
||||
@base.atomic_action_timer('nova.live_migrate')
|
||||
@base.atomic_action_timer("nova.live_migrate")
|
||||
def _live_migrate(self, server, target_host, block_migration=False,
|
||||
disk_over_commit=False, skip_host_check=False):
|
||||
"""Run live migration of the given server.
|
||||
@ -542,7 +542,7 @@ class NovaScenario(base.Scenario):
|
||||
"Migration complete but instance did not change host: %s" %
|
||||
host_pre_migrate)
|
||||
|
||||
@base.atomic_action_timer('nova.find_host_to_migrate')
|
||||
@base.atomic_action_timer("nova.find_host_to_migrate")
|
||||
def _find_host_to_migrate(self, server):
|
||||
"""Find a compute node for live migration.
|
||||
|
||||
@ -607,7 +607,7 @@ class NovaScenario(base.Scenario):
|
||||
|
||||
def _create_rules_for_security_group(self, security_groups,
|
||||
rules_per_security_group,
|
||||
ip_protocol='tcp', cidr="0.0.0.0/0"):
|
||||
ip_protocol="tcp", cidr="0.0.0.0/0"):
|
||||
action_name = ("nova.create_%s_rules" % (rules_per_security_group *
|
||||
len(security_groups)))
|
||||
with base.AtomicAction(self, action_name):
|
||||
|
@ -31,7 +31,7 @@ class Quotas(utils.QuotasScenario):
|
||||
:param max_quota: Max value to be updated for quota.
|
||||
"""
|
||||
tenant_id = self.context["user"]["tenant_id"]
|
||||
self._update_quotas('nova', tenant_id, max_quota)
|
||||
self._update_quotas("nova", tenant_id, max_quota)
|
||||
|
||||
@validation.required_services(consts.Service.NOVA)
|
||||
@validation.required_openstack(admin=True, users=True)
|
||||
@ -43,8 +43,8 @@ class Quotas(utils.QuotasScenario):
|
||||
"""
|
||||
|
||||
tenant_id = self.context["user"]["tenant_id"]
|
||||
self._update_quotas('nova', tenant_id, max_quota)
|
||||
self._delete_quotas('nova', tenant_id)
|
||||
self._update_quotas("nova", tenant_id, max_quota)
|
||||
self._delete_quotas("nova", tenant_id)
|
||||
|
||||
@validation.required_services(consts.Service.CINDER)
|
||||
@validation.required_openstack(admin=True, users=True)
|
||||
@ -55,7 +55,7 @@ class Quotas(utils.QuotasScenario):
|
||||
:param max_quota: Max value to be updated for quota.
|
||||
"""
|
||||
tenant_id = self.context["user"]["tenant_id"]
|
||||
self._update_quotas('cinder', tenant_id, max_quota)
|
||||
self._update_quotas("cinder", tenant_id, max_quota)
|
||||
|
||||
@validation.required_services(consts.Service.CINDER)
|
||||
@validation.required_openstack(admin=True, users=True)
|
||||
@ -66,5 +66,5 @@ class Quotas(utils.QuotasScenario):
|
||||
:param max_quota: Max value to be updated for quota.
|
||||
"""
|
||||
tenant_id = self.context["user"]["tenant_id"]
|
||||
self._update_quotas('cinder', tenant_id, max_quota)
|
||||
self._delete_quotas('cinder', tenant_id)
|
||||
self._update_quotas("cinder", tenant_id, max_quota)
|
||||
self._delete_quotas("cinder", tenant_id)
|
||||
|
@ -21,7 +21,7 @@ from rally.benchmark.scenarios import base
|
||||
class QuotasScenario(base.Scenario):
|
||||
"""Base class for quotas scenarios with basic atomic actions."""
|
||||
|
||||
@base.atomic_action_timer('quotas.update_quotas')
|
||||
@base.atomic_action_timer("quotas.update_quotas")
|
||||
def _update_quotas(self, component, tenant_id, max_quota=1024):
|
||||
"""Update quotas.
|
||||
|
||||
@ -34,7 +34,7 @@ class QuotasScenario(base.Scenario):
|
||||
quotas = self._generate_quota_values(max_quota, component)
|
||||
return self.admin_clients(component).quotas.update(tenant_id, **quotas)
|
||||
|
||||
@base.atomic_action_timer('quotas.delete_quotas')
|
||||
@base.atomic_action_timer("quotas.delete_quotas")
|
||||
def _delete_quotas(self, component, tenant_id):
|
||||
"""Delete quotas.
|
||||
|
||||
@ -47,19 +47,19 @@ class QuotasScenario(base.Scenario):
|
||||
quotas = {}
|
||||
if component == "nova":
|
||||
quotas = {
|
||||
'metadata_items': random.randint(-1, max_quota),
|
||||
'key_pairs': random.randint(-1, max_quota),
|
||||
'injected_file_content_bytes': random.randint(-1, max_quota),
|
||||
'injected_file_path_bytes': random.randint(-1, max_quota),
|
||||
'ram': random.randint(-1, max_quota),
|
||||
'instances': random.randint(-1, max_quota),
|
||||
'injected_files': random.randint(-1, max_quota),
|
||||
'cores': random.randint(-1, max_quota)
|
||||
"metadata_items": random.randint(-1, max_quota),
|
||||
"key_pairs": random.randint(-1, max_quota),
|
||||
"injected_file_content_bytes": random.randint(-1, max_quota),
|
||||
"injected_file_path_bytes": random.randint(-1, max_quota),
|
||||
"ram": random.randint(-1, max_quota),
|
||||
"instances": random.randint(-1, max_quota),
|
||||
"injected_files": random.randint(-1, max_quota),
|
||||
"cores": random.randint(-1, max_quota)
|
||||
}
|
||||
elif component == "cinder":
|
||||
quotas = {
|
||||
'volumes': random.randint(-1, max_quota),
|
||||
'snapshots': random.randint(-1, max_quota),
|
||||
'gigabytes': random.randint(-1, max_quota),
|
||||
"volumes": random.randint(-1, max_quota),
|
||||
"snapshots": random.randint(-1, max_quota),
|
||||
"gigabytes": random.randint(-1, max_quota),
|
||||
}
|
||||
return quotas
|
||||
|
@ -29,7 +29,7 @@ class SaharaClusters(utils.SaharaScenario):
|
||||
@types.set(flavor=types.FlavorResourceType,
|
||||
neutron_net=types.NeutronNetworkResourceType,
|
||||
floating_ip_pool=types.NeutronNetworkResourceType)
|
||||
@validation.flavor_exists('flavor')
|
||||
@validation.flavor_exists("flavor")
|
||||
@validation.required_contexts("users", "sahara_image")
|
||||
@validation.number("workers_count", minval=1, integer_only=True)
|
||||
@validation.required_services(consts.Service.SAHARA)
|
||||
@ -94,7 +94,7 @@ class SaharaClusters(utils.SaharaScenario):
|
||||
self._delete_cluster(cluster)
|
||||
|
||||
@types.set(flavor=types.FlavorResourceType)
|
||||
@validation.flavor_exists('flavor')
|
||||
@validation.flavor_exists("flavor")
|
||||
@validation.required_services(consts.Service.SAHARA)
|
||||
@validation.required_contexts("users", "sahara_image")
|
||||
@validation.number("workers_count", minval=1, integer_only=True)
|
||||
|
@ -24,7 +24,7 @@ class SaharaNodeGroupTemplates(utils.SaharaScenario):
|
||||
"""Benchmark scenarios for Sahara node group templates."""
|
||||
|
||||
@types.set(flavor=types.FlavorResourceType)
|
||||
@validation.flavor_exists('flavor')
|
||||
@validation.flavor_exists("flavor")
|
||||
@validation.required_services(consts.Service.SAHARA)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["sahara"]})
|
||||
@ -59,7 +59,7 @@ class SaharaNodeGroupTemplates(utils.SaharaScenario):
|
||||
self._list_node_group_templates()
|
||||
|
||||
@types.set(flavor=types.FlavorResourceType)
|
||||
@validation.flavor_exists('flavor')
|
||||
@validation.flavor_exists("flavor")
|
||||
@validation.required_services(consts.Service.SAHARA)
|
||||
@validation.required_openstack(users=True)
|
||||
@base.scenario(context={"cleanup": ["sahara"]})
|
||||
|
@ -39,7 +39,7 @@ TIMEOUT_OPTS = [
|
||||
help="Cluster status polling interval in seconds")
|
||||
]
|
||||
|
||||
benchmark_group = cfg.OptGroup(name='benchmark', title='benchmark options')
|
||||
benchmark_group = cfg.OptGroup(name="benchmark", title="benchmark options")
|
||||
CONF.register_opts(TIMEOUT_OPTS, group=benchmark_group)
|
||||
|
||||
|
||||
@ -68,11 +68,11 @@ class SaharaScenario(base.Scenario):
|
||||
},
|
||||
"hdp": {
|
||||
"1.3.2": {
|
||||
"master": ['JOBTRACKER', 'NAMENODE', 'SECONDARY_NAMENODE',
|
||||
'GANGLIA_SERVER', 'NAGIOS_SERVER',
|
||||
'AMBARI_SERVER', 'OOZIE_SERVER'],
|
||||
"worker": ['TASKTRACKER', 'DATANODE', 'HDFS_CLIENT',
|
||||
'MAPREDUCE_CLIENT', 'OOZIE_CLIENT', 'PIG']
|
||||
"master": ["JOBTRACKER", "NAMENODE", "SECONDARY_NAMENODE",
|
||||
"GANGLIA_SERVER", "NAGIOS_SERVER",
|
||||
"AMBARI_SERVER", "OOZIE_SERVER"],
|
||||
"worker": ["TASKTRACKER", "DATANODE", "HDFS_CLIENT",
|
||||
"MAPREDUCE_CLIENT", "OOZIE_CLIENT", "PIG"]
|
||||
},
|
||||
"2.0.6": {
|
||||
"manager": ["AMBARI_SERVER", "GANGLIA_SERVER",
|
||||
@ -129,12 +129,12 @@ class SaharaScenario(base.Scenario):
|
||||
}
|
||||
}
|
||||
|
||||
@base.atomic_action_timer('sahara.list_node_group_templates')
|
||||
@base.atomic_action_timer("sahara.list_node_group_templates")
|
||||
def _list_node_group_templates(self):
|
||||
"""Return user Node Group Templates list."""
|
||||
return self.clients("sahara").node_group_templates.list()
|
||||
|
||||
@base.atomic_action_timer('sahara.create_master_node_group_template')
|
||||
@base.atomic_action_timer("sahara.create_master_node_group_template")
|
||||
def _create_master_node_group_template(self, flavor_id, plugin_name,
|
||||
hadoop_version):
|
||||
"""Create a master Node Group Template with a random name.
|
||||
@ -155,7 +155,7 @@ class SaharaScenario(base.Scenario):
|
||||
node_processes=self.NODE_PROCESSES[plugin_name][hadoop_version]
|
||||
["master"])
|
||||
|
||||
@base.atomic_action_timer('sahara.create_worker_node_group_template')
|
||||
@base.atomic_action_timer("sahara.create_worker_node_group_template")
|
||||
def _create_worker_node_group_template(self, flavor_id, plugin_name,
|
||||
hadoop_version):
|
||||
"""Create a worker Node Group Template with a random name.
|
||||
@ -176,7 +176,7 @@ class SaharaScenario(base.Scenario):
|
||||
node_processes=self.NODE_PROCESSES[plugin_name][hadoop_version]
|
||||
["worker"])
|
||||
|
||||
@base.atomic_action_timer('sahara.delete_node_group_template')
|
||||
@base.atomic_action_timer("sahara.delete_node_group_template")
|
||||
def _delete_node_group_template(self, node_group):
|
||||
"""Delete a Node Group Template by id.
|
||||
|
||||
@ -294,7 +294,7 @@ class SaharaScenario(base.Scenario):
|
||||
}
|
||||
return replication_config
|
||||
|
||||
@base.atomic_action_timer('sahara.launch_cluster')
|
||||
@base.atomic_action_timer("sahara.launch_cluster")
|
||||
def _launch_cluster(self, plugin_name, hadoop_version, flavor_id,
|
||||
image_id, workers_count, floating_ip_pool=None,
|
||||
volumes_per_node=None,
|
||||
@ -439,7 +439,7 @@ class SaharaScenario(base.Scenario):
|
||||
|
||||
self._wait_active(cluster)
|
||||
|
||||
@base.atomic_action_timer('sahara.scale_up')
|
||||
@base.atomic_action_timer("sahara.scale_up")
|
||||
def _scale_cluster_up(self, cluster, delta):
|
||||
"""Add a given number of worker nodes to the cluster.
|
||||
|
||||
@ -449,7 +449,7 @@ class SaharaScenario(base.Scenario):
|
||||
"""
|
||||
self._scale_cluster(cluster, delta)
|
||||
|
||||
@base.atomic_action_timer('sahara.scale_down')
|
||||
@base.atomic_action_timer("sahara.scale_down")
|
||||
def _scale_cluster_down(self, cluster, delta):
|
||||
"""Remove a given number of worker nodes from the cluster.
|
||||
|
||||
@ -459,7 +459,7 @@ class SaharaScenario(base.Scenario):
|
||||
"""
|
||||
self._scale_cluster(cluster, delta)
|
||||
|
||||
@base.atomic_action_timer('sahara.delete_cluster')
|
||||
@base.atomic_action_timer("sahara.delete_cluster")
|
||||
def _delete_cluster(self, cluster):
|
||||
"""Delete cluster.
|
||||
|
||||
@ -519,7 +519,7 @@ class SaharaScenario(base.Scenario):
|
||||
:param job_idx: The index of a job in a sequence
|
||||
|
||||
"""
|
||||
@base.atomic_action_timer('sahara.job_execution_%s' % job_idx)
|
||||
@base.atomic_action_timer("sahara.job_execution_%s" % job_idx)
|
||||
def run(self):
|
||||
job_execution = self.clients("sahara").job_executions.create(
|
||||
job_id=job_id,
|
||||
@ -538,7 +538,7 @@ class SaharaScenario(base.Scenario):
|
||||
|
||||
def _job_execution_is_finished(self, je_id):
|
||||
status = self.clients("sahara").job_executions.get(je_id).info[
|
||||
'status']
|
||||
"status"]
|
||||
if status.lower() in ("success", "succeeded"):
|
||||
return True
|
||||
elif status.lower() in ("failed", "killed"):
|
||||
|
@ -34,7 +34,7 @@ class TempestScenario(base.Scenario):
|
||||
:param tempest_conf: User specified tempest.conf location
|
||||
"""
|
||||
if (not test_name.startswith("tempest.api.")
|
||||
and test_name.split('.')[0] in consts.TEMPEST_TEST_SETS):
|
||||
and test_name.split(".")[0] in consts.TEMPEST_TEST_SETS):
|
||||
test_name = "tempest.api." + test_name
|
||||
|
||||
self.context["verifier"].run(test_name, log_file=log_file,
|
||||
|
@ -23,7 +23,7 @@ class ActionBuilder(object):
|
||||
An action list is an array of single key/value dicts which takes
|
||||
the form:
|
||||
|
||||
[{'action': times}, {'action': times}...]
|
||||
[{"action": times}, {"action": times}...]
|
||||
|
||||
Here 'action' is a string which indicates a action to perform and
|
||||
'times' is a non-zero positive integer which specifies how many
|
||||
@ -60,7 +60,7 @@ class ActionBuilder(object):
|
||||
self._bindings = {}
|
||||
self.schema = dict(ActionBuilder.SCHEMA_TEMPLATE)
|
||||
for kw in action_keywords:
|
||||
self.schema['items']['properties'][kw] = (
|
||||
self.schema["items"]["properties"][kw] = (
|
||||
ActionBuilder.ITEM_TEMPLATE)
|
||||
|
||||
def bind_action(self, action_key, action, *args, **kwargs):
|
||||
@ -76,9 +76,9 @@ class ActionBuilder(object):
|
||||
"""
|
||||
self.validate([{action_key: 1}])
|
||||
self._bindings[action_key] = {
|
||||
'action': action,
|
||||
'args': args or (),
|
||||
'kwargs': kwargs or {}
|
||||
"action": action,
|
||||
"args": args or (),
|
||||
"kwargs": kwargs or {}
|
||||
}
|
||||
|
||||
def validate(self, actions):
|
||||
@ -116,9 +116,9 @@ class ActionBuilder(object):
|
||||
action_key = action.keys()[0]
|
||||
times = action.get(action_key)
|
||||
binding = self._bindings.get(action_key)
|
||||
dft_kwargs = dict(binding['kwargs'])
|
||||
dft_kwargs = dict(binding["kwargs"])
|
||||
dft_kwargs.update(kwargs or {})
|
||||
bound_actions.append(self._build(
|
||||
binding['action'], times,
|
||||
*(binding['args'] + args), **dft_kwargs))
|
||||
binding["action"], times,
|
||||
*(binding["args"] + args), **dft_kwargs))
|
||||
return bound_actions
|
||||
|
@ -29,7 +29,7 @@ class VMScenario(base.Scenario):
|
||||
VM scenarios are scenarios executed inside some launched VM instance.
|
||||
"""
|
||||
|
||||
@base.atomic_action_timer('vm.run_command')
|
||||
@base.atomic_action_timer("vm.run_command")
|
||||
def run_action(self, ssh, interpreter, script):
|
||||
"""Run command inside an instance.
|
||||
|
||||
@ -39,11 +39,11 @@ class VMScenario(base.Scenario):
|
||||
"""
|
||||
return ssh.execute(interpreter, stdin=open(script, "rb"))
|
||||
|
||||
@base.atomic_action_timer('vm.wait_for_ssh')
|
||||
@base.atomic_action_timer("vm.wait_for_ssh")
|
||||
def wait_for_ssh(self, ssh):
|
||||
ssh.wait()
|
||||
|
||||
@base.atomic_action_timer('vm.wait_for_ping')
|
||||
@base.atomic_action_timer("vm.wait_for_ping")
|
||||
def wait_for_ping(self, server_ip):
|
||||
bench_utils.wait_for(
|
||||
server_ip,
|
||||
@ -71,11 +71,11 @@ class VMScenario(base.Scenario):
|
||||
@staticmethod
|
||||
def ping_ip_address(host, should_succeed=True):
|
||||
ip = netaddr.IPAddress(host)
|
||||
ping = 'ping' if ip.version == 4 else 'ping6'
|
||||
if sys.platform.startswith('linux'):
|
||||
cmd = [ping, '-c1', '-w1', host]
|
||||
ping = "ping" if ip.version == 4 else "ping6"
|
||||
if sys.platform.startswith("linux"):
|
||||
cmd = [ping, "-c1", "-w1", host]
|
||||
else:
|
||||
cmd = [ping, '-c1', host]
|
||||
cmd = [ping, "-c1", host]
|
||||
|
||||
proc = subprocess.Popen(cmd,
|
||||
stdout=subprocess.PIPE,
|
||||
|
@ -18,7 +18,7 @@ from rally.benchmark.scenarios import base
|
||||
class ZaqarScenario(base.Scenario):
|
||||
"""Base class for Zaqar scenarios with basic atomic actions."""
|
||||
|
||||
@base.atomic_action_timer('zaqar.create_queue')
|
||||
@base.atomic_action_timer("zaqar.create_queue")
|
||||
def _queue_create(self, name_length=10, **kwargs):
|
||||
"""Create a Zaqar queue with random name.
|
||||
|
||||
@ -30,7 +30,7 @@ class ZaqarScenario(base.Scenario):
|
||||
name = self._generate_random_name(length=name_length)
|
||||
return self.clients("zaqar").queue(name, **kwargs)
|
||||
|
||||
@base.atomic_action_timer('zaqar.delete_queue')
|
||||
@base.atomic_action_timer("zaqar.delete_queue")
|
||||
def _queue_delete(self, queue):
|
||||
"""Removes a Zaqar queue.
|
||||
|
||||
@ -47,11 +47,11 @@ class ZaqarScenario(base.Scenario):
|
||||
:param min_msg_count: minimum number of messages
|
||||
:param max_msg_count: maximum number of messages
|
||||
"""
|
||||
with base.AtomicAction(self, 'zaqar.post_between_%s_and_%s_messages' %
|
||||
with base.AtomicAction(self, "zaqar.post_between_%s_and_%s_messages" %
|
||||
(min_msg_count, max_msg_count)):
|
||||
queue.post(messages)
|
||||
|
||||
@base.atomic_action_timer('zaqar.list_messages')
|
||||
@base.atomic_action_timer("zaqar.list_messages")
|
||||
def _messages_list(self, queue):
|
||||
"""Gets messages from a given Zaqar queue.
|
||||
|
||||
|
@ -78,9 +78,9 @@ class SLA(object):
|
||||
|
||||
for name, criterion in six.iteritems(config.get("sla", {})):
|
||||
check_result = opt_name_map[name].check(criterion, result)
|
||||
results.append({'criterion': name,
|
||||
'success': check_result.success,
|
||||
'detail': check_result.msg})
|
||||
results.append({"criterion": name,
|
||||
"success": check_result.success,
|
||||
"detail": check_result.msg})
|
||||
return results
|
||||
|
||||
@staticmethod
|
||||
@ -99,7 +99,7 @@ class FailureRateDeprecated(SLA):
|
||||
|
||||
@staticmethod
|
||||
def check(criterion_value, result):
|
||||
errors = len(filter(lambda x: x['error'], result))
|
||||
errors = len(filter(lambda x: x["error"], result))
|
||||
error_rate = errors * 100.0 / len(result) if len(result) > 0 else 100.0
|
||||
if criterion_value < error_rate:
|
||||
success = False
|
||||
@ -126,7 +126,7 @@ class FailureRate(SLA):
|
||||
def check(criterion_value, result):
|
||||
min_percent = criterion_value.get("min", 0)
|
||||
max_percent = criterion_value.get("max", 100)
|
||||
errors = len(filter(lambda x: x['error'], result))
|
||||
errors = len(filter(lambda x: x["error"], result))
|
||||
error_rate = errors * 100.0 / len(result) if len(result) > 0 else 100.0
|
||||
|
||||
success = min_percent <= error_rate <= max_percent
|
||||
@ -149,9 +149,9 @@ class IterationTime(SLA):
|
||||
duration = 0
|
||||
success = True
|
||||
for i in result:
|
||||
if i['duration'] >= duration:
|
||||
duration = i['duration']
|
||||
if i['duration'] > criterion_value:
|
||||
if i["duration"] >= duration:
|
||||
duration = i["duration"]
|
||||
if i["duration"] > criterion_value:
|
||||
success = False
|
||||
msg = (_("Maximum seconds per iteration %ss, found with %ss") %
|
||||
(criterion_value, duration))
|
||||
|
@ -31,7 +31,7 @@ def set(**kwargs):
|
||||
used to perform a transformation on the value of that key.
|
||||
"""
|
||||
def wrapper(func):
|
||||
func.preprocessors = getattr(func, 'preprocessors', {})
|
||||
func.preprocessors = getattr(func, "preprocessors", {})
|
||||
func.preprocessors.update(kwargs)
|
||||
return func
|
||||
return wrapper
|
||||
@ -162,12 +162,12 @@ class FlavorResourceType(ResourceType):
|
||||
|
||||
:returns: id matching resource
|
||||
"""
|
||||
resource_id = resource_config.get('id')
|
||||
resource_id = resource_config.get("id")
|
||||
if not resource_id:
|
||||
novaclient = clients.nova()
|
||||
resource_id = _id_from_name(resource_config=resource_config,
|
||||
resources=novaclient.flavors.list(),
|
||||
typename='flavor')
|
||||
typename="flavor")
|
||||
return resource_id
|
||||
|
||||
|
||||
@ -182,13 +182,13 @@ class ImageResourceType(ResourceType):
|
||||
|
||||
:returns: id matching resource
|
||||
"""
|
||||
resource_id = resource_config.get('id')
|
||||
resource_id = resource_config.get("id")
|
||||
if not resource_id:
|
||||
glanceclient = clients.glance()
|
||||
resource_id = _id_from_name(resource_config=resource_config,
|
||||
resources=list(
|
||||
glanceclient.images.list()),
|
||||
typename='image')
|
||||
typename="image")
|
||||
return resource_id
|
||||
|
||||
|
||||
@ -203,13 +203,13 @@ class VolumeTypeResourceType(ResourceType):
|
||||
|
||||
:returns: id matching resource
|
||||
"""
|
||||
resource_id = resource_config.get('id')
|
||||
resource_id = resource_config.get("id")
|
||||
if not resource_id:
|
||||
cinderclient = clients.cinder()
|
||||
resource_id = _id_from_name(resource_config=resource_config,
|
||||
resources=cinderclient.
|
||||
volume_types.list(),
|
||||
typename='volume_type')
|
||||
typename="volume_type")
|
||||
return resource_id
|
||||
|
||||
|
||||
@ -224,7 +224,7 @@ class NeutronNetworkResourceType(ResourceType):
|
||||
|
||||
:returns: id matching resource
|
||||
"""
|
||||
resource_id = resource_config.get('id')
|
||||
resource_id = resource_config.get("id")
|
||||
if resource_id:
|
||||
return resource_id
|
||||
else:
|
||||
|
@ -49,7 +49,7 @@ def get_from_manager(error_statuses=None):
|
||||
try:
|
||||
res = resource.manager.get(resource.id)
|
||||
except Exception as e:
|
||||
if getattr(e, 'code', 400) == 404:
|
||||
if getattr(e, "code", 400) == 404:
|
||||
raise exceptions.GetResourceNotFound(resource=resource)
|
||||
raise exceptions.GetResourceFailure(resource=resource, err=e)
|
||||
|
||||
@ -60,9 +60,9 @@ def get_from_manager(error_statuses=None):
|
||||
raise exceptions.GetResourceNotFound(resource=res)
|
||||
if status in error_statuses:
|
||||
if isinstance(res.manager, servers.ServerManager):
|
||||
msg = res.fault['message']
|
||||
msg = res.fault["message"]
|
||||
else:
|
||||
msg = ''
|
||||
msg = ""
|
||||
raise exceptions.GetResourceErrorStatus(resource=res,
|
||||
status=status, fault=msg)
|
||||
|
||||
@ -149,7 +149,7 @@ def check_service_status(client, service_name):
|
||||
try:
|
||||
for service in client.services.list():
|
||||
if service_name in str(service):
|
||||
if service.status == 'enabled' and service.state == 'up':
|
||||
if service.status == "enabled" and service.state == "up":
|
||||
return True
|
||||
except nova_exc.NotFound:
|
||||
LOG.warning(_("Unable to retrieve a list of available services from "
|
||||
|
@ -47,7 +47,7 @@ def validator(fn):
|
||||
"""Dynamic validation decorator for scenario.
|
||||
|
||||
:param args: the arguments of the decorator of the benchmark scenario
|
||||
ex. @my_decorator("arg1"), then args = ('arg1',)
|
||||
ex. @my_decorator("arg1"), then args = ("arg1",)
|
||||
:param kwargs: the keyword arguments of the decorator of the scenario
|
||||
ex. @my_decorator(kwarg1="kwarg1"), then kwargs = {"kwarg1": "kwarg1"}
|
||||
"""
|
||||
|
@ -20,11 +20,11 @@ from keystoneclient import exceptions
|
||||
import six
|
||||
|
||||
|
||||
Project = collections.namedtuple('Project', ['id', 'name', 'domain_id'])
|
||||
User = collections.namedtuple('User',
|
||||
['id', 'name', 'project_id', 'domain_id'])
|
||||
Service = collections.namedtuple('Service', ['id', 'name'])
|
||||
Role = collections.namedtuple('Role', ['id', 'name'])
|
||||
Project = collections.namedtuple("Project", ["id", "name", "domain_id"])
|
||||
User = collections.namedtuple("User",
|
||||
["id", "name", "project_id", "domain_id"])
|
||||
Service = collections.namedtuple("Service", ["id", "name"])
|
||||
Role = collections.namedtuple("Role", ["id", "name"])
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
@ -36,7 +36,7 @@ class KeystoneWrapper(object):
|
||||
return getattr(self.client, attr_name)
|
||||
|
||||
@abc.abstractmethod
|
||||
def create_project(self, project_name, domain_name='Default'):
|
||||
def create_project(self, project_name, domain_name="Default"):
|
||||
"""Creates new project/tenant and return project object.
|
||||
|
||||
:param project_name: Name of project to be created.
|
||||
@ -51,7 +51,7 @@ class KeystoneWrapper(object):
|
||||
|
||||
@abc.abstractmethod
|
||||
def create_user(self, username, password, email=None, project_id=None,
|
||||
domain_name='Default'):
|
||||
domain_name="Default"):
|
||||
"""Creates user that have Mamber role in given project.
|
||||
|
||||
:param username: name of user
|
||||
@ -101,21 +101,21 @@ class KeystoneWrapper(object):
|
||||
|
||||
class KeystoneV2Wrapper(KeystoneWrapper):
|
||||
def _check_domain(self, domain_name):
|
||||
if domain_name.lower() != 'default':
|
||||
raise NotImplementedError('Domain functionality not implemented '
|
||||
'in Keystone v2')
|
||||
if domain_name.lower() != "default":
|
||||
raise NotImplementedError("Domain functionality not implemented "
|
||||
"in Keystone v2")
|
||||
|
||||
@staticmethod
|
||||
def _wrap_v2_tenant(tenant):
|
||||
return Project(id=tenant.id, name=tenant.name, domain_id='default')
|
||||
return Project(id=tenant.id, name=tenant.name, domain_id="default")
|
||||
|
||||
@staticmethod
|
||||
def _wrap_v2_user(user):
|
||||
return User(id=user.id, name=user.name,
|
||||
project_id=getattr(user, 'tenantId', None),
|
||||
domain_id='default')
|
||||
project_id=getattr(user, "tenantId", None),
|
||||
domain_id="default")
|
||||
|
||||
def create_project(self, project_name, domain_name='Default'):
|
||||
def create_project(self, project_name, domain_name="Default"):
|
||||
self._check_domain(domain_name)
|
||||
tenant = self.client.tenants.create(project_name)
|
||||
return KeystoneV2Wrapper._wrap_v2_tenant(tenant)
|
||||
@ -124,7 +124,7 @@ class KeystoneV2Wrapper(KeystoneWrapper):
|
||||
self.client.tenants.delete(project_id)
|
||||
|
||||
def create_user(self, username, password, email=None, project_id=None,
|
||||
domain_name='Default'):
|
||||
domain_name="Default"):
|
||||
self._check_domain(domain_name)
|
||||
user = self.client.users.create(username, password, email, project_id)
|
||||
return KeystoneV2Wrapper._wrap_v2_user(user)
|
||||
@ -162,11 +162,11 @@ class KeystoneV3Wrapper(KeystoneWrapper):
|
||||
def _wrap_v3_user(user):
|
||||
# When user has default_project_id that is None user.default_project_id
|
||||
# will raise AttributeError
|
||||
project_id = getattr(user, 'default_project_id', None)
|
||||
project_id = getattr(user, "default_project_id", None)
|
||||
return User(id=user.id, name=user.name, project_id=project_id,
|
||||
domain_id=user.domain_id)
|
||||
|
||||
def create_project(self, project_name, domain_name='Default'):
|
||||
def create_project(self, project_name, domain_name="Default"):
|
||||
domain_id = self._get_domain_id(domain_name)
|
||||
project = self.client.projects.create(
|
||||
name=project_name, domain=domain_id)
|
||||
@ -176,7 +176,7 @@ class KeystoneV3Wrapper(KeystoneWrapper):
|
||||
self.client.projects.delete(project_id)
|
||||
|
||||
def create_user(self, username, password, email=None, project_id=None,
|
||||
domain_name='Default'):
|
||||
domain_name="Default"):
|
||||
domain_id = self._get_domain_id(domain_name)
|
||||
client = self.client
|
||||
|
||||
@ -186,9 +186,9 @@ class KeystoneV3Wrapper(KeystoneWrapper):
|
||||
domain=domain_id)
|
||||
|
||||
# Grant member role to user in project or domain
|
||||
# TODO(Anton Frolov): replace hard-coded 'Member' role with role name
|
||||
# TODO(Anton Frolov): replace hard-coded "Member" role with role name
|
||||
# gained via deployment
|
||||
member_role = client.roles.list(name='Member')[0].id
|
||||
member_role = client.roles.list(name="Member")[0].id
|
||||
client.roles.grant(member_role, user=user.id, project=project_id)
|
||||
|
||||
return KeystoneV3Wrapper._wrap_v3_user(user)
|
||||
@ -207,10 +207,10 @@ class KeystoneV3Wrapper(KeystoneWrapper):
|
||||
def wrap(client):
|
||||
"""Returns keystone wrapper based on keystone client version."""
|
||||
|
||||
if client.version == 'v2.0':
|
||||
if client.version == "v2.0":
|
||||
return KeystoneV2Wrapper(client)
|
||||
elif client.version == 'v3':
|
||||
elif client.version == "v3":
|
||||
return KeystoneV3Wrapper(client)
|
||||
else:
|
||||
raise NotImplementedError(
|
||||
'Wrapper for version %s is not implemented.' % client.version)
|
||||
"Wrapper for version %s is not implemented." % client.version)
|
||||
|
Loading…
Reference in New Issue
Block a user