summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmeed Ashour <Ameed.Ashour.ext@nokia.com>2018-07-16 20:42:12 +0300
committerAmeed Ashour <Ameed.Ashour.ext@nokia.com>2018-07-16 20:43:21 +0300
commit3375ff5646ea9daf944bc7207a19b4db4b44334b (patch)
tree0a23fc2d1bfc4200cd07e94b5e4f5161c44ffe1c
parent30576e42f8d8e28fc21a5dad458cd60ba7d22391 (diff)
Allow user to specify subnet cidr on stack createopnfv-7.0.stable.RC1
Change-Id: If910ac18f405c98a0e1f48d38d338ad4f61f6004 JIRA: STORPERF-255 Signed-off-by: Ameed Ashour <Ameed.Ashour.ext@nokia.com>
-rw-r--r--docker/storperf-master/rest_server.py5
-rw-r--r--docker/storperf-master/storperf/resources/hot/agent-group.yaml6
-rw-r--r--docker/storperf-master/storperf/storperf_master.py14
3 files changed, 23 insertions, 2 deletions
diff --git a/docker/storperf-master/rest_server.py b/docker/storperf-master/rest_server.py
index 463a793..1e61693 100644
--- a/docker/storperf-master/rest_server.py
+++ b/docker/storperf-master/rest_server.py
@@ -103,6 +103,7 @@ class ConfigurationRequestModel:
'volume_size': fields.Integer,
'volume_type': fields.String,
'availability_zone': fields.String,
+ 'subnet_CIDR': fields.String,
'username': fields.String,
'password': fields.String
}
@@ -121,6 +122,7 @@ class ConfigurationResponseModel:
'volume_size': fields.Integer,
'volume_type': fields.String,
'availability_zone': fields.String,
+ 'subnet_CIDR': fields.String,
'slave_addresses': fields.Nested
}
@@ -146,6 +148,7 @@ class Configure(Resource):
'volume_type': storperf.volume_type,
'stack_created': storperf.is_stack_created,
'availability_zone': storperf.availability_zone,
+ 'subnet_CIDR': storperf.subnet_CIDR,
'slave_addresses': storperf.slave_addresses,
'stack_id': storperf.stack_id})
@@ -187,6 +190,8 @@ class Configure(Resource):
storperf.volume_type = request.json['volume_type']
if ('availability_zone' in request.json):
storperf.availability_zone = request.json['availability_zone']
+ if ('subnet_CIDR' in request.json):
+ storperf.subnet_CIDR = request.json['subnet_CIDR']
if ('username' in request.json):
storperf.username = request.json['username']
if ('password' in request.json):
diff --git a/docker/storperf-master/storperf/resources/hot/agent-group.yaml b/docker/storperf-master/storperf/resources/hot/agent-group.yaml
index 4e79d81..b4e3b6f 100644
--- a/docker/storperf-master/storperf/resources/hot/agent-group.yaml
+++ b/docker/storperf-master/storperf/resources/hot/agent-group.yaml
@@ -45,6 +45,9 @@ parameters:
availability_zone:
type: string
default: nova
+ subnet_CIDR:
+ type: string
+ default: '172.16.0.0/16'
resources:
slaves:
@@ -78,8 +81,7 @@ resources:
type: OS::Neutron::Subnet
properties:
network_id: { get_resource: storperf_network }
- cidr: 172.16.0.0/16
- gateway_ip: 172.16.0.1
+ cidr: { get_param: subnet_CIDR}
storperf_network_router:
type: OS::Neutron::Router
diff --git a/docker/storperf-master/storperf/storperf_master.py b/docker/storperf-master/storperf/storperf_master.py
index ff2acce..a50dcc6 100644
--- a/docker/storperf-master/storperf/storperf_master.py
+++ b/docker/storperf-master/storperf/storperf_master.py
@@ -80,6 +80,7 @@ class StorPerfMaster(object):
self._block_sizes = "4096"
self._workload_modules = []
self._custom_workloads = []
+ self._subnet_CIDR = '172.16.0.0/16'
self.slave_info = {}
@property
@@ -119,6 +120,17 @@ class StorPerfMaster(object):
self._volume_type = value
@property
+ def subnet_CIDR(self):
+ return self._subnet_CIDR
+
+ @subnet_CIDR.setter
+ def subnet_CIDR(self, value):
+ if (self.stack_id is not None):
+ raise ParameterError(
+ "ERROR: Cannot change subnet CIDR after stack is created")
+ self._subnet_CIDR = value
+
+ @property
def agent_count(self):
self._get_stack_info()
return self._agent_count
@@ -431,6 +443,7 @@ class StorPerfMaster(object):
params['public_network'] = self.public_network
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
@@ -578,6 +591,7 @@ class StorPerfMaster(object):
heat_parameters['agent_count'] = self.agent_count
heat_parameters['volume_count'] = self.volume_count
heat_parameters['volume_size'] = self.volume_size
+ heat_parameters['subnet_CIDR'] = self.subnet_CIDR
if self.volume_type is not None:
heat_parameters['volume_type'] = self.volume_type
heat_parameters['agent_image'] = self.agent_image