python-glanceclient==1.1.0
python-cinderclient==1.6.0
python-keystoneclient==1.6.0
+matplotlib==1.3.1
flask==0.10
flask-restful==0.3.5
flask-restful-swagger==0.19
class ConfigurationRequestModel:
resource_fields = {
'agent_count': fields.Integer,
+ 'agent_image': fields.String,
'public_network': fields.String,
'volume_size': fields.Integer
}
class ConfigurationResponseModel:
resource_fields = {
'agent_count': fields.Integer,
+ 'agent_image': fields.String,
'public_network': fields.String,
'stack_created': fields.Boolean,
'stack_id': fields.String,
)
def get(self):
return jsonify({'agent_count': storperf.agent_count,
+ 'agent_image': storperf.agent_image,
'public_network': storperf.public_network,
'volume_size': storperf.volume_size,
'stack_created': storperf.is_stack_created,
try:
if ('agent_count' in request.json):
storperf.agent_count = request.json['agent_count']
+ if ('agent_image' in request.json):
+ storperf.agent_image = request.json['agent_image']
if ('public_network' in request.json):
storperf.public_network = request.json['public_network']
if ('volume_size' in request.json):
storperf.create_stack()
return jsonify({'agent_count': storperf.agent_count,
+ 'agent_image': storperf.agent_image,
'public_network': storperf.public_network,
'volume_size': storperf.volume_size,
'stack_id': storperf.stack_id})
flavor:
type: string
default: "m1.small"
+ agent_image:
+ type: string
+ default: 'StorPerf Ubuntu 14.04'
key_name:
type: string
default: StorPerf
public_network: {get_param: public_network},
agent_network: {get_resource: storperf_network},
flavor: {get_param: flavor},
+ image: {get_param: agent_image},
storperf_open_security_group: {get_resource: storperf_open_security_group},
key_name: {get_param: key_name},
volume_size: {get_param: volume_size}
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
+from datetime import datetime
from storperf.db.graphite_db import GraphiteDB
from threading import Thread
from time import sleep
self._cinder_client = None
self._heat_client = None
self._test_executor = TestExecutor()
+ self._last_openstack_auth = datetime.now()
@property
def volume_size(self):
'agent_count',
value)
+ @property
+ def agent_image(self):
+ value = self.configuration_db.get_configuration_value(
+ 'stack',
+ 'agent_image')
+
+ if (value is None):
+ value = 'Ubuntu 14.04'
+ self.agent_image = value
+ return value
+
+ @agent_image.setter
+ def agent_image(self, value):
+ if (self.stack_id is not None):
+ raise ParameterError(
+ "ERROR: Cannot change agent image after stack is created")
+
+ self.configuration_db.set_configuration_value(
+ 'stack',
+ 'agent_image',
+ value)
+
@property
def public_network(self):
return self.configuration_db.get_configuration_value(
heat_parameters['public_network'] = self.public_network
heat_parameters['agent_count'] = self.agent_count
heat_parameters['volume_size'] = self.volume_size
+ heat_parameters['agent_image'] = self.agent_image
return heat_parameters
def _attach_to_openstack(self):
- if (self._cinder_client is None):
+ time_since_last_auth = datetime.now() - self._last_openstack_auth
+ print time_since_last_auth.total_seconds()
+ if (self._cinder_client is None or
+ time_since_last_auth.total_seconds() > 600):
+ self._last_openstack_auth = datetime.now()
+
+ self.logger.debug("Authenticating with OpenStack")
+
self._cinder_client = cinderclient.Client(
self._username, self._password, self._project_name,
self._auth_url, service_type='volumev2')
self._cinder_client.authenticate()
- if (self._heat_client is None):
self._keystone_client = ksclient.Client(
auth_url=self._auth_url,
username=self._username,