diff options
author | Joe Gordon <jogo@cloudscaling.com> | 2013-02-19 00:19:52 +0000 |
---|---|---|
committer | Joe Gordon <jogo@cloudscaling.com> | 2013-02-19 00:19:52 +0000 |
commit | a8dc27b54ee991f0370ba587918db2317618c6ec (patch) | |
tree | bb58a442f82b6ce239846d82adac00b34a1b78ea | |
parent | b23c557cc8d03028caba95777f98adfe9b1031d9 (diff) | |
download | nova-a8dc27b54ee991f0370ba587918db2317618c6ec.tar.gz nova-a8dc27b54ee991f0370ba587918db2317618c6ec.tar.xz nova-a8dc27b54ee991f0370ba587918db2317618c6ec.zip |
Remove unused nova.db.api:network_get_by_instance
Change-Id: I908aaafa149c6548271fd9a3cc91225f2cbdb841
-rw-r--r-- | nova/db/api.py | 5 | ||||
-rw-r--r-- | nova/db/sqlalchemy/api.py | 14 | ||||
-rw-r--r-- | nova/tests/db/fakes.py | 10 | ||||
-rw-r--r-- | nova/tests/hyperv/db_fakes.py | 13 | ||||
-rw-r--r-- | nova/tests/vmwareapi/db_fakes.py | 13 |
5 files changed, 1 insertions, 54 deletions
diff --git a/nova/db/api.py b/nova/db/api.py index 6ec0b3a95..57f0b2787 100644 --- a/nova/db/api.py +++ b/nova/db/api.py @@ -863,11 +863,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 375a3884b..0f6f5a12b 100644 --- a/nova/db/sqlalchemy/api.py +++ b/nova/db/sqlalchemy/api.py @@ -2288,20 +2288,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) |