summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorDan Smith <danms@us.ibm.com>2012-11-02 13:48:15 -0700
committerDan Smith <danms@us.ibm.com>2012-11-02 13:48:15 -0700
commit8b283c2f83ebd11b5920e28036ca1aa4bea63df4 (patch)
treecfa4e9ea8d7393b1b8e9cdbfa21fc3d56aa12a5e /nova/tests
parent8a134759982a497118acbee328a01b00e9cb2a44 (diff)
Remove unnecessary db call from xenapi/vmops
There are two db.instance_type_get() calls in xenapi that don't need to be there. By fetching the info out of the instance['instance_type'] field, we can avoid the lookup (and adding interfaces to support this in VirtAPI). Note that the tests require a little extra fakeage to replicate what is happening in the real db driver. Change-Id: I727c98fe18ca28f1db62ece2abfd50b4e13852ba
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/test_xenapi.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/nova/tests/test_xenapi.py b/nova/tests/test_xenapi.py
index 94daf0b5c..404c183a0 100644
--- a/nova/tests/test_xenapi.py
+++ b/nova/tests/test_xenapi.py
@@ -1488,6 +1488,11 @@ class XenAPIGenerateLocal(stubs.XenAPITestBase):
instance = db.instance_update(self.context, instance['uuid'],
{'instance_type_id': 5})
+ # NOTE(danms): because we're stubbing out the instance_types from
+ # the database, our instance['instance_type'] doesn't get properly
+ # filled out here, so put what we need into it
+ instance['instance_type']['swap'] = 1024
+
def fake_generate_swap(*args, **kwargs):
self.called = True
self.stubs.Set(vm_utils, 'generate_swap', fake_generate_swap)
@@ -1500,6 +1505,11 @@ class XenAPIGenerateLocal(stubs.XenAPITestBase):
instance = db.instance_update(self.context, instance['uuid'],
{'instance_type_id': 4})
+ # NOTE(danms): because we're stubbing out the instance_types from
+ # the database, our instance['instance_type'] doesn't get properly
+ # filled out here, so put what we need into it
+ instance['instance_type']['ephemeral_gb'] = 160
+
def fake_generate_ephemeral(*args):
self.called = True
self.stubs.Set(vm_utils, 'generate_ephemeral', fake_generate_ephemeral)