summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTaseer Ahmed <taseer94@gmail.com>2017-07-27 00:46:28 +0500
committerTaseer Ahmed <taseer94@gmail.com>2017-07-27 09:38:11 +0500
commit57396276d5b503461af0ccaee750e85b9b1e4475 (patch)
treefe2102d5b1e13322f7fd355d5803a51edae1eeee
parent967371648191c37e20123c08e761c7a8a2a98516 (diff)
Add availability zone option to launch agent.
JIRA: STORPERF-178 Change-Id: I1a5c1a0d1c3b700a0858f644b01553bf0b5675de Signed-off-by: Taseer Ahmed <taseer94@gmail.com>
-rw-r--r--docker/storperf-master/rest_server.py10
-rw-r--r--docker/storperf-master/storperf/resources/hot/storperf-agent.yaml4
-rw-r--r--docker/storperf-master/storperf/storperf_master.py13
-rw-r--r--docs/testing/user/test-usage.rst4
4 files changed, 28 insertions, 3 deletions
diff --git a/docker/storperf-master/rest_server.py b/docker/storperf-master/rest_server.py
index d551b57..7452898 100644
--- a/docker/storperf-master/rest_server.py
+++ b/docker/storperf-master/rest_server.py
@@ -33,7 +33,8 @@ class ConfigurationRequestModel:
'agent_flavor': fields.String,
'agent_image': fields.String,
'public_network': fields.String,
- 'volume_size': fields.Integer
+ 'volume_size': fields.Integer,
+ 'availability_zone': fields.String
}
@@ -46,7 +47,8 @@ class ConfigurationResponseModel:
'public_network': fields.String,
'stack_created': fields.Boolean,
'stack_id': fields.String,
- 'volume_size': fields.Integer
+ 'volume_size': fields.Integer,
+ 'availability_zone': fields.String
}
@@ -68,6 +70,7 @@ class Configure(Resource):
'public_network': storperf.public_network,
'volume_size': storperf.volume_size,
'stack_created': storperf.is_stack_created,
+ 'availability_zone': storperf.availability_zone,
'stack_id': storperf.stack_id})
@swagger.operation(
@@ -102,6 +105,8 @@ class Configure(Resource):
storperf.public_network = request.json['public_network']
if ('volume_size' in request.json):
storperf.volume_size = request.json['volume_size']
+ if ('availability_zone' in request.json):
+ storperf.availabilty_zone = request.json['availability_zone']
storperf.create_stack()
if storperf.stack_id is None:
@@ -112,6 +117,7 @@ class Configure(Resource):
'agent_image': storperf.agent_image,
'public_network': storperf.public_network,
'volume_size': storperf.volume_size,
+ 'availability_zone': storperf.availability_zone,
'stack_id': storperf.stack_id})
except Exception as e:
diff --git a/docker/storperf-master/storperf/resources/hot/storperf-agent.yaml b/docker/storperf-master/storperf/resources/hot/storperf-agent.yaml
index 7bf8b4d..9f0481e 100644
--- a/docker/storperf-master/storperf/resources/hot/storperf-agent.yaml
+++ b/docker/storperf-master/storperf/resources/hot/storperf-agent.yaml
@@ -39,6 +39,9 @@ parameters:
type: string
constraints:
- custom_constraint: neutron.network
+ agent_zone:
+ type: string
+ default: nova
resources:
storperf_agent:
@@ -52,6 +55,7 @@ resources:
- port: { get_resource: storperf_agent_port }
user_data: { get_resource: storperf_agent_config }
user_data_format: RAW
+ availability_zone: { get_param: agent_zone}
storperf_agent_config:
type: "OS::Heat::CloudConfig"
diff --git a/docker/storperf-master/storperf/storperf_master.py b/docker/storperf-master/storperf/storperf_master.py
index 866a98e..8c2a7b4 100644
--- a/docker/storperf-master/storperf/storperf_master.py
+++ b/docker/storperf-master/storperf/storperf_master.py
@@ -168,6 +168,19 @@ class StorPerfMaster(object):
value)
@property
+ def availability_zone(self):
+ return self.configuration_db.get_configuration_value(
+ 'stack',
+ 'availability_zone')
+
+ @availability_zone.setter
+ def availability_zone(self, value):
+ self.configuration_db.set_configuration_value(
+ 'stack',
+ 'availability_zone',
+ value)
+
+ @property
def volume_quota(self):
self._attach_to_openstack()
quotas = self._cinder_client.quotas.get(
diff --git a/docs/testing/user/test-usage.rst b/docs/testing/user/test-usage.rst
index 586ba7a..b13d815 100644
--- a/docs/testing/user/test-usage.rst
+++ b/docs/testing/user/test-usage.rst
@@ -42,6 +42,7 @@ The following pieces of information are required to prepare the environment:
- The OpenStack flavor to use when creating the VMs
- The name of the public network that agents will use
- The size, in gigabytes, of the Cinder volumes to create
+- The availability zone (optional) in which the VM is to be launched. Defaults to **nova**.
The ReST API is a POST to http://StorPerf:5000/api/v1.0/configurations and
takes a JSON payload as follows.
@@ -53,7 +54,8 @@ takes a JSON payload as follows.
"agent_flavor": string
"agent_image": string,
"public_network": string,
- "volume_size": int
+ "volume_size": int,
+ "availability_zone": string
}
This call will block until the stack is created, at which point it will return