Update stress tests to properly use tempest.config

When tempest.config was switched over to using oslo the stress tests
weren't updated with those changes. Also subsequent changes to the
tempest options were not updated in the stress test suite. This left
the stress tests unusable because it couldn't get the needed
information from config. This commit updates the stress test suite
to properly use tempest.config. It also adds a new section to the
config file for stress test specific options.

Fixes bug 1133012

Change-Id: I1b0c726f53dc0e3e0777e27af3e860d35029f958
This commit is contained in:
Matthew Treinish
2013-02-25 17:26:59 -05:00
parent 841ccd678e
commit 615ea6a182
3 changed files with 31 additions and 15 deletions
+5 -13
View File
@@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import ConfigParser
class StressConfig(object):
"""Provides configuration information for whitebox stress tests."""
@@ -21,33 +19,27 @@ class StressConfig(object):
def __init__(self, conf):
self.conf = conf
def get(self, item_name, default_value=None):
try:
return self.conf.get("stress", item_name)
except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
return default_value
@property
def host_private_key_path(self):
"""Path to ssh key for logging into compute nodes."""
return self.get("host_private_key_path", None)
return self.conf.compute.path_to_private_key
@property
def host_admin_user(self):
"""Username for logging into compute nodes."""
return self.get("host_admin_user", None)
return self.conf.compute.ssh_user
@property
def nova_logdir(self):
"""Directory containing log files on the compute nodes."""
return self.get("nova_logdir", None)
return self.conf.stress.nova_logdir
@property
def controller(self):
"""Controller host."""
return self.get("controller", None)
return self.conf.stress.controller
@property
def max_instances(self):
"""Maximum number of instances to create during test."""
return self.get("max_instances", 16)
return self.conf.stress.max_instances
+4 -2
View File
@@ -18,6 +18,7 @@ to the bash_openstack function call"""
import datetime
import random
import time
from urlparse import urlparse
from config import StressConfig
from state import ClusterState
@@ -162,7 +163,7 @@ def bash_openstack(manager,
(default: 32)
`seed` = random seed (default: None)
"""
stress_config = StressConfig(manager.config._conf)
stress_config = StressConfig(manager.config)
# get keyword arguments
duration = kwargs.get('duration', datetime.timedelta(seconds=10))
seed = kwargs.get('seed', None)
@@ -173,7 +174,8 @@ def bash_openstack(manager,
keypath = stress_config.host_private_key_path
user = stress_config.host_admin_user
logdir = stress_config.nova_logdir
computes = _get_compute_nodes(keypath, user, manager.config.identity.host)
host = urlparse(manager.config.identity.uri).hostname
computes = _get_compute_nodes(keypath, user, host)
stress.utils.execute_on_all(keypath, user, computes,
"rm -f %s/*.log" % logdir)
random.seed(seed)
+22
View File
@@ -382,6 +382,26 @@ def register_boto_opts(conf):
for opt in BotoConfig:
conf.register_opt(opt, group='boto')
stress_group = cfg.OptGroup(name='stress', title='Stress Test Options')
StressGroup = [
cfg.StrOpt('nova_logdir',
default=None,
help='Directory containing log files on the compute nodes'),
cfg.IntOpt('max_instances',
default=16,
help='Maximum number of instances to create during test.'),
cfg.StrOpt('controller',
default=None,
help='Controller host.')
]
def register_stress_opts(conf):
conf.register_group(stress_group)
for opt in StressGroup:
conf.register_opt(opt, group='stress')
@singleton
class TempestConfig:
@@ -426,6 +446,7 @@ class TempestConfig:
register_object_storage_opts(cfg.CONF)
register_boto_opts(cfg.CONF)
register_compute_admin_opts(cfg.CONF)
register_stress_opts(cfg.CONF)
self.compute = cfg.CONF.compute
self.whitebox = cfg.CONF.whitebox
self.identity = cfg.CONF.identity
@@ -435,6 +456,7 @@ class TempestConfig:
self.object_storage = cfg.CONF['object-storage']
self.boto = cfg.CONF.boto
self.compute_admin = cfg.CONF['compute-admin']
self.stress = cfg.CONF.stress
if not self.compute_admin.username:
self.compute_admin.username = self.identity.admin_username
self.compute_admin.password = self.identity.admin_password