Merge lp:~cerberus/nova/lp813006 into lp:~hudson-openstack/nova/trunk

Proposed by Matt Dietz
Status: Merged
Approved by: Brian Waldon
Approved revision: 1286
Merged at revision: 1296
Proposed branch: lp:~cerberus/nova/lp813006
Merge into: lp:~hudson-openstack/nova/trunk
Diff against target: 204 lines (+20/-21)
10 files modified
nova/compute/instance_types.py (+1/-1)
nova/compute/manager.py (+1/-1)
nova/db/api.py (+2/-2)
nova/db/sqlalchemy/api.py (+1/-1)
nova/network/manager.py (+1/-2)
nova/tests/db/fakes.py (+4/-4)
nova/tests/test_compute.py (+3/-3)
nova/tests/test_instance_types_extra_specs.py (+4/-4)
nova/tests/test_network.py (+2/-2)
nova/virt/libvirt/netutils.py (+1/-1)
To merge this branch: bzr merge lp:~cerberus/nova/lp813006
Reviewer Review Type Date Requested Status
Brian Waldon (community) Approve
Brian Lamar (community) Approve
Jay Pipes (community) Approve
Review via email: mp+68474@code.launchpad.net

Description of the change

Fixes lp813006

Inconsistent database API method naming for instance_types

To post a comment you must log in.
Revision history for this message
Jay Pipes (jaypipes) wrote :

straightforward enough :)

review: Approve
Revision history for this message
Brian Lamar (blamar) wrote :

Ditto

review: Approve
Revision history for this message
Brian Waldon (bcwaldon) wrote :

Good cleanup, Matthew Dietz.

review: Approve
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :
Download full text (191.8 KiB)

The attempt to merge lp:~cerberus/nova/lp813006 into lp:nova failed. Below is the output from the failed tests.

FloatingIpTest
    test_floating_ip_allocate OK 0.31
    test_floating_ip_associate OK 0.10
    test_floating_ip_disassociate OK 0.10
    test_floating_ip_release OK 0.10
    test_floating_ip_show OK 0.10
    test_floating_ips_list OK 0.10
    test_translate_floating_ip_view OK 0.04
FixedIpTest
    test_add_fixed_ip OK 0.08
    test_add_fixed_ip_no_network OK 0.08
    test_remove_fixed_ip OK 0.08
    test_remove_fixed_ip_no_address OK 0.29
FlavorsExtraSpecsTest
    test_create OK 0.05
    test_create_empty_body OK 0.05
    test_delete OK 0.05
    test_index OK 0.05
    test_index_no_data OK 0.05
    test_show OK 0.05
    test_show_spec_not_found OK 0.05
    test_update_item OK 0.05
    test_update_item_body_uri_mismatch OK 0.05
    test_update_item_empty_body OK 0.06
    test_update_item_too_many_keys OK 0.06
AccountsTest
    test_account_create OK 0.39
    test_account_delete OK 0.18
    test_account_update OK 0.18
    test_get_account OK 0.18
AdminAPITest
    test_admin_disabled OK 0.14
    test_admin_enabled OK 0.44
APITest
    test_exceptions_are_converted_to_faults OK 0.02
    test_malformed_json OK 0.06
    test_malformed_xml OK 0.06
Test
    test_authorize_project OK 0.10
    test_authorize_token OK 0.11
    test_authorize_user OK 0.06
    test_bad_project OK 0.34
    test_bad_token OK 0.06
    test_bad_user_bad_key OK 0.06
    test_bad_user_good_key OK 0.05
    test_no_user OK 0.05
    test_not_existing_project OK 0.11
    test_token_expiry OK 0.06
TestFu...

Revision history for this message
Brian Waldon (bcwaldon) wrote :

Looks like two problems:
1) Neither of us are grep-masters (missed test_compute.py)
2) Your other instance_type branch added some more instance_type_get_by_id calls

Revision history for this message
Matt Dietz (cerberus) wrote :

Brian, that would appear to be the case

Revision history for this message
Brian Waldon (bcwaldon) wrote :

