Initial checkin of Stress Test for nova.

Change-Id: I1c4c656e3b8ec715524d369c226ec122920f89fb
diff --git a/stress/state.py b/stress/state.py
new file mode 100644
index 0000000..c7eac37
--- /dev/null
+++ b/stress/state.py
@@ -0,0 +1,41 @@
+# 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.

+"""A class to store the state of various persistent objects in the Nova

+cluster, e.g. instances, volumes.  Use methods to query to state which than

+can be compared to the current state of the objects in Nova"""

+

+

+class State(object):

+

+    def __init__(self, **kwargs):

+        self._max_vms = kwargs.get('max_vms', 32)

+        self._instances = {}

+        self._volumes = {}

+

+    # machine state methods

+    def get_instances(self):

+        """return the instances dictionary that we believe are in cluster."""

+        return self._instances

+

+    def get_max_instances(self):

+        """return the maximum number of instances we can create."""

+        return self._max_vms

+

+    def set_instance_state(self, key, val):

+        """Store `val` in the dictionary indexed at `key`."""

+        self._instances[key] = val

+

+    def delete_instance_state(self, key):

+        """Delete state indexed at `key`."""

+        del self._instances[key]