summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorChuck Short <chuck.short@canonical.com>2012-05-23 14:31:47 -0400
committerChuck Short <chuck.short@canonical.com>2012-05-29 15:46:25 -0400
commit31bf321cf11783ebd1b7233bd752d23f3883101b (patch)
tree2778c8c9e2580dd59b7c07e091c3024f711d7eff /nova/tests
parentdab262af0d642c48c7d2b92bf8b0520ffc65daaf (diff)
Record instance architecture types.
In order to support image architectures other than x86, we need to record the instance architecture when it is running. Glance has the information that we need so we take the information that glance provides us. This is the first step for support other arches like armhf. Change-Id: Ia9ca1353a7cf56955d00d17f7bc1bfb3712a89ab Signed-off-by: Chuck Short <chuck.short@canonical.com>
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/compute/test_compute.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/nova/tests/compute/test_compute.py b/nova/tests/compute/test_compute.py
index 51e36daab..83671d265 100644
--- a/nova/tests/compute/test_compute.py
+++ b/nova/tests/compute/test_compute.py
@@ -154,6 +154,7 @@ class BaseTestCase(test.TestCase):
inst['vcpus'] = 0
inst['root_gb'] = 0
inst['ephemeral_gb'] = 0
+ inst['architecture'] = 'x86_64'
inst.update(params)
return db.instance_create(self.context, inst)
@@ -3439,6 +3440,24 @@ class ComputeAPITestCase(BaseTestCase):
db.instance_destroy(self.context, refs[0]['id'])
+ def test_instance_architecture(self):
+ """Test the instance architecture"""
+ i_ref = self._create_fake_instance()
+ self.assertEqual(i_ref['architecture'], 'x86_64')
+ db.instance_destroy(self.context, i_ref['id'])
+
+ def test_instance_unknown_architecture(self):
+ """Test if the architecture is unknown."""
+ instance = self._create_fake_instance(
+ params={'architecture': ''})
+ try:
+ self.compute.run_instance(self.context, instance['uuid'])
+ instances = db.instance_get_all(context.get_admin_context())
+ instance = instances[0]
+ self.assertNotEqual(instance['architecture'], 'Unknown')
+ finally:
+ db.instance_destroy(self.context, instance['id'])
+
def test_instance_name_template(self):
"""Test the instance_name template"""
self.flags(instance_name_template='instance-%d')