'volume_type': fields.String,
'availability_zone': fields.String,
'subnet_CIDR': fields.String,
+ 'stack_name': fields.String,
'username': fields.String,
'password': fields.String
}
'volume_type': fields.String,
'availability_zone': fields.String,
'subnet_CIDR': fields.String,
+ 'stack_name': fields.String,
'slave_addresses': fields.Nested
}
@swagger.operation(
notes='Fetch the current agent configuration',
+ parameters=[
+ {
+ "name": "stack_name",
+ "description": "The name of the stack to use, defaults to" +
+ "StorPerfAgentGroup or the last stack named",
+ "required": False,
+ "type": "string",
+ "allowMultiple": False,
+ "paramType": "query"
+ }],
type=ConfigurationResponseModel.__name__
)
def get(self):
+ stack_name = request.args.get('stack_name')
+ if stack_name:
+ storperf.stack_name = stack_name
+
return jsonify({'agent_count': storperf.agent_count,
'agent_flavor': storperf.agent_flavor,
'agent_image': storperf.agent_image,
'stack_created': storperf.is_stack_created,
'availability_zone': storperf.availability_zone,
'subnet_CIDR': storperf.subnet_CIDR,
+ 'stack_name': storperf.stack_name,
'slave_addresses': storperf.slave_addresses,
'stack_id': storperf.stack_id})
abort(400, "ERROR: No data specified")
try:
+ # Note this must be first in order to be able to create
+ # more than one stack in the same StorPerf instance.
+ if ('stack_name' in request.json):
+ storperf.stack_name = request.json['stack_name']
if ('agent_count' in request.json):
storperf.agent_count = request.json['agent_count']
if ('agent_flavor' in request.json):
abort(400, str(e))
@swagger.operation(
- notes='Deletes the agent configuration and the stack'
+ notes='Deletes the agent configuration and the stack',
+ parameters=[
+ {
+ "name": "stack_name",
+ "description": "The name of the stack to delete, defaults to" +
+ "StorPerfAgentGroup or the last stack named",
+ "required": False,
+ "type": "string",
+ "allowMultiple": False,
+ "paramType": "query"
+ }]
)
def delete(self):
+ stack_name = request.args.get('stack_name')
+ if stack_name:
+ storperf.stack_name = stack_name
try:
return jsonify({'stack_id': storperf.delete_stack()})
except Exception as e:
"steady_state_samples": fields.Integer,
'workload': fields.String,
'queue_depths': fields.String,
- 'block_sizes': fields.String
+ 'block_sizes': fields.String,
+ 'stack_name': fields.String
}
for any single test iteration.
"workload":if specified, the workload to run. Defaults to all.
+
+"stack_name": The target stack to use. Defaults to StorPerfAgentGroup, or
+the last stack named.
""",
"required": True,
"type": "WorkloadModel",
self.logger.info(request.json)
try:
+ if ('stack_name' in request.json):
+ storperf.stack_name = request.json['stack_name']
if ('target' in request.json):
storperf.filename = request.json['target']
if ('deadline' in request.json):
@swagger.model
+class WorkloadsBodyModel:
+ resource_fields = {
+ "rw": fields.String(default="randrw")
+ }
+ required = ['rw']
+
+
+@swagger.model
+@swagger.nested(
+ name=WorkloadsBodyModel.__name__)
+class WorkloadsNameModel:
+ resource_fields = {
+ "name": fields.Nested(WorkloadsBodyModel.resource_fields)
+ }
+
+
+@swagger.model
+@swagger.nested(
+ workloads=WorkloadsNameModel.__name__)
class WorkloadV2Model:
resource_fields = {
'target': fields.String,
'deadline': fields.Integer,
"steady_state_samples": fields.Integer,
- 'workloads': fields.Nested,
+ 'workloads': fields.Nested(WorkloadsNameModel.resource_fields),
'queue_depths': fields.String,
- 'block_sizes': fields.String
+ 'block_sizes': fields.String,
+ 'stack_name': fields.String
}
+ required = ['workloads']
class Job_v2(Resource):
"deadline": if specified, the maximum duration in minutes
for any single test iteration.
-"workloads":if specified, the workload to run. Defaults to all.
+"workloads": A JSON formatted map of workload names and parameters for FIO.
+
+"stack_name": The target stack to use. Defaults to StorPerfAgentGroup, or
+the last stack named.
""",
"required": True,
"type": "WorkloadV2Model",
self.logger.info(request.json)
try:
+ if ('stack_name' in request.json):
+ storperf.stack_name = request.json['stack_name']
if ('target' in request.json):
storperf.filename = request.json['target']
if ('deadline' in request.json):
@swagger.model
class WarmUpModel:
resource_fields = {
+ 'stack_name': fields.String,
'target': fields.String
}
"description": """Fill the target with random data. If no
target is specified, it will default to /dev/vdb
-"target": The target device or file to fill with random data",
+"target": The target device or file to fill with random data.
+
+"stack_name": The target stack to use. Defaults to StorPerfAgentGroup, or
+the last stack named.
""",
"required": False,
"type": "WarmUpModel",
self.logger.info(request.json)
try:
- if (request.json and 'target' in request.json):
- storperf.filename = request.json['target']
+ if request.json:
+ if 'target' in request.json:
+ storperf.filename = request.json['target']
+ if 'stack_name' in request.json:
+ storperf.stack_name = request.json['stack_name']
storperf.queue_depths = "8"
- storperf.block_sizes = "8192"
+ storperf.block_sizes = "16k"
storperf.workloads = "_warm_up"
storperf.custom_workloads = None
job_id = storperf.execute_workloads()
from storperf.db.job_db import JobDB
from storperf.test_executor import TestExecutor
import json
+import uuid
class ParameterError(Exception):
self.logger = logging.getLogger(__name__)
self.job_db = JobDB()
-
+ self._stack_name = 'StorPerfAgentGroup'
self.stack_settings = StackConfig(
- name='StorPerfAgentGroup',
+ name=self.stack_name,
template_path='storperf/resources/hot/agent-group.yaml')
self.os_creds = OSCreds(
"ERROR: Cannot change volume type after stack is created")
self._volume_type = value
+ @property
+ def stack_name(self):
+ return self._stack_name
+
+ @stack_name.setter
+ def stack_name(self, value):
+ self._stack_name = value
+ self.stack_settings.name = self.stack_name
+ self.stack_id = None
+ self._last_snaps_check_time = None
+
@property
def subnet_CIDR(self):
return self._subnet_CIDR
self._test_executor.job_id))
if (self.stack_id is None):
- raise ParameterError("ERROR: Stack does not exist")
+ raise ParameterError("ERROR: Stack %s does not exist" %
+ self.stack_name)
self._test_executor = TestExecutor()
self._test_executor.register(self.executor_event)
self._test_executor.slaves = slaves
self._test_executor.volume_count = self.volume_count
-
params = metadata
params['agent_count'] = self.agent_count
+ params['agent_flavor'] = self.agent_flavor
+ params['agent_image'] = self.agent_image
+ params['agent_info'] = json.dumps(self.slave_info)
+ params['avaiability_zone'] = self.availability_zone
+ params['block_sizes'] = self.block_sizes
+ params['deadline'] = self.deadline
params['public_network'] = self.public_network
+ params['stack_name'] = self.stack_name
+ params['steady_state_samples'] = self.steady_state_samples
+ params['subnet_CIDR'] = self.subnet_CIDR
+ params['target'] = self.filename
params['volume_count'] = self.volume_count
params['volume_size'] = self.volume_size
- params['subnet_CIDR'] = self.subnet_CIDR
- params['agent_info'] = json.dumps(self.slave_info)
- if self.volume_type is not None:
- params['volume_type'] = self.volume_type
+ params['volume_type'] = self.volume_type
if self.username and self.password:
params['username'] = self.username
params['password'] = self.password
logger.error(line)
def _make_parameters(self):
+ random_str = uuid.uuid4().hex[:6].upper()
heat_parameters = {}
heat_parameters['public_network'] = self.public_network
heat_parameters['agent_count'] = self.agent_count
heat_parameters['volume_count'] = self.volume_count
heat_parameters['volume_size'] = self.volume_size
+ heat_parameters['keypair_name'] = 'storperf_agent_keypair' + random_str
heat_parameters['subnet_CIDR'] = self.subnet_CIDR
if self.volume_type is not None:
heat_parameters['volume_type'] = self.volume_type