Sweet.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'nova/compute/instance_types.py'
2--- nova/compute/instance_types.py 2011-06-07 17:32:53 +0000
3+++ nova/compute/instance_types.py 2011-07-21 16:54:37 +0000
4@@ -112,7 +112,7 @@
5 return get_default_instance_type()
6 try:
7 ctxt = context.get_admin_context()
8- return db.instance_type_get_by_id(ctxt, id)
9+ return db.instance_type_get(ctxt, id)
10 except exception.DBError:
11 raise exception.ApiError(_("Unknown instance type: %s") % id)
12
13
14=== modified file 'nova/compute/manager.py'
15--- nova/compute/manager.py 2011-07-20 18:19:34 +0000
16+++ nova/compute/manager.py 2011-07-21 16:54:37 +0000
17@@ -748,7 +748,7 @@
18 raise exception.Error(_(
19 'Migration error: destination same as source!'))
20
21- old_instance_type = self.db.instance_type_get_by_id(context,
22+ old_instance_type = self.db.instance_type_get(context,
23 instance_ref['instance_type_id'])
24
25 migration_ref = self.db.migration_create(context,
26
27=== modified file 'nova/db/api.py'
28--- nova/db/api.py 2011-07-18 23:58:23 +0000
29+++ nova/db/api.py 2011-07-21 16:54:37 +0000
30@@ -1311,9 +1311,9 @@
31 return IMPL.instance_type_get_all(context, inactive)
32
33
34-def instance_type_get_by_id(context, id):
35+def instance_type_get(context, id):
36 """Get instance type by id."""
37- return IMPL.instance_type_get_by_id(context, id)
38+ return IMPL.instance_type_get(context, id)
39
40
41 def instance_type_get_by_name(context, name):
42
43=== modified file 'nova/db/sqlalchemy/api.py'
44--- nova/db/sqlalchemy/api.py 2011-07-21 14:27:20 +0000
45+++ nova/db/sqlalchemy/api.py 2011-07-21 16:54:37 +0000
46@@ -3006,7 +3006,7 @@
47
48
49 @require_context
50-def instance_type_get_by_id(context, id):
51+def instance_type_get(context, id):
52 """Returns a dict describing specific instance_type"""
53 session = get_session()
54 inst_type = session.query(models.InstanceTypes).\
55
56=== modified file 'nova/network/manager.py'
57--- nova/network/manager.py 2011-07-20 18:27:15 +0000
58+++ nova/network/manager.py 2011-07-21 16:54:37 +0000
59@@ -429,8 +429,7 @@
60 # TODO(tr3buchet) should handle floating IPs as well?
61 fixed_ips = self.db.fixed_ip_get_by_instance(context, instance_id)
62 vifs = self.db.virtual_interface_get_by_instance(context, instance_id)
63- flavor = self.db.instance_type_get_by_id(context,
64- instance_type_id)
65+ flavor = self.db.instance_type_get(context, instance_type_id)
66 network_info = []
67 # a vif has an address, instance_id, and network_id
68 # it is also joined to the instance and network given by those IDs
69
70=== modified file 'nova/tests/db/fakes.py'
71--- nova/tests/db/fakes.py 2011-07-01 18:06:18 +0000
72+++ nova/tests/db/fakes.py 2011-07-21 16:54:37 +0000
73@@ -230,7 +230,7 @@
74 continue
75 fixed_ip_fields['virtual_interface'] = FakeModel(vif[0])
76
77- def fake_instance_type_get_by_id(context, id):
78+ def fake_instance_type_get(context, id):
79 if flavor_fields['id'] == id:
80 return FakeModel(flavor_fields)
81
82@@ -323,7 +323,7 @@
83 fake_fixed_ip_get_by_address,
84 fake_fixed_ip_get_network,
85 fake_fixed_ip_update,
86- fake_instance_type_get_by_id,
87+ fake_instance_type_get,
88 fake_virtual_interface_create,
89 fake_virtual_interface_delete_by_instance,
90 fake_virtual_interface_get_by_instance,
91@@ -415,7 +415,7 @@
92 def fake_instance_type_get_by_name(context, name):
93 return INSTANCE_TYPES[name]
94
95- def fake_instance_type_get_by_id(context, id):
96+ def fake_instance_type_get(context, id):
97 for name, inst_type in INSTANCE_TYPES.iteritems():
98 if str(inst_type['id']) == str(id):
99 return inst_type
100@@ -448,7 +448,7 @@
101 fake_network_get_all_by_instance,
102 fake_instance_type_get_all,
103 fake_instance_type_get_by_name,
104- fake_instance_type_get_by_id,
105+ fake_instance_type_get,
106 fake_instance_get_fixed_addresses,
107 fake_instance_get_fixed_addresses_v6,
108 fake_network_get_all_by_instance,
109
110=== modified file 'nova/tests/test_compute.py'
111--- nova/tests/test_compute.py 2011-07-19 20:21:39 +0000
112+++ nova/tests/test_compute.py 2011-07-21 16:54:37 +0000
113@@ -535,7 +535,7 @@
114
115 # Confirm the instance size before the resize starts
116 inst_ref = db.instance_get(context, instance_id)
117- instance_type_ref = db.instance_type_get_by_id(context,
118+ instance_type_ref = db.instance_type_get(context,
119 inst_ref['instance_type_id'])
120 self.assertEqual(instance_type_ref['flavorid'], 1)
121
122@@ -553,7 +553,7 @@
123
124 # Prove that the instance size is now the new size
125 inst_ref = db.instance_get(context, instance_id)
126- instance_type_ref = db.instance_type_get_by_id(context,
127+ instance_type_ref = db.instance_type_get(context,
128 inst_ref['instance_type_id'])
129 self.assertEqual(instance_type_ref['flavorid'], 3)
130
131@@ -564,7 +564,7 @@
132 migration_ref['id'])
133
134 inst_ref = db.instance_get(context, instance_id)
135- instance_type_ref = db.instance_type_get_by_id(context,
136+ instance_type_ref = db.instance_type_get(context,
137 inst_ref['instance_type_id'])
138 self.assertEqual(instance_type_ref['flavorid'], 1)
139
140
141=== modified file 'nova/tests/test_instance_types_extra_specs.py'
142--- nova/tests/test_instance_types_extra_specs.py 2011-06-24 02:55:51 +0000
143+++ nova/tests/test_instance_types_extra_specs.py 2011-07-21 16:54:37 +0000
144@@ -105,8 +105,8 @@
145 self.instance_type_id)
146 self.assertEquals(expected_specs, actual_specs)
147
148- def test_instance_type_get_by_id_with_extra_specs(self):
149- instance_type = db.api.instance_type_get_by_id(
150+ def test_instance_type_get_with_extra_specs(self):
151+ instance_type = db.api.instance_type_get(
152 context.get_admin_context(),
153 self.instance_type_id)
154 self.assertEquals(instance_type['extra_specs'],
155@@ -115,7 +115,7 @@
156 xpu_arch="fermi",
157 xpus="2",
158 xpu_model="Tesla 2050"))
159- instance_type = db.api.instance_type_get_by_id(
160+ instance_type = db.api.instance_type_get(
161 context.get_admin_context(),
162 5)
163 self.assertEquals(instance_type['extra_specs'], {})
164@@ -136,7 +136,7 @@
165 "m1.small")
166 self.assertEquals(instance_type['extra_specs'], {})
167
168- def test_instance_type_get_by_id_with_extra_specs(self):
169+ def test_instance_type_get_with_extra_specs(self):
170 instance_type = db.api.instance_type_get_by_flavor_id(
171 context.get_admin_context(),
172 105)
173
174=== modified file 'nova/tests/test_network.py'
175--- nova/tests/test_network.py 2011-07-18 23:58:23 +0000
176+++ nova/tests/test_network.py 2011-07-21 16:54:37 +0000
177@@ -127,13 +127,13 @@
178 def test_get_instance_nw_info(self):
179 self.mox.StubOutWithMock(db, 'fixed_ip_get_by_instance')
180 self.mox.StubOutWithMock(db, 'virtual_interface_get_by_instance')
181- self.mox.StubOutWithMock(db, 'instance_type_get_by_id')
182+ self.mox.StubOutWithMock(db, 'instance_type_get')
183
184 db.fixed_ip_get_by_instance(mox.IgnoreArg(),
185 mox.IgnoreArg()).AndReturn(fixed_ips)
186 db.virtual_interface_get_by_instance(mox.IgnoreArg(),
187 mox.IgnoreArg()).AndReturn(vifs)
188- db.instance_type_get_by_id(mox.IgnoreArg(),
189+ db.instance_type_get(mox.IgnoreArg(),
190 mox.IgnoreArg()).AndReturn(flavor)
191 self.mox.ReplayAll()
192
193
194=== modified file 'nova/virt/libvirt/netutils.py'
195--- nova/virt/libvirt/netutils.py 2011-06-27 21:48:03 +0000
196+++ nova/virt/libvirt/netutils.py 2011-07-21 16:54:37 +0000
197@@ -59,7 +59,7 @@
198 vifs = db.virtual_interface_get_by_instance(admin_context, instance['id'])
199 networks = db.network_get_all_by_instance(admin_context,
200 instance['id'])
201- flavor = db.instance_type_get_by_id(admin_context,
202+ flavor = db.instance_type_get(admin_context,
203 instance['instance_type_id'])
204 network_info = []
205