summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormbeierl <mark.beierl@dell.com>2018-07-04 20:51:54 -0400
committermbeierl <mark.beierl@dell.com>2018-07-05 09:14:02 -0400
commit3de258b9d0f6d4249a5e7f42eec41fcb0080bc66 (patch)
treef2ce3eceb3efcb31822c294aade70b937d75127b
parenta6c0c07da775203c813bc9a0effba6e0d37d15f7 (diff)
Adds volume_type support
Adds a new optional parameter, volume_type, to the configurations REST API, allowing the user to specify the volume type to create. Change-Id: I29b7bee442a5e1b6b98be439c06a58e3fd322943 JIRA: STORPERF-217 Co-Authored-By: Ameed.Ashour.Ext@Nokia.com Signed-off-by: mbeierl <mark.beierl@dell.com>
-rw-r--r--docker/storperf-httpfrontend/Dockerfile2
-rw-r--r--docker/storperf-master/rest_server.py14
-rw-r--r--docker/storperf-master/storperf/resources/hot/agent-group.yaml20
-rw-r--r--docker/storperf-master/storperf/resources/hot/storperf-agent.yaml5
-rw-r--r--docker/storperf-master/storperf/resources/hot/storperf-volume.yaml26
-rw-r--r--docker/storperf-master/storperf/storperf_master.py65
-rw-r--r--docker/storperf-master/tests/storperf_master_test.py9
7 files changed, 101 insertions, 40 deletions
diff --git a/docker/storperf-httpfrontend/Dockerfile b/docker/storperf-httpfrontend/Dockerfile
index c803d19..e9cb8db 100644
--- a/docker/storperf-httpfrontend/Dockerfile
+++ b/docker/storperf-httpfrontend/Dockerfile
@@ -75,7 +75,7 @@ RUN \
curl \
gnupg
-RUN gpg --keyserver keyserver.ubuntu.com --recv-keys "$key" || \
+RUN gpg --keyserver keyserver.ubuntu.com --recv-keys "$GPG_KEYS" || \
gpg --keyserver pgp.mit.edu --recv-keys "$GPG_KEYS" || \
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEYS" || \
gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$GPG_KEYS"
diff --git a/docker/storperf-master/rest_server.py b/docker/storperf-master/rest_server.py
index 839ea81..939e91f 100644
--- a/docker/storperf-master/rest_server.py
+++ b/docker/storperf-master/rest_server.py
@@ -101,6 +101,7 @@ class ConfigurationRequestModel:
'public_network': fields.String,
'volume_count': fields.Integer,
'volume_size': fields.Integer,
+ 'volume_type': fields.String,
'availability_zone': fields.String,
'username': fields.String,
'password': fields.String
@@ -118,6 +119,7 @@ class ConfigurationResponseModel:
'stack_id': fields.String,
'volume_count': fields.Integer,
'volume_size': fields.Integer,
+ 'volume_type': fields.String,
'availability_zone': fields.String,
'slave_addresses': fields.Nested
}
@@ -141,6 +143,7 @@ class Configure(Resource):
'public_network': storperf.public_network,
'volume_count': storperf.volume_count,
'volume_size': storperf.volume_size,
+ 'volume_type': storperf.volume_type,
'stack_created': storperf.is_stack_created,
'availability_zone': storperf.availability_zone,
'slave_addresses': storperf.slave_addresses,
@@ -180,6 +183,8 @@ class Configure(Resource):
storperf.volume_count = request.json['volume_count']
if ('volume_size' in request.json):
storperf.volume_size = request.json['volume_size']
+ if ('volume_type' in request.json):
+ storperf.volume_type = request.json['volume_type']
if ('availability_zone' in request.json):
storperf.availability_zone = request.json['availability_zone']
if ('username' in request.json):
@@ -191,14 +196,7 @@ class Configure(Resource):
if storperf.stack_id is None:
abort(400, storperf.status_reason)
- return jsonify({'agent_count': storperf.agent_count,
- 'agent_flavor': storperf.agent_flavor,
- 'agent_image': storperf.agent_image,
- 'availability_zone': storperf.availability_zone,
- 'public_network': storperf.public_network,
- 'volume_count': storperf.volume_count,
- 'volume_size': storperf.volume_size,
- 'stack_id': storperf.stack_id})
+ return self.get()
except Exception as e:
self.logger.exception(e)
diff --git a/docker/storperf-master/storperf/resources/hot/agent-group.yaml b/docker/storperf-master/storperf/resources/hot/agent-group.yaml
index ea7b51f..4e79d81 100644
--- a/docker/storperf-master/storperf/resources/hot/agent-group.yaml
+++ b/docker/storperf-master/storperf/resources/hot/agent-group.yaml
@@ -7,7 +7,7 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-heat_template_version: 2013-05-23
+heat_template_version: 2017-09-01
parameters:
public_network:
@@ -20,6 +20,12 @@ parameters:
agent_image:
type: string
default: 'StorPerf Ubuntu 14.04'
+ volume_count:
+ type: number
+ default: 0
+ constraints:
+ - range: { min: 0, max: 512 }
+ description: must be between 1 and 512 agents.
volume_size:
type: number
description: Size of the volume to be created.
@@ -27,12 +33,9 @@ parameters:
constraints:
- range: { min: 1, max: 1024 }
description: must be between 1 and 1024 Gb.
- volume_count:
- type: number
- default: 0
- constraints:
- - range: { min: 0, max: 512 }
- description: must be between 1 and 512 agents.
+ volume_type:
+ type: string
+ default: 'None'
agent_count:
type: number
default: 1
@@ -61,7 +64,8 @@ resources:
storperf_open_security_group: {get_resource: storperf_open_security_group},
key_name: {get_resource: storperf_key_pair},
volume_count: {get_param: volume_count},
- volume_size: {get_param: volume_size}
+ volume_size: {get_param: volume_size},
+ volume_type: {get_param: volume_type}
}
}
diff --git a/docker/storperf-master/storperf/resources/hot/storperf-agent.yaml b/docker/storperf-master/storperf/resources/hot/storperf-agent.yaml
index 8895c9f..6314514 100644
--- a/docker/storperf-master/storperf/resources/hot/storperf-agent.yaml
+++ b/docker/storperf-master/storperf/resources/hot/storperf-agent.yaml
@@ -7,7 +7,7 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-heat_template_version: 2013-05-23
+heat_template_version: 2017-09-01
parameters:
flavor:
@@ -38,6 +38,8 @@ parameters:
constraints:
- range: { min: 1, max: 1024 }
description: must be between 1 and 1024 Gb.
+ volume_type:
+ type: string
agent_network:
type: string
constraints:
@@ -101,6 +103,7 @@ resources:
type: "storperf-volume.yaml",
properties: {
volume_size: { get_param: volume_size },
+ volume_type: { get_param: volume_type },
agent_instance_uuid: { get_resource: storperf_agent }
}
}
diff --git a/docker/storperf-master/storperf/resources/hot/storperf-volume.yaml b/docker/storperf-master/storperf/resources/hot/storperf-volume.yaml
index aec3393..cbdd861 100644
--- a/docker/storperf-master/storperf/resources/hot/storperf-volume.yaml
+++ b/docker/storperf-master/storperf/resources/hot/storperf-volume.yaml
@@ -7,7 +7,7 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-heat_template_version: 2013-05-23
+heat_template_version: 2017-09-01
parameters:
volume_size:
@@ -17,17 +17,41 @@ parameters:
constraints:
- range: { min: 1, max: 1024 }
description: must be between 1 and 1024 Gb.
+ volume_type:
+ type: string
+ default: None
agent_instance_uuid:
type: string
+conditions: {
+ 'without_type': {equals: [{get_param: volume_type}, 'None']},
+ 'with_type': {not: {equals: [{get_param: volume_type}, 'None']}}
+}
+
resources:
+ agent_volume_type:
+ type: OS::Cinder::Volume
+ condition: 'with_type'
+ properties:
+ size: { get_param: volume_size }
+ volume_type: { get_param: volume_type}
+
+ agent_volume_type_att:
+ type: OS::Cinder::VolumeAttachment
+ condition: 'with_type'
+ properties:
+ instance_uuid: { get_param: agent_instance_uuid }
+ volume_id: { get_resource: agent_volume_type}
+
agent_volume:
type: OS::Cinder::Volume
+ condition: 'without_type'
properties:
size: { get_param: volume_size }
agent_volume_att:
type: OS::Cinder::VolumeAttachment
+ condition: 'without_type'
properties:
instance_uuid: { get_param: agent_instance_uuid }
volume_id: { get_resource: agent_volume}
diff --git a/docker/storperf-master/storperf/storperf_master.py b/docker/storperf-master/storperf/storperf_master.py
index fae8dd6..7a1444e 100644
--- a/docker/storperf-master/storperf/storperf_master.py
+++ b/docker/storperf-master/storperf/storperf_master.py
@@ -67,6 +67,7 @@ class StorPerfMaster(object):
self._public_network = None
self._volume_count = 1
self._volume_size = 1
+ self._volume_type = None
self._cached_stack_id = None
self._last_snaps_check_time = None
self._slave_addresses = []
@@ -97,6 +98,18 @@ class StorPerfMaster(object):
self._volume_size = value
@property
+ def volume_type(self):
+ self._get_stack_info()
+ return self._volume_type
+
+ @volume_type.setter
+ def volume_type(self, value):
+ if (self.stack_id is not None):
+ raise ParameterError(
+ "ERROR: Cannot change volume type after stack is created")
+ self._volume_type = value
+
+ @property
def agent_count(self):
self._get_stack_info()
return self._agent_count
@@ -192,9 +205,12 @@ class StorPerfMaster(object):
volume_id = server.volume_ids[0]['id']
volume = cinder_utils.get_volume_by_id(
cinder_cli, volume_id)
- self.logger.debug("Volume id %s, size=%s" % (volume.id,
- volume.size))
+ self.logger.debug("Volume id %s, size=%s, type=%s" %
+ (volume.id,
+ volume.size,
+ volume.type))
self._volume_size = volume.size
+ self._volume_type = volume.type
image = image_worker.get()
self._agent_image = image.name
@@ -309,25 +325,28 @@ class StorPerfMaster(object):
self.logger.error("Stack creation failed")
self.logger.exception(e)
heat_cli = heat_utils.heat_client(self.os_creds)
- res = heat_utils.get_resources(heat_cli,
- self.heat_stack.get_stack().id)
- reason = ""
- failed = False
- for resource in res:
- if resource.status == u'CREATE_FAILED':
- failed = True
- reason += "%s: %s " % (resource.name,
- resource.status_reason)
- self.logger.error("%s - %s: %s" % (resource.name,
- resource.status,
- resource.status_reason))
-
- if failed:
- try:
- self.heat_stack.clean()
- except Exception:
- pass
- raise Exception(reason)
+ if self.heat_stack.get_stack() is not None:
+ res = heat_utils.get_resources(heat_cli,
+ self.heat_stack.get_stack().id)
+ reason = ""
+ failed = False
+ for resource in res:
+ if resource.status == u'CREATE_FAILED':
+ failed = True
+ reason += "%s: %s " % (resource.name,
+ resource.status_reason)
+ self.logger.error("%s - %s: %s" % (resource.name,
+ resource.status,
+ resource.status_reason))
+
+ if failed:
+ try:
+ self.heat_stack.clean()
+ except Exception:
+ pass
+ raise Exception(reason)
+ else:
+ raise e
def delete_stack(self):
if self._test_executor is not None:
@@ -368,6 +387,8 @@ class StorPerfMaster(object):
params['public_network'] = self.public_network
params['volume_count'] = self.volume_count
params['volume_size'] = self.volume_size
+ if self.volume_type is not None:
+ params['volume_type'] = self.volume_type
if self.username and self.password:
params['username'] = self.username
params['password'] = self.password
@@ -486,6 +507,8 @@ class StorPerfMaster(object):
heat_parameters['agent_count'] = self.agent_count
heat_parameters['volume_count'] = self.volume_count
heat_parameters['volume_size'] = self.volume_size
+ if self.volume_type is not None:
+ heat_parameters['volume_type'] = self.volume_type
heat_parameters['agent_image'] = self.agent_image
heat_parameters['agent_flavor'] = self.agent_flavor
heat_parameters['availability_zone'] = self.availability_zone
diff --git a/docker/storperf-master/tests/storperf_master_test.py b/docker/storperf-master/tests/storperf_master_test.py
index cd0a2f3..03009d1 100644
--- a/docker/storperf-master/tests/storperf_master_test.py
+++ b/docker/storperf-master/tests/storperf_master_test.py
@@ -60,6 +60,15 @@ class StorPerfMasterTest(unittest.TestCase):
self.assertEqual(
expected, actual, "Did not expect: " + str(actual))
+ def test_volume_type(self):
+ expected = 'tripleo-ceph'
+
+ self.storperf.volume_type = expected
+ actual = self.storperf.volume_type
+
+ self.assertEqual(
+ expected, actual, "Did not expect: " + str(actual))
+
def test_agent_network(self):
expected = "ABCDEF"