summaryrefslogtreecommitdiffstats
path: root/docker
diff options
context:
space:
mode:
authormbeierl <mark.beierl@dell.com>2018-07-13 14:50:17 -0400
committermbeierl <mark.beierl@dell.com>2018-07-13 14:53:22 -0400
commit35643d32b7597c08af835c67ea76c1437d41330e (patch)
treebe7c77245203c65bb5d9419f7709a545b3a763e4 /docker
parentf96c968bb5e8149354a3f31c6e704ce821e5d813 (diff)
Initialization API
Adds a new API that performs initialization of the target filename or device instead of having to rely on the magic _warm_up workload name. Change-Id: Icb7ece05fb6190802df08f5a4aeeba62652757db JIRA: STORPERF-254 Signed-off-by: mbeierl <mark.beierl@dell.com>
Diffstat (limited to 'docker')
-rw-r--r--docker/storperf-master/requirements.pip17
-rw-r--r--docker/storperf-master/rest_server.py63
-rw-r--r--docker/storperf-master/storperf/storperf_master.py4
3 files changed, 73 insertions, 11 deletions
diff --git a/docker/storperf-master/requirements.pip b/docker/storperf-master/requirements.pip
index a591e84..020a1d5 100644
--- a/docker/storperf-master/requirements.pip
+++ b/docker/storperf-master/requirements.pip
@@ -1,11 +1,10 @@
-pyyaml==3.10
-flask==0.10
-flask_cors==3.0.2
-flask-restful==0.3.5
-flask-restful-swagger==0.19
-flask-swagger==0.2.12
+flask==1.0.2
+flask_cors==3.0.6
+flask-restful==0.3.6
+flask-restful-swagger==0.20.1
+flask-swagger==0.2.13
html2text==2016.1.8
-paramiko==2.0.2
-requests==2.13.0
-scp==0.10.2
+paramiko==2.4.1
+requests==2.19.1
+scp==0.11.0
git+https://gerrit.opnfv.org/gerrit/snaps#egg=snaps
diff --git a/docker/storperf-master/rest_server.py b/docker/storperf-master/rest_server.py
index 9d9b7fa..8544f19 100644
--- a/docker/storperf-master/rest_server.py
+++ b/docker/storperf-master/rest_server.py
@@ -471,6 +471,68 @@ for any single test iteration.
@swagger.model
+class WarmUpModel:
+ resource_fields = {
+ 'target': fields.String
+ }
+
+
+class Initialize(Resource):
+
+ """Disk initialization API"""
+
+ def __init__(self):
+ self.logger = logging.getLogger(__name__)
+
+ @swagger.operation(
+ parameters=[
+ {
+ "name": "body",
+ "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",
+ """,
+ "required": False,
+ "type": "WarmUpModel",
+ "paramType": "body"
+ }
+ ],
+ type=WorkloadResponseModel.__name__,
+ notes='''Initialize the target device or file by filling it to
+ capacity with random data. This is similar to the jobs API,
+ but does not have a deadline or steady state. It also
+ uses a predefined block size and queue depth.''',
+ responseMessages=[
+ {
+ "code": 200,
+ "message": "Job submitted"
+ },
+ {
+ "code": 400,
+ "message": "Missing configuration data"
+ }
+ ]
+ )
+ def post(self):
+ self.logger.info(request.json)
+
+ try:
+ if (request.json and 'target' in request.json):
+ storperf.filename = request.json['target']
+ storperf.queue_depths = "8"
+ storperf.block_sizes = "8192"
+ storperf.workloads = "_warm_up"
+ job_id = storperf.execute_workloads()
+
+ return jsonify({'job_id': job_id})
+
+ except Exception as e:
+ self.logger.exception(e)
+ abort(400, str(e))
+
+
+@swagger.model
class QuotaModel:
resource_fields = {
@@ -516,6 +578,7 @@ def setup_logging(default_path='logging.json',
api.add_resource(Configure, "/api/v1.0/configurations")
+api.add_resource(Initialize, "/api/v1.0/initializations")
api.add_resource(Quota, "/api/v1.0/quotas")
api.add_resource(Job, "/api/v1.0/jobs")
api.add_resource(Job_v2, "/api/v2.0/jobs")
diff --git a/docker/storperf-master/storperf/storperf_master.py b/docker/storperf-master/storperf/storperf_master.py
index b17dae9..ff2acce 100644
--- a/docker/storperf-master/storperf/storperf_master.py
+++ b/docker/storperf-master/storperf/storperf_master.py
@@ -76,8 +76,8 @@ class StorPerfMaster(object):
self._filename = None
self._deadline = None
self._steady_state_samples = 10
- self._queue_depths = [1, 4, 8]
- self._block_sizes = [512, 4096, 16384]
+ self._queue_depths = "1"
+ self._block_sizes = "4096"
self._workload_modules = []
self._custom_workloads = []
self.slave_info = {}