David Kranz | 6308ec2 | 2012-02-22 09:36:48 -0500 | [diff] [blame] | 1 | # Copyright 2011 Quanta Research Cambridge, Inc.
|
| 2 | #
|
| 3 | # Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 | # you may not use this file except in compliance with the License.
|
| 5 | # You may obtain a copy of the License at
|
| 6 | #
|
| 7 | # http://www.apache.org/licenses/LICENSE-2.0
|
| 8 | #
|
| 9 | # Unless required by applicable law or agreed to in writing, software
|
| 10 | # distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 | # See the License for the specific language governing permissions and
|
| 13 | # limitations under the License.
|
| 14 |
|
| 15 | import ConfigParser
|
| 16 |
|
| 17 |
|
| 18 | class StressConfig(object):
|
| 19 | """Provides configuration information for whitebox stress tests."""
|
| 20 |
|
| 21 | def __init__(self, conf):
|
| 22 | self.conf = conf
|
| 23 |
|
| 24 | def get(self, item_name, default_value=None):
|
| 25 | try:
|
| 26 | return self.conf.get("stress", item_name)
|
| 27 | except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
|
| 28 | return default_value
|
| 29 |
|
| 30 | @property
|
| 31 | def host_private_key_path(self):
|
| 32 | """Path to ssh key for logging into compute nodes."""
|
| 33 | return self.get("host_private_key_path", None)
|
| 34 |
|
| 35 | @property
|
| 36 | def host_admin_user(self):
|
| 37 | """Username for logging into compute nodes."""
|
| 38 | return self.get("host_admin_user", None)
|
| 39 |
|
| 40 | @property
|
| 41 | def nova_logdir(self):
|
| 42 | """Directory containing log files on the compute nodes"""
|
| 43 | return self.get("nova_logdir", None)
|
David Kranz | 30fe84a | 2012-03-20 16:25:47 -0400 | [diff] [blame] | 44 |
|
| 45 | @property
|
| 46 | def controller(self):
|
| 47 | """Controller host"""
|
| 48 | return self.get("controller", None)
|
David Kranz | 180fed1 | 2012-03-27 14:31:29 -0400 | [diff] [blame] | 49 |
|
| 50 | @property
|
| 51 | def max_instances(self):
|
| 52 | """Maximum number of instances to create during test"""
|
| 53 | return self.get("max_instances", 16)
|