Add resources for floating_ip, keypair, volume. Add floating_ip test.

Provide mechanism to pre-allocate vms, floating_ips, keypairs and volumes.
Abstract time-related functions to PendingAction and move server-specific
  stuff to PendingServerAction subclass.
Rename State to ClusterState.
Add test that associates/disassociates floating_ips and servers.

Change-Id: I1651c38cc75d755bde370fb6a49ff4231e96255e
diff --git a/stress/pending_action.py b/stress/pending_action.py
index 913cc42..67eba13 100644
--- a/stress/pending_action.py
+++ b/stress/pending_action.py
@@ -17,6 +17,7 @@
 
 import logging
 import time
+from tempest.exceptions import TimeoutException
 
 
 class PendingAction(object):
@@ -25,25 +26,55 @@
     is successful.
     """
 
-    def __init__(self, nova_manager, state, target_server, timeout=600):
+    def __init__(self, nova_manager, timeout=None):
         """
         `nova_manager` : Manager object.
+        `timeout`   : time before we declare a TimeoutException
+        """
+        if timeout == None:
+            timeout = nova_manager.config.compute.build_timeout
+        self._manager = nova_manager
+        self._logger = logging.getLogger(self.__class__.__name__)
+        self._start_time = time.time()
+        self._timeout = timeout
+
+    def retry(self):
+        """
+        Invoked by user of this class to verify completion of
+        previous TestCase actions
+        """
+        return False
+
+    def check_timeout(self):
+        """Check for timeouts of TestCase actions"""
+        time_diff = time.time() - self._start_time
+        if time_diff > self._timeout:
+            self._logger.error('%s exceeded timeout of %d' %
+                               (self.__class__.__name__, self._timeout))
+            raise TimeoutException
+
+    def elapsed(self):
+        return time.time() - self._start_time
+
+
+class PendingServerAction(PendingAction):
+    """
+    Initialize and describe actions to verify that a Nova API call that
+    changes server state is successful.
+    """
+
+    def __init__(self, nova_manager, state, target_server, timeout=None):
+        """
         `state`           : externally maintained data structure about
                             state of VMs or other persistent objects in
                             the nova cluster
         `target_server`   : server that actions were performed on
-        `target_server`   : time before we declare a TimeoutException
-        `pargs`           : positional arguments
-        `kargs`           : keyword arguments
         """
-        self._manager = nova_manager
+        super(PendingServerAction, self).__init__(nova_manager,
+                                                  timeout=timeout)
         self._state = state
         self._target = target_server
 
-        self._logger = logging.getLogger(self.__class__.__name__)
-        self._start_time = time.time()
-        self._timeout = timeout
-
     def _check_for_status(self, state_string):
         """Check to see if the machine has transitioned states"""
         t = time.time()  # for debugging
@@ -58,8 +89,3 @@
             return temp_obj[1]
         self._logger.debug('%s, time: %d' % (state_string, time.time() - t))
         return state_string
-
-    def retry(self):
-        """Invoked by user of this class to verify completion of"""
-        """previous TestCase actions"""
-        return False