summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--nova/db/api.py5
-rw-r--r--nova/db/sqlalchemy/api.py14
-rw-r--r--nova/tests/db/fakes.py10
-rw-r--r--nova/tests/hyperv/db_fakes.py13
-rw-r--r--nova/tests/vmwareapi/db_fakes.py13
5 files changed, 1 insertions, 54 deletions
diff --git a/nova/db/api.py b/nova/db/api.py
index a70529834..0abe63cf8 100644
--- a/nova/db/api.py
+++ b/nova/db/api.py
@@ -853,11 +853,6 @@ def network_get_by_cidr(context, cidr):
return IMPL.network_get_by_cidr(context, cidr)
-def network_get_by_instance(context, instance_id):
- """Get a network by instance id or raise if it does not exist."""
- return IMPL.network_get_by_instance(context, instance_id)
-
-
def network_get_all_by_instance(context, instance_id):
"""Get all networks by instance id or raise if none exist."""
return IMPL.network_get_all_by_instance(context, instance_id)
diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py
index 43c2d960f..03373764f 100644
--- a/nova/db/sqlalchemy/api.py
+++ b/nova/db/sqlalchemy/api.py
@@ -2269,20 +2269,6 @@ def network_get_by_cidr(context, cidr):
@require_admin_context
-def network_get_by_instance(context, instance_id):
- # note this uses fixed IP to get to instance
- # only works for networks the instance has an IP from
- result = _network_get_query(context).\
- filter_by(instance_id=instance_id).\
- first()
-
- if not result:
- raise exception.NetworkNotFoundForInstance(instance_id=instance_id)
-
- return result
-
-
-@require_admin_context
def network_get_all_by_instance(context, instance_id):
result = _network_get_query(context).\
filter_by(instance_id=instance_id).\
diff --git a/nova/tests/db/fakes.py b/nova/tests/db/fakes.py
index b14f248e6..d77e189df 100644
--- a/nova/tests/db/fakes.py
+++ b/nova/tests/db/fakes.py
@@ -421,13 +421,6 @@ def stub_out_db_instance_api(stubs, injected=True):
return inst_type
return None
- def fake_network_get_by_instance(context, instance_id):
- # Even instance numbers are on vlan networks
- if instance_id % 2 == 0:
- return FakeModel(vlan_network_fields)
- else:
- return FakeModel(flat_network_fields)
-
def fake_network_get_all_by_instance(context, instance_id):
# Even instance numbers are on vlan networks
if instance_id % 2 == 0:
@@ -438,8 +431,7 @@ def stub_out_db_instance_api(stubs, injected=True):
def fake_fixed_ip_get_by_instance(context, instance_id):
return [FakeModel(fixed_ip_fields)]
- funcs = [fake_network_get_by_instance,
- fake_network_get_all_by_instance,
+ funcs = [fake_network_get_all_by_instance,
fake_instance_type_get_all,
fake_instance_type_get_by_name,
fake_instance_type_get,
diff --git a/nova/tests/hyperv/db_fakes.py b/nova/tests/hyperv/db_fakes.py
index e384e909a..7169edf8d 100644
--- a/nova/tests/hyperv/db_fakes.py
+++ b/nova/tests/hyperv/db_fakes.py
@@ -153,18 +153,6 @@ def stub_out_db_instance_api(stubs):
}
return FakeModel(base_options)
- def fake_network_get_by_instance(context, instance_id):
- """Stubs out the db.network_get_by_instance method."""
-
- fields = {
- 'bridge': 'vmnet0',
- 'netmask': '255.255.255.0',
- 'gateway': '10.10.10.1',
- 'broadcast': '10.10.10.255',
- 'dns1': 'fake',
- 'vlan': 100}
- return FakeModel(fields)
-
def fake_instance_type_get_all(context, inactive=0, filters=None):
return INSTANCE_TYPES.values()
@@ -175,7 +163,6 @@ def stub_out_db_instance_api(stubs):
return {}
stubs.Set(db, 'instance_create', fake_instance_create)
- stubs.Set(db, 'network_get_by_instance', fake_network_get_by_instance)
stubs.Set(db, 'instance_type_get_all', fake_instance_type_get_all)
stubs.Set(db, 'instance_type_get_by_name', fake_instance_type_get_by_name)
stubs.Set(db, 'block_device_mapping_get_all_by_instance',
diff --git a/nova/tests/vmwareapi/db_fakes.py b/nova/tests/vmwareapi/db_fakes.py
index dd19f4929..f3191670d 100644
--- a/nova/tests/vmwareapi/db_fakes.py
+++ b/nova/tests/vmwareapi/db_fakes.py
@@ -81,18 +81,6 @@ def stub_out_db_instance_api(stubs):
}
return FakeModel(base_options)
- def fake_network_get_by_instance(context, instance_id):
- """Stubs out the db.network_get_by_instance method."""
-
- fields = {
- 'bridge': 'vmnet0',
- 'netmask': '255.255.255.0',
- 'gateway': '10.10.10.1',
- 'broadcast': '10.10.10.255',
- 'dns1': 'fake',
- 'vlan': 100}
- return FakeModel(fields)
-
def fake_instance_type_get_all(context, inactive=0, filters=None):
return INSTANCE_TYPES.values()
@@ -100,6 +88,5 @@ def stub_out_db_instance_api(stubs):
return INSTANCE_TYPES[name]
stubs.Set(db, 'instance_create', fake_instance_create)
- stubs.Set(db, 'network_get_by_instance', fake_network_get_by_instance)
stubs.Set(db, 'instance_type_get_all', fake_instance_type_get_all)
stubs.Set(db, 'instance_type_get_by_name', fake_instance_type_get_by_name)