Merge "Stress improts"
diff --git a/stress/driver.py b/stress/driver.py
index c50e957..8dc88cf 100644
--- a/stress/driver.py
+++ b/stress/driver.py
@@ -24,9 +24,10 @@
from state import FloatingIpState
from state import KeyPairState
from state import VolumeState
-from test_case import *
+import stress.utils
+from test_case import logging
+
from tempest.common.utils.data_utils import rand_name
-import utils.util
# setup logging to file
logging.basicConfig(
@@ -73,7 +74,7 @@
if keypath is None or user is None:
return nodes
cmd = "nova-manage service list | grep ^nova-compute"
- lines = utils.util.ssh(keypath, user, controller, cmd).split('\n')
+ lines = stress.utils.ssh(keypath, user, controller, cmd).split('\n')
# For example: nova-compute xg11eth0 nova enabled :-) 2011-10-31 18:57:46
# This is fragile but there is, at present, no other way to get this info.
for line in lines:
@@ -89,7 +90,7 @@
"""
grep = 'egrep "ERROR\|TRACE" %s/*.log' % logdir
for node in nodes:
- errors = utils.util.ssh(keypath, user, node, grep, check=False)
+ errors = stress.utils.ssh(keypath, user, node, grep, check=False)
if len(errors) > 0:
logging.error('%s: %s' % (node, errors))
return True
@@ -173,8 +174,8 @@
user = stress_config.host_admin_user
logdir = stress_config.nova_logdir
computes = _get_compute_nodes(keypath, user, manager.config.identity.host)
- utils.util.execute_on_all(keypath, user, computes,
- "rm -f %s/*.log" % logdir)
+ stress.utils.execute_on_all(keypath, user, computes,
+ "rm -f %s/*.log" % logdir)
random.seed(seed)
cases = _create_cases(choice_spec)
state = ClusterState(max_vms=max_vms)
diff --git a/stress/test_floating_ips.py b/stress/test_floating_ips.py
index 97e4382..6774e81 100755
--- a/stress/test_floating_ips.py
+++ b/stress/test_floating_ips.py
@@ -14,7 +14,6 @@
import random
import telnetlib
-import time
import pending_action
import test_case
diff --git a/stress/test_server_actions.py b/stress/test_server_actions.py
index a2032f0..f4ddf23 100644
--- a/stress/test_server_actions.py
+++ b/stress/test_server_actions.py
@@ -18,12 +18,11 @@
actions veriy that the API call was successful or not."""
import random
-import time
import pending_action
+import stress.utils
from tempest.exceptions import Duplicate
import test_case
-from utils.util import *
class TestRebootVM(test_case.StressTestCase):
@@ -81,7 +80,7 @@
class VerifyRebootVM(pending_action.PendingServerAction):
"""Class to verify that the reboot completed."""
- States = enum('REBOOT_CHECK', 'ACTIVE_CHECK')
+ States = stress.utils.enum('REBOOT_CHECK', 'ACTIVE_CHECK')
def __init__(self, manager, state, target_server,
reboot_state=None,
diff --git a/stress/test_servers.py b/stress/test_servers.py
index e1cb4d1..25cbbb0 100644
--- a/stress/test_servers.py
+++ b/stress/test_servers.py
@@ -18,7 +18,6 @@
actions veriy that the API call was successful or not."""
import random
-import time
import pending_action
import test_case
@@ -39,7 +38,6 @@
`pargs` : positional arguments
`kwargs` : keyword arguments, which include:
`key_name` : name of keypair
- `timeout` : how long to wait before issuing Exception
`image_ref` : index to image types availablexs
`flavor_ref`: index to flavor types available
(default = 1, which is tiny)
@@ -52,8 +50,6 @@
return None
_key_name = kwargs.get('key_name', '')
- _timeout = int(kwargs.get('timeout',
- manager.config.compute.build_timeout))
_image_ref = kwargs.get('image_ref', manager.config.compute.image_ref)
_flavor_ref = kwargs.get('flavor_ref',
manager.config.compute.flavor_ref)
diff --git a/stress/tests/create_kill.py b/stress/tests/create_kill.py
index 2565723..30ddfd7 100644
--- a/stress/tests/create_kill.py
+++ b/stress/tests/create_kill.py
@@ -14,9 +14,13 @@
"""More aggressive test that creates and destroys VMs with shorter
sleep times"""
-from stress.test_servers import *
+import datetime
+import time
+
from stress.basher import BasherAction
-from stress.driver import *
+from stress.driver import bash_openstack
+from stress.test_servers import TestCreateVM
+from stress.test_servers import TestKillActiveVM
from tempest import clients
choice_spec = [
diff --git a/stress/tests/floating_ips.py b/stress/tests/floating_ips.py
index 6a4452c..b1b3778 100755
--- a/stress/tests/floating_ips.py
+++ b/stress/tests/floating_ips.py
@@ -13,8 +13,10 @@
# limitations under the License.
"""Stress test that associates/disasssociates floating ips."""
+import datetime
+
from stress.basher import BasherAction
-from stress.driver import *
+from stress.driver import bash_openstack
from stress.test_floating_ips import TestChangeFloatingIp
from tempest import clients
diff --git a/stress/tests/hard_reboots.py b/stress/tests/hard_reboots.py
index fe57be1..50a2e91 100644
--- a/stress/tests/hard_reboots.py
+++ b/stress/tests/hard_reboots.py
@@ -13,11 +13,13 @@
# limitations under the License.
"""Test that reboots random instances in a Nova cluster."""
+import datetime
+import time
-from stress.test_servers import *
-from stress.test_server_actions import *
from stress.basher import BasherAction
-from stress.driver import *
+from stress.driver import bash_openstack
+from stress.test_server_actions import TestRebootVM
+from stress.test_servers import TestCreateVM
from tempest import clients
choice_spec = [
diff --git a/stress/tests/user_script_sample.py b/stress/tests/user_script_sample.py
index 04163e3..d941ea0 100644
--- a/stress/tests/user_script_sample.py
+++ b/stress/tests/user_script_sample.py
@@ -14,10 +14,12 @@
"""Sample stress test that creates a few virtual machines and then
destroys them"""
+import datetime
-from stress.test_servers import *
from stress.basher import BasherAction
-from stress.driver import *
+from stress.driver import bash_openstack
+from stress.test_servers import TestCreateVM
+from stress.test_servers import TestKillActiveVM
from tempest import clients
choice_spec = [
diff --git a/stress/utils/util.py b/stress/utils.py
similarity index 100%
rename from stress/utils/util.py
rename to stress/utils.py
diff --git a/stress/utils/__init__.py b/stress/utils/__init__.py
deleted file mode 100644
index 85300f2..0000000
--- a/stress/utils/__init__.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-
-# Copyright 2011 Quanta Research Cambridge, Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.