summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorEwan Mellor <ewan.mellor@citrix.com>2010-07-18 18:15:12 +0100
committerEwan Mellor <ewan.mellor@citrix.com>2010-07-18 18:15:12 +0100
commitf39d6549d4e57941b14f328fa5a52a3a5f925d42 (patch)
tree24da962064d7741da065842f2032577aa0268ac5 /nova/tests
parentd5309eff30b1a826f075b28935de2a4b89eede6e (diff)
In preparation for XenAPI support, refactor the interface between
nova.compute and the hypervisor (i.e. libvirt). compute.node is no longer coupled tightly with libvirt. Instead, hypervisor connections are handled through a simple abstract interface. This has the additional advantage that there is no need to riddle the code with FLAGS.fake_libvirt checks, as we now have an interface behind which we can mock. The libvirt-specific code, and the fakevirt code used for unit tests, have moved into nova.virt. The fake_libvirt flag has been replaced with a connection_type flag, that will allow us to specify different connection types. The disk image handling (S3 or local disk image fetch) has moved into nova.virt.images, where it will be easier to share between connection types. The power_state values (Instance.RUNNING etc) and the INSTANCE_TYPES dictionary have moved into their own files (nova.compute.instance_types and nova.compute.power_state) so that we can share them without mutual dependencies between nova.compute.node and nova.virt.libvirt_conn.
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/access_unittest.py2
-rw-r--r--nova/tests/cloud_unittest.py8
-rw-r--r--nova/tests/fake_flags.py2
-rw-r--r--nova/tests/future_unittest.py2
-rw-r--r--nova/tests/model_unittest.py2
-rw-r--r--nova/tests/network_unittest.py2
-rw-r--r--nova/tests/node_unittest.py2
-rw-r--r--nova/tests/objectstore_unittest.py2
-rw-r--r--nova/tests/real_flags.py2
-rw-r--r--nova/tests/storage_unittest.py2
-rw-r--r--nova/tests/users_unittest.py2
11 files changed, 15 insertions, 13 deletions
diff --git a/nova/tests/access_unittest.py b/nova/tests/access_unittest.py
index 8500dd0cb..6cf7e893d 100644
--- a/nova/tests/access_unittest.py
+++ b/nova/tests/access_unittest.py
@@ -33,7 +33,7 @@ class Context(object):
class AccessTestCase(test.BaseTestCase):
def setUp(self):
super(AccessTestCase, self).setUp()
- FLAGS.fake_libvirt = True
+ FLAGS.connection_type = 'fake'
FLAGS.fake_storage = True
um = UserManager.instance()
# Make test users
diff --git a/nova/tests/cloud_unittest.py b/nova/tests/cloud_unittest.py
index b8614fdc8..8040f6331 100644
--- a/nova/tests/cloud_unittest.py
+++ b/nova/tests/cloud_unittest.py
@@ -39,7 +39,7 @@ FLAGS = flags.FLAGS
class CloudTestCase(test.BaseTestCase):
def setUp(self):
super(CloudTestCase, self).setUp()
- self.flags(fake_libvirt=True,
+ self.flags(connection_type='fake',
fake_storage=True,
fake_users=True)
@@ -72,7 +72,7 @@ class CloudTestCase(test.BaseTestCase):
users.UserManager.instance().delete_user('admin')
def test_console_output(self):
- if FLAGS.fake_libvirt:
+ if FLAGS.connection_type == 'fake':
logging.debug("Can't test instances without a real virtual env.")
return
instance_id = 'foo'
@@ -83,7 +83,7 @@ class CloudTestCase(test.BaseTestCase):
rv = yield self.node.terminate_instance(instance_id)
def test_run_instances(self):
- if FLAGS.fake_libvirt:
+ if FLAGS.connection_type == 'fake':
logging.debug("Can't test instances without a real virtual env.")
return
image_id = FLAGS.default_image
@@ -104,7 +104,7 @@ class CloudTestCase(test.BaseTestCase):
break
self.assert_(rv)
- if not FLAGS.fake_libvirt:
+ if connection_type != 'fake':
time.sleep(45) # Should use boto for polling here
for reservations in rv['reservationSet']:
# for res_id in reservations.keys():
diff --git a/nova/tests/fake_flags.py b/nova/tests/fake_flags.py
index d32f40d8f..5fcd2bcac 100644
--- a/nova/tests/fake_flags.py
+++ b/nova/tests/fake_flags.py
@@ -20,7 +20,7 @@ from nova import flags
FLAGS = flags.FLAGS
-FLAGS.fake_libvirt = True
+FLAGS.connection_type = 'fake'
FLAGS.fake_storage = True
FLAGS.fake_rabbit = True
FLAGS.fake_network = True
diff --git a/nova/tests/future_unittest.py b/nova/tests/future_unittest.py
index da5470ffe..31ec83065 100644
--- a/nova/tests/future_unittest.py
+++ b/nova/tests/future_unittest.py
@@ -39,7 +39,7 @@ FLAGS = flags.FLAGS
class AdminTestCase(test.BaseTestCase):
def setUp(self):
super(AdminTestCase, self).setUp()
- self.flags(fake_libvirt=True,
+ self.flags(connection_type='fake',
fake_rabbit=True)
self.conn = rpc.Connection.instance()
diff --git a/nova/tests/model_unittest.py b/nova/tests/model_unittest.py
index 1bd7e527f..b9eb2ac96 100644
--- a/nova/tests/model_unittest.py
+++ b/nova/tests/model_unittest.py
@@ -34,7 +34,7 @@ FLAGS = flags.FLAGS
class ModelTestCase(test.TrialTestCase):
def setUp(self):
super(ModelTestCase, self).setUp()
- self.flags(fake_libvirt=True,
+ self.flags(connection_type='fake',
fake_storage=True,
fake_users=True)
diff --git a/nova/tests/network_unittest.py b/nova/tests/network_unittest.py
index a822cc1d9..45ee6dbc7 100644
--- a/nova/tests/network_unittest.py
+++ b/nova/tests/network_unittest.py
@@ -33,7 +33,7 @@ from nova import utils
class NetworkTestCase(test.TrialTestCase):
def setUp(self):
super(NetworkTestCase, self).setUp()
- self.flags(fake_libvirt=True,
+ self.flags(connection_type='fake',
fake_storage=True,
fake_network=True,
network_size=32)
diff --git a/nova/tests/node_unittest.py b/nova/tests/node_unittest.py
index 93942d79e..86d9775fd 100644
--- a/nova/tests/node_unittest.py
+++ b/nova/tests/node_unittest.py
@@ -57,7 +57,7 @@ class NodeConnectionTestCase(test.TrialTestCase):
def setUp(self):
logging.getLogger().setLevel(logging.DEBUG)
super(NodeConnectionTestCase, self).setUp()
- self.flags(fake_libvirt=True,
+ self.flags(connection_type='fake',
fake_storage=True,
fake_users=True)
self.node = node.Node()
diff --git a/nova/tests/objectstore_unittest.py b/nova/tests/objectstore_unittest.py
index f47ca7f00..f22256aaf 100644
--- a/nova/tests/objectstore_unittest.py
+++ b/nova/tests/objectstore_unittest.py
@@ -25,6 +25,8 @@ import tempfile
from nova import flags
from nova import objectstore
+from nova.objectstore import bucket # for buckets_path flag
+from nova.objectstore import image # for images_path flag
from nova import test
from nova.auth import users
diff --git a/nova/tests/real_flags.py b/nova/tests/real_flags.py
index 9e106f227..690fb640a 100644
--- a/nova/tests/real_flags.py
+++ b/nova/tests/real_flags.py
@@ -20,7 +20,7 @@ from nova import flags
FLAGS = flags.FLAGS
-FLAGS.fake_libvirt = False
+FLAGS.connection_type = 'libvirt'
FLAGS.fake_storage = False
FLAGS.fake_rabbit = False
FLAGS.fake_network = False
diff --git a/nova/tests/storage_unittest.py b/nova/tests/storage_unittest.py
index 60576d74f..f400cd2fd 100644
--- a/nova/tests/storage_unittest.py
+++ b/nova/tests/storage_unittest.py
@@ -34,7 +34,7 @@ class StorageTestCase(test.TrialTestCase):
super(StorageTestCase, self).setUp()
self.mynode = node.Node()
self.mystorage = None
- self.flags(fake_libvirt=True,
+ self.flags(connection_type='fake',
fake_storage=True)
self.mystorage = storage.BlockStore()
diff --git a/nova/tests/users_unittest.py b/nova/tests/users_unittest.py
index 301721075..824d5cff6 100644
--- a/nova/tests/users_unittest.py
+++ b/nova/tests/users_unittest.py
@@ -35,7 +35,7 @@ class UserTestCase(test.BaseTestCase):
flush_db = False
def setUp(self):
super(UserTestCase, self).setUp()
- self.flags(fake_libvirt=True,
+ self.flags(connection_type='fake',
fake_storage=True)
self.users = users.UserManager.instance()