Generalize configuration for controller access.

Add comment about libvirt resize.

Fix stress bug.

Change-Id: Ieb751abd24fb7a5bc4747550c465541ab2fbfc9e
diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample
index 780e48d..aae4453 100644
--- a/etc/tempest.conf.sample
+++ b/etc/tempest.conf.sample
@@ -21,6 +21,9 @@
 build_timeout=600
 catalog_type=compute
 create_image_enabled=true
+# For resize to work with libvirt/kvm, one of the following must be true:
+# Single node: allow_resize_to_same_host=True must be set in nova.conf
+# Cluster: the 'nova' user must have scp access between cluster nodes
 resize_available=true
 
 [image]
diff --git a/stress/README.rst b/stress/README.rst
index 00e3b90..bf44f13 100644
--- a/stress/README.rst
+++ b/stress/README.rst
@@ -23,14 +23,15 @@
 ------------

 This particular framework assumes your working Nova cluster understands Nova 

 API 2.0. The stress tests can read the logs from the cluster. To enable this

-you have to

-provide the private key and user name for ssh to the cluster in the

+you have to provide the hostname to call 'nova-manage' and

+the private key and user name for ssh to the cluster in the

 [stress] section of tempest.conf. You also need to provide the

 value of --logdir in nova.conf:

 

   host_private_key_path=<path to private ssh key>

   host_admin_user=<name of user for ssh command>

   nova_logdir=<value of --logdir in nova.conf>

+  controller=<hostname for calling nova-manage>

 

 The stress test needs the top-level tempest directory to be on PYTHONPATH

 if you are not using nosetests to run.

diff --git a/stress/config.py b/stress/config.py
index 3f107af..0dce816 100755
--- a/stress/config.py
+++ b/stress/config.py
@@ -41,3 +41,8 @@
     def nova_logdir(self):

         """Directory containing log files on the compute nodes"""

         return self.get("nova_logdir", None)

+

+    @property

+    def controller(self):

+        """Controller host"""

+        return self.get("controller", None)

diff --git a/stress/test_servers.py b/stress/test_servers.py
index 3f62ac3..47d30b5 100644
--- a/stress/test_servers.py
+++ b/stress/test_servers.py
@@ -57,7 +57,8 @@
             return None
 
         _key_name = kwargs.get('key_name', '')
-        _timeout = int(kwargs.get('timeout', 60))
+        _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)
@@ -172,7 +173,7 @@
             self._logger.info('no ACTIVE instances to delete')
             return
 
-        _timeout = kwargs.get('timeout', 600)
+        _timeout = kwargs.get('timeout', manager.config.compute.build_timeout)
 
         target = random.choice(active_vms)
         killtarget = target[0]
@@ -240,7 +241,7 @@
             self._logger.info('no active instances to delete')
             return
 
-        _timeout = kwargs.get('timeout', 60)
+        _timeout = kwargs.get('timeout', manager.config.compute.build_timeout)
 
         target = random.choice(vms)
         killtarget = target[0]
@@ -276,7 +277,7 @@
             self._logger.info('no active instances to update')
             return
 
-        _timeout = kwargs.get('timeout', 600)
+        _timeout = kwargs.get('timeout', manager.config.compute.build_timeout)
 
         target = random.choice(active_vms)
         update_target = target[0]
diff --git a/stress/tests/create_kill.py b/stress/tests/create_kill.py
index 1457279..752f72d 100644
--- a/stress/tests/create_kill.py
+++ b/stress/tests/create_kill.py
@@ -20,13 +20,8 @@
 from tempest import openstack

 

 choice_spec = [

-    BasherAction(TestCreateVM(), 50,

-                 kargs={'timeout': '600',

-                        'image_ref': 2,

-                        'flavor_ref': 1}

-                 ),

-    BasherAction(TestKillActiveVM(), 50,

-                 kargs={'timeout': '600'})

+    BasherAction(TestCreateVM(), 50),

+    BasherAction(TestKillActiveVM(), 50)

 ]

 

 nova = openstack.Manager()

diff --git a/stress/tests/hard_reboots.py b/stress/tests/hard_reboots.py
index 503159e..f38ef6f 100644
--- a/stress/tests/hard_reboots.py
+++ b/stress/tests/hard_reboots.py
@@ -21,10 +21,9 @@
 from tempest import openstack

 

 choice_spec = [

-    BasherAction(TestCreateVM(), 50,

-                 kargs={'timeout': '600'}),

+    BasherAction(TestCreateVM(), 50),

     BasherAction(TestRebootVM(), 50,

-                 kargs={'type': 'HARD'}),

+                 kargs={'type': 'HARD'})

 ]

 

 nova = openstack.Manager()

diff --git a/stress/utils/util.py b/stress/utils/util.py
index aac6c26..ac8f062 100644
--- a/stress/utils/util.py
+++ b/stress/utils/util.py
@@ -32,6 +32,7 @@
 

 

 def ssh(keypath, user, node, command, check=True):

+    command = 'sudo ' + command

     command = "ssh %s %s@%s %s" % (get_ssh_options(keypath), user,

                                    node, command)

     popenargs = shlex.split(command)

diff --git a/tempest/tests/image/test_images.py b/tempest/tests/image/test_images.py
index 70dec32..8f75f08 100644
--- a/tempest/tests/image/test_images.py
+++ b/tempest/tests/image/test_images.py
@@ -202,4 +202,4 @@
         Simple test to see all fixture images returned
         """
         images = self.client.get_images()
-        self.assertEqual(10, len(images) - len(cls.original_images))
+        self.assertEqual(10, len(images) - len(self.original_images))