summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorTrey Morris <treyemorris@gmail.com>2012-02-10 17:21:52 -0600
committerTrey Morris <treyemorris@gmail.com>2012-02-10 17:24:26 -0600
commitaee267182ab86814bac22e28fed0beb370fa2293 (patch)
tree99a9ea191bbf554d543f649a6237a4f34ff2b6b3 /nova/tests
parent85ae58c21fc9019dfef5585accd53bdc667debde (diff)
remove all instance_type db lookups from network
increases efficiency without requiring extra parameters Change-Id: I858067afb94007c8e71748373873f7cc8bd54662
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/api/ec2/test_cloud.py3
-rw-r--r--nova/tests/fake_network.py16
-rw-r--r--nova/tests/test_quantum.py12
-rw-r--r--nova/tests/test_xenapi.py2
4 files changed, 9 insertions, 24 deletions
diff --git a/nova/tests/api/ec2/test_cloud.py b/nova/tests/api/ec2/test_cloud.py
index ef9d0e8c7..3b38ad259 100644
--- a/nova/tests/api/ec2/test_cloud.py
+++ b/nova/tests/api/ec2/test_cloud.py
@@ -198,13 +198,12 @@ class CloudTestCase(test.TestCase):
db.network_update(self.context, network['id'],
{'host': self.network.host})
project_id = self.context.project_id
- type_id = inst['instance_type_id']
nw_info = self.network.allocate_for_instance(self.context,
instance_id=inst['id'],
instance_uuid='',
host=inst['host'],
vpn=None,
- instance_type_id=type_id,
+ rxtx_factor=3,
project_id=project_id)
fixed_ips = nw_info.fixed_ips()
diff --git a/nova/tests/fake_network.py b/nova/tests/fake_network.py
index 08712a302..86167520c 100644
--- a/nova/tests/fake_network.py
+++ b/nova/tests/fake_network.py
@@ -154,16 +154,6 @@ class FakeNetworkManager(network_manager.NetworkManager):
pass
-flavor = {'id': 0,
- 'name': 'fake_flavor',
- 'memory_mb': 2048,
- 'vcpus': 2,
- 'root_gb': 10,
- 'flavor_id': 0,
- 'swap': 0,
- 'rxtx_factor': 3}
-
-
def fake_network(network_id, ipv6=None):
if ipv6 is None:
ipv6 = FLAGS.use_ipv6
@@ -295,9 +285,6 @@ def fake_get_instance_nw_info(stubs, num_networks=1, ips_per_vif=2,
'network': None,
'instance_id': 0}
- def instance_type_fake(*args, **kwargs):
- return flavor
-
def network_get_fake(context, network_id):
nets = [n for n in networks if n['id'] == network_id]
if not nets:
@@ -335,7 +322,6 @@ def fake_get_instance_nw_info(stubs, num_networks=1, ips_per_vif=2,
stubs.Set(db, 'virtual_interface_get_by_uuid', vif_by_uuid_fake)
stubs.Set(db, 'network_get_by_uuid', get_network_by_uuid)
stubs.Set(db, 'virtual_interface_get_by_instance', virtual_interfaces_fake)
- stubs.Set(db, 'instance_type_get', instance_type_fake)
stubs.Set(db, 'network_get', network_get_fake)
stubs.Set(db, 'instance_info_cache_update', update_cache_fake)
@@ -350,7 +336,7 @@ def fake_get_instance_nw_info(stubs, num_networks=1, ips_per_vif=2,
nw_model = network.get_instance_nw_info(
FakeContext('fakeuser', 'fake_project'),
- 0, 0, 0, None)
+ 0, 0, 3, None)
if spectacular:
return nw_model
return nova.compute.utils.legacy_network_info(nw_model)
diff --git a/nova/tests/test_quantum.py b/nova/tests/test_quantum.py
index 2e60bbc45..1605c49db 100644
--- a/nova/tests/test_quantum.py
+++ b/nova/tests/test_quantum.py
@@ -277,7 +277,7 @@ class QuantumNovaIPAMTestCase(QuantumNovaTestCase):
self.net_man.driver.kill_dhcp = func1
nw_info = self.net_man.allocate_for_instance(ctx.elevated(),
instance_id=instance_ref['id'], host="",
- instance_type_id=instance_ref['instance_type_id'],
+ rxtx_factor=3,
project_id=project_id)
self.assertEquals(len(nw_info), 2)
@@ -346,7 +346,7 @@ class QuantumNovaIPAMTestCase(QuantumNovaTestCase):
self.net_man.driver.kill_dhcp = func1
nw_info = self.net_man.allocate_for_instance(ctx,
instance_id=instance_ref['id'], host="",
- instance_type_id=instance_ref['instance_type_id'],
+ rxtx_factor=3,
project_id=project_id,
requested_networks=requested_networks)
@@ -410,7 +410,7 @@ class QuantumNovaMACGenerationTestCase(QuantumNovaTestCase):
{"project_id": project_id})
nw_info = self.net_man.allocate_for_instance(ctx,
instance_id=instance_ref['id'], host="",
- instance_type_id=instance_ref['instance_type_id'],
+ rxtx_factor=3,
project_id=project_id,
requested_networks=requested_networks)
self.assertEqual(nw_info[0]['address'], fake_mac)
@@ -431,7 +431,7 @@ class QuantumNovaMACGenerationTestCase(QuantumNovaTestCase):
{"project_id": project_id})
nw_info = self.net_man.allocate_for_instance(ctx,
instance_id=instance_ref['id'], host="",
- instance_type_id=instance_ref['instance_type_id'],
+ rxtx_factor=3,
project_id=project_id,
requested_networks=requested_networks)
self.assertEqual(nw_info[0]['address'], fake_mac)
@@ -468,7 +468,7 @@ class QuantumNovaPortSecurityTestCase(QuantumNovaTestCase):
_instrumented_create_and_attach_port
nw_info = self.net_man.allocate_for_instance(ctx,
instance_id=instance_ref['id'], host="",
- instance_type_id=instance_ref['instance_type_id'],
+ rxtx_factor=3,
project_id=project_id,
requested_networks=requested_networks)
self.assertEqual(nw_info[0]['address'], fake_mac)
@@ -502,7 +502,7 @@ class QuantumNovaPortSecurityTestCase(QuantumNovaTestCase):
_instrumented_create_and_attach_port
nw_info = self.net_man.allocate_for_instance(ctx,
instance_id=instance_ref['id'], host="",
- instance_type_id=instance_ref['instance_type_id'],
+ rxtx_factor=3,
project_id=project_id,
requested_networks=requested_networks)
self.assertEqual(nw_info[0]['address'], fake_mac)
diff --git a/nova/tests/test_xenapi.py b/nova/tests/test_xenapi.py
index 281e00fc0..ec10defea 100644
--- a/nova/tests/test_xenapi.py
+++ b/nova/tests/test_xenapi.py
@@ -642,7 +642,7 @@ class XenAPIVMTestCase(test.TestCase):
instance_uuid="00000000-0000-0000-0000-000000000000",
host=FLAGS.host,
vpn=None,
- instance_type_id=1,
+ rxtx_factor=3,
project_id=self.project_id)
self._test_spawn(glance_stubs.FakeGlance.IMAGE_MACHINE,
glance_stubs.FakeGlance.IMAGE_KERNEL,