Merge lp:~justin-fathomdb/nova/bug744150 into lp:~hudson-openstack/nova/trunk

Proposed by justinsb
Status: Merged
Approved by: Todd Willey
Approved revision: 899
Merged at revision: 1101
Proposed branch: lp:~justin-fathomdb/nova/bug744150
Merge into: lp:~hudson-openstack/nova/trunk
Diff against target: 87 lines (+22/-6)
3 files modified
nova/service.py (+8/-2)
nova/tests/integrated/integrated_helpers.py (+10/-3)
nova/wsgi.py (+4/-1)
To merge this branch: bzr merge lp:~justin-fathomdb/nova/bug744150
Reviewer Review Type Date Requested Status
Rick Harris (community) Needs Fixing
Soren Hansen (community) Approve
Brian Waldon (community) Needs Fixing
Todd Willey (community) Approve
termie (community) Approve
Review via email: mp+55183@code.launchpad.net

Description of the change

Fix bug #744150 by starting nova-api on an unused port.

To post a comment you must log in.
Revision history for this message
justinsb (justin-fathomdb) wrote :

Starts nova-api on an unassigned port (in tests), so that we can run two unit tests at once.

Revision history for this message
termie (termie) wrote :

lgtm

review: Approve
Revision history for this message
Todd Willey (xtoddx) wrote :

lgtm

review: Approve
Revision history for this message
Vish Ishaya (vishvananda) wrote :

soren, since you reported this bug, can you weigh in on whether it should go in?

Revision history for this message
justinsb (justin-fathomdb) wrote :

I suggest it won't affect anyone in production, just our test suite, so we
live with running one test at once until diablo opens.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Attempt to merge into lp:nova failed due to conflicts:

text conflict in nova/service.py

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

@justinsb: Looks good once that conflict is resolved.

review: Needs Fixing
Revision history for this message
Soren Hansen (soren) wrote :

Yay! (apart from the conflicts, of course)

review: Approve
Revision history for this message
Rick Harris (rconradharris) wrote :

Looks great, just need to resolve the conflicts.

justinsb: Think you'll have time to tackle that in the near future?

review: Needs Fixing
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Attempt to merge into lp:nova failed due to conflicts:

text conflict in nova/service.py

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'nova/service.py'
2--- nova/service.py 2011-04-20 19:08:22 +0000
3+++ nova/service.py 2011-05-20 04:04:31 +0000
4@@ -240,6 +240,10 @@
5 def wait(self):
6 self.wsgi_app.wait()
7
8+ def get_socket_info(self, api_name):
9+ """Returns the (host, port) that an API was started on."""
10+ return self.wsgi_app.socket_info[api_name]
11+
12
13 class ApiService(WsgiService):
14 """Class for our nova-api service."""
15@@ -318,8 +322,10 @@
16 logging.debug(_('App Config: %(api)s\n%(config)r') % locals())
17 logging.info(_('Running %s API'), api)
18 app = wsgi.load_paste_app(paste_config_file, api)
19- apps.append((app, getattr(FLAGS, '%s_listen_port' % api),
20- getattr(FLAGS, '%s_listen' % api)))
21+ apps.append((app,
22+ getattr(FLAGS, '%s_listen_port' % api),
23+ getattr(FLAGS, '%s_listen' % api),
24+ api))
25 if len(apps) == 0:
26 logging.error(_('No known API applications configured in %s.'),
27 paste_config_file)
28
29=== modified file 'nova/tests/integrated/integrated_helpers.py'
30--- nova/tests/integrated/integrated_helpers.py 2011-03-30 01:13:04 +0000
31+++ nova/tests/integrated/integrated_helpers.py 2011-05-20 04:04:31 +0000
32@@ -160,7 +160,7 @@
33 #self.start_service('network')
34 self.start_service('scheduler')
35
36- self.auth_url = self._start_api_service()
37+ self._start_api_service()
38
39 self.context = IntegratedUnitTestContext(self.auth_url)
40
41@@ -174,8 +174,10 @@
42 if not api_service:
43 raise Exception("API Service was None")
44
45- auth_url = 'http://localhost:8774/v1.1'
46- return auth_url
47+ self.api_service = api_service
48+
49+ host, port = api_service.get_socket_info('osapi')
50+ self.auth_url = 'http://%s:%s/v1.1' % (host, port)
51
52 def tearDown(self):
53 self.context.cleanup()
54@@ -184,6 +186,11 @@
55 def _get_flags(self):
56 """An opportunity to setup flags, before the services are started."""
57 f = {}
58+
59+ # Auto-assign ports to allow concurrent tests
60+ f['ec2_listen_port'] = 0
61+ f['osapi_listen_port'] = 0
62+
63 f['image_service'] = 'nova.image.fake.FakeImageService'
64 f['fake_network'] = True
65 return f
66
67=== modified file 'nova/wsgi.py'
68--- nova/wsgi.py 2011-04-27 21:03:05 +0000
69+++ nova/wsgi.py 2011-05-20 04:04:31 +0000
70@@ -59,13 +59,16 @@
71
72 def __init__(self, threads=1000):
73 self.pool = eventlet.GreenPool(threads)
74+ self.socket_info = {}
75
76- def start(self, application, port, host='0.0.0.0', backlog=128):
77+ def start(self, application, port, host='0.0.0.0', key=None, backlog=128):
78 """Run a WSGI server with the given application."""
79 arg0 = sys.argv[0]
80 logging.audit(_('Starting %(arg0)s on %(host)s:%(port)s') % locals())
81 socket = eventlet.listen((host, port), backlog=backlog)
82 self.pool.spawn_n(self._run, application, socket)
83+ if key:
84+ self.socket_info[key] = socket.getsockname()
85
86 def wait(self):
87 """Wait until all servers have completed running."""