From 2337fab0979b72bbc7e7730e94518a0e835a2751 Mon Sep 17 00:00:00 2001 From: Andy Smith Date: Mon, 25 Oct 2010 03:45:19 +0900 Subject: part way through porting the codebase off of twisted this provides a very basic eventlet-based service replacement for the twistd-based services, a replacement for task.LoopingCall also adds nova-combined with the goal of running a single service when doing local testing and dev --- bin/nova-combined | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ bin/nova-compute | 12 +++++------ bin/nova-network | 14 ++++++------- 3 files changed, 72 insertions(+), 15 deletions(-) create mode 100755 bin/nova-combined (limited to 'bin') diff --git a/bin/nova-combined b/bin/nova-combined new file mode 100755 index 000000000..65865acd9 --- /dev/null +++ b/bin/nova-combined @@ -0,0 +1,61 @@ +#!/usr/bin/env python +# vim: tabstop=4 shiftwidth=4 softtabstop=4 + +# Copyright 2010 United States Government as represented by the +# Administrator of the National Aeronautics and Space Administration. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +""" + Twistd daemon for the nova compute nodes. +""" + +import eventlet +eventlet.monkey_patch() + +import os +import sys + +from eventlet import greenthread + +# If ../nova/__init__.py exists, add ../ to Python search path, so that +# it will override what happens to be installed in /usr/(local/)lib/python... +possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), + os.pardir, + os.pardir)) +if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): + sys.path.insert(0, possible_topdir) + +from nova import api +from nova import flags +from nova import service_eventlet +from nova import wsgi + + +FLAGS = flags.FLAGS +flags.DEFINE_integer('api_port', 8773, 'API port') + + +if __name__ == '__main__': + FLAGS(sys.argv) + + compute = service_eventlet.Service.create(binary='nova-compute') + network = service_eventlet.Service.create(binary='nova-network') + volume = service_eventlet.Service.create(binary='nova-volume') + scheduler = service_eventlet.Service.create(binary='nova-scheduler') + #objectstore = service_eventlet.Service.create(binary='nova-objectstore') + + service_eventlet.serve(compute, network, volume, scheduler) + wsgi.run_server(api.API(), FLAGS.api_port) + diff --git a/bin/nova-compute b/bin/nova-compute index 1724e9659..600fbb897 100755 --- a/bin/nova-compute +++ b/bin/nova-compute @@ -21,6 +21,9 @@ Twistd daemon for the nova compute nodes. """ +import eventlet +eventlet.monkey_patch() + import os import sys @@ -32,12 +35,7 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): sys.path.insert(0, possible_topdir) -from nova import service -from nova import twistd - +from nova import service_eventlet if __name__ == '__main__': - twistd.serve(__file__) - -if __name__ == '__builtin__': - application = service.Service.create() # pylint: disable=C0103 + service_eventlet.serve() diff --git a/bin/nova-network b/bin/nova-network index fa88aeb47..600fbb897 100755 --- a/bin/nova-network +++ b/bin/nova-network @@ -18,9 +18,12 @@ # under the License. """ - Twistd daemon for the nova network nodes. + Twistd daemon for the nova compute nodes. """ +import eventlet +eventlet.monkey_patch() + import os import sys @@ -32,12 +35,7 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): sys.path.insert(0, possible_topdir) -from nova import service -from nova import twistd - +from nova import service_eventlet if __name__ == '__main__': - twistd.serve(__file__) - -if __name__ == '__builtin__': - application = service.Service.create() # pylint: disable-msg=C0103 + service_eventlet.serve() -- cgit From f127d85d7790585d6e735648dfab13416d79fbde Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Sat, 6 Nov 2010 00:02:36 +0000 Subject: Per-project vpns, certificates, and revocation --- bin/nova-manage | 75 +++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 52 insertions(+), 23 deletions(-) (limited to 'bin') diff --git a/bin/nova-manage b/bin/nova-manage index 08b3da123..b788ee62d 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -69,6 +69,7 @@ if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): sys.path.insert(0, possible_topdir) from nova import context +from nova import crypto from nova import db from nova import exception from nova import flags @@ -93,32 +94,36 @@ class VpnCommands(object): self.manager = manager.AuthManager() self.pipe = pipelib.CloudPipe() - def list(self): - """Print a listing of the VPNs for all projects.""" + def list(self, project=None): + """Print a listing of the VPN data for one or all projects. + + args: [project=all]""" print "%-12s\t" % 'project', print "%-20s\t" % 'ip:port', + print "%-20s\t" % 'private_ip', print "%s" % 'state' - for project in self.manager.get_projects(): + if project: + projects = [self.manager.get_project(project)] + else: + projects = self.manager.get_projects() + for project in projects: print "%-12s\t" % project.name, - - try: - s = "%s:%s" % (project.vpn_ip, project.vpn_port) - except exception.NotFound: - s = "None" - print "%-20s\t" % s, - + ipport = "%s:%s" % (project.vpn_ip, project.vpn_port) + print "%-20s\t" % ipport, vpn = self._vpn_for(project.id) if vpn: - command = "ping -c1 -w1 %s > /dev/null; echo $?" - out, _err = utils.execute(command % vpn['private_dns_name'], - check_exit_code=False) - if out.strip() == '0': - net = 'up' - else: - net = 'down' - print vpn['private_dns_name'], - print vpn['node_name'], - print vpn['instance_id'], + net = 'down' + address = None + if vpn.get('fixed_ip', None): + address = vpn['fixed_ip']['address'] + command = "ping -c1 -w1 %s > /dev/null; echo $?" + out, _err = utils.execute(command % address, + check_exit_code=False) + if out.strip() == '0': + net = 'up' + print address, + print vpn['host'], + print vpn['ec2_id'], print vpn['state_description'], print net @@ -127,11 +132,11 @@ class VpnCommands(object): def _vpn_for(self, project_id): """Get the VPN instance for a project ID.""" - for instance in db.instance_get_all(context.get_admin_context()): + ctxt = context.get_admin_context() + for instance in db.instance_get_all_by_project(ctxt, project_id): if (instance['image_id'] == FLAGS.vpn_image_id and not instance['state_description'] in - ['shutting_down', 'shutdown'] - and instance['project_id'] == project_id): + ['shutting_down', 'shutdown']): return instance def spawn(self): @@ -146,6 +151,22 @@ class VpnCommands(object): """Start the VPN for a given project.""" self.pipe.launch_vpn_instance(project_id) + def change(self, project_id, ip, port): + """Change the ip and port for a vpn. + + args: project, ip, port""" + project = self.manager.get_project(project_id) + if not project: + print 'No project %s' % (project_id) + return + admin = context.get_admin_context() + network_ref = db.project_get_network(admin, project_id) + db.network_update(admin, + network_ref['id'], + {'vpn_public_address': ip, + 'vpn_public_port': int(port)}) + + class ShellCommands(object): def bpython(self): @@ -292,6 +313,14 @@ class UserCommands(object): is_admin = False self.manager.modify_user(name, access_key, secret_key, is_admin) + def revoke(self, user_id, project_id=None): + """revoke certs for a user + arguments: user_id [project_id]""" + if project_id: + crypto.revoke_certs_by_user_and_project(user_id, project_id) + else: + crypto.revoke_certs_by_user(user_id) + class ProjectCommands(object): """Class for managing projects.""" -- cgit From e59e7e9c3ad3e25545555986dcce0c384f9a7b6e Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Wed, 17 Nov 2010 02:33:09 +0000 Subject: remove extra line and ref. to LOG that doesn't exist --- bin/nova-manage | 1 - 1 file changed, 1 deletion(-) (limited to 'bin') diff --git a/bin/nova-manage b/bin/nova-manage index b788ee62d..4ab2e9832 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -167,7 +167,6 @@ class VpnCommands(object): 'vpn_public_port': int(port)}) - class ShellCommands(object): def bpython(self): """Runs a bpython shell. -- cgit From a7a24e2ac54b88ba09afe5966806f42181784e9d Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Tue, 23 Nov 2010 21:48:32 +0000 Subject: add vpn ping and optimize vpn list --- bin/nova-manage | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) (limited to 'bin') diff --git a/bin/nova-manage b/bin/nova-manage index 4ab2e9832..3d0122637 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -106,39 +106,30 @@ class VpnCommands(object): projects = [self.manager.get_project(project)] else: projects = self.manager.get_projects() + # NOTE(vish): This hits the database a lot. We could optimize + # by getting all networks in one query and all vpns + # in aother query, then doing lookups by project for project in projects: print "%-12s\t" % project.name, ipport = "%s:%s" % (project.vpn_ip, project.vpn_port) print "%-20s\t" % ipport, - vpn = self._vpn_for(project.id) + ctxt = context.get_admin_context() + vpn = db.instance_get_project_vpn(ctxt, project.id) if vpn: - net = 'down' address = None + state = 'down' if vpn.get('fixed_ip', None): address = vpn['fixed_ip']['address'] - command = "ping -c1 -w1 %s > /dev/null; echo $?" - out, _err = utils.execute(command % address, - check_exit_code=False) - if out.strip() == '0': - net = 'up' + if utils.vpn_ping(project.vpn_ip, project.vpn_port): + state = 'up' print address, print vpn['host'], print vpn['ec2_id'], print vpn['state_description'], - print net - + print state else: print None - def _vpn_for(self, project_id): - """Get the VPN instance for a project ID.""" - ctxt = context.get_admin_context() - for instance in db.instance_get_all_by_project(ctxt, project_id): - if (instance['image_id'] == FLAGS.vpn_image_id - and not instance['state_description'] in - ['shutting_down', 'shutdown']): - return instance - def spawn(self): """Run all VPNs.""" for p in reversed(self.manager.get_projects()): -- cgit From f74094cd303b21c12e8a83790d405bcae8103be8 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Wed, 24 Nov 2010 21:40:41 +0000 Subject: don't error on edge case where vpn has been launched but fails to get a network --- bin/nova-manage | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/nova-manage b/bin/nova-manage index 3d0122637..7c07ce3f0 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -120,7 +120,8 @@ class VpnCommands(object): state = 'down' if vpn.get('fixed_ip', None): address = vpn['fixed_ip']['address'] - if utils.vpn_ping(project.vpn_ip, project.vpn_port): + if project.vpn_ip and utils.vpn_ping(project.vpn_ip, + project.vpn_port): state = 'up' print address, print vpn['host'], -- cgit From 00f329d479564ad8349ed32a27990da2ed3a396e Mon Sep 17 00:00:00 2001 From: Andy Smith Date: Thu, 9 Dec 2010 14:36:23 -0800 Subject: make nova binaries use eventlet --- bin/nova-api | 10 +++++----- bin/nova-combined | 14 +++++++++++--- bin/nova-compute | 1 + bin/nova-network | 1 + bin/nova-scheduler | 15 ++++++--------- bin/nova-volume | 15 ++++++--------- 6 files changed, 30 insertions(+), 26 deletions(-) (limited to 'bin') diff --git a/bin/nova-api b/bin/nova-api index a9c53dbcd..3215ad5ef 100755 --- a/bin/nova-api +++ b/bin/nova-api @@ -32,9 +32,11 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): sys.path.insert(0, possible_topdir) +from nova import api from nova import flags from nova import utils from nova import server +from nova import wsgi FLAGS = flags.FLAGS flags.DEFINE_integer('osapi_port', 8774, 'OpenStack API port') @@ -43,9 +45,8 @@ flags.DEFINE_integer('ec2api_port', 8773, 'EC2 API port') flags.DEFINE_string('ec2api_host', '0.0.0.0', 'EC2 API host') -def main(_args): - from nova import api - from nova import wsgi +def main(): + FLAGS(sys.argv) server = wsgi.Server() server.start(api.API('os'), FLAGS.osapi_port, host=FLAGS.osapi_host) server.start(api.API('ec2'), FLAGS.ec2api_port, host=FLAGS.ec2api_host) @@ -53,5 +54,4 @@ def main(_args): if __name__ == '__main__': - utils.default_flagfile() - server.serve('nova-api', main) + main() diff --git a/bin/nova-combined b/bin/nova-combined index 65865acd9..c86584328 100755 --- a/bin/nova-combined +++ b/bin/nova-combined @@ -27,8 +27,6 @@ eventlet.monkey_patch() import os import sys -from eventlet import greenthread - # If ../nova/__init__.py exists, add ../ to Python search path, so that # it will override what happens to be installed in /usr/(local/)lib/python... possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), @@ -46,6 +44,12 @@ from nova import wsgi FLAGS = flags.FLAGS flags.DEFINE_integer('api_port', 8773, 'API port') +FLAGS = flags.FLAGS +flags.DEFINE_integer('osapi_port', 8774, 'OpenStack API port') +flags.DEFINE_string('osapi_host', '0.0.0.0', 'OpenStack API host') +flags.DEFINE_integer('ec2api_port', 8773, 'EC2 API port') +flags.DEFINE_string('ec2api_host', '0.0.0.0', 'EC2 API host') + if __name__ == '__main__': FLAGS(sys.argv) @@ -57,5 +61,9 @@ if __name__ == '__main__': #objectstore = service_eventlet.Service.create(binary='nova-objectstore') service_eventlet.serve(compute, network, volume, scheduler) - wsgi.run_server(api.API(), FLAGS.api_port) + + server = wsgi.Server() + server.start(api.API('os'), FLAGS.osapi_port, host=FLAGS.osapi_host) + server.start(api.API('ec2'), FLAGS.ec2api_port, host=FLAGS.ec2api_host) + server.wait() diff --git a/bin/nova-compute b/bin/nova-compute index 600fbb897..307f7cb59 100755 --- a/bin/nova-compute +++ b/bin/nova-compute @@ -39,3 +39,4 @@ from nova import service_eventlet if __name__ == '__main__': service_eventlet.serve() + service_eventlet.wait() diff --git a/bin/nova-network b/bin/nova-network index 600fbb897..307f7cb59 100755 --- a/bin/nova-network +++ b/bin/nova-network @@ -39,3 +39,4 @@ from nova import service_eventlet if __name__ == '__main__': service_eventlet.serve() + service_eventlet.wait() diff --git a/bin/nova-scheduler b/bin/nova-scheduler index 4d1a40cf1..e4aa0dcae 100755 --- a/bin/nova-scheduler +++ b/bin/nova-scheduler @@ -21,6 +21,9 @@ Twistd daemon for the nova scheduler nodes. """ +import eventlet +eventlet.monkey_patch() + import os import sys @@ -32,14 +35,8 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): sys.path.insert(0, possible_topdir) -from nova import service -from nova import twistd -from nova import utils - +from nova import service_eventlet if __name__ == '__main__': - utils.default_flagfile() - twistd.serve(__file__) - -if __name__ == '__builtin__': - application = service.Service.create() + service_eventlet.serve() + service_eventlet.wait() diff --git a/bin/nova-volume b/bin/nova-volume index e7281d6c0..395d16041 100755 --- a/bin/nova-volume +++ b/bin/nova-volume @@ -21,6 +21,9 @@ Twistd daemon for the nova volume nodes. """ +import eventlet +eventlet.monkey_patch() + import os import sys @@ -32,14 +35,8 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): sys.path.insert(0, possible_topdir) -from nova import service -from nova import twistd -from nova import utils - +from nova import service_eventlet if __name__ == '__main__': - utils.default_flagfile() - twistd.serve(__file__) - -if __name__ == '__builtin__': - application = service.Service.create() # pylint: disable-msg=C0103 + service_eventlet.serve() + service_eventlet.wait() -- cgit From b3f5aba0c465b263c1d0a15c7d249dafb3a98e6c Mon Sep 17 00:00:00 2001 From: Andy Smith Date: Thu, 9 Dec 2010 15:25:14 -0800 Subject: remove service and rename service_eventlet to service --- bin/nova-combined | 14 +++++++------- bin/nova-compute | 6 +++--- bin/nova-network | 6 +++--- bin/nova-scheduler | 6 +++--- bin/nova-volume | 6 +++--- 5 files changed, 19 insertions(+), 19 deletions(-) (limited to 'bin') diff --git a/bin/nova-combined b/bin/nova-combined index c86584328..c70d1d9ef 100755 --- a/bin/nova-combined +++ b/bin/nova-combined @@ -37,7 +37,7 @@ if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): from nova import api from nova import flags -from nova import service_eventlet +from nova import service from nova import wsgi @@ -54,13 +54,13 @@ flags.DEFINE_string('ec2api_host', '0.0.0.0', 'EC2 API host') if __name__ == '__main__': FLAGS(sys.argv) - compute = service_eventlet.Service.create(binary='nova-compute') - network = service_eventlet.Service.create(binary='nova-network') - volume = service_eventlet.Service.create(binary='nova-volume') - scheduler = service_eventlet.Service.create(binary='nova-scheduler') - #objectstore = service_eventlet.Service.create(binary='nova-objectstore') + compute = service.Service.create(binary='nova-compute') + network = service.Service.create(binary='nova-network') + volume = service.Service.create(binary='nova-volume') + scheduler = service.Service.create(binary='nova-scheduler') + #objectstore = service.Service.create(binary='nova-objectstore') - service_eventlet.serve(compute, network, volume, scheduler) + service.serve(compute, network, volume, scheduler) server = wsgi.Server() server.start(api.API('os'), FLAGS.osapi_port, host=FLAGS.osapi_host) diff --git a/bin/nova-compute b/bin/nova-compute index 307f7cb59..4baf47e29 100755 --- a/bin/nova-compute +++ b/bin/nova-compute @@ -35,8 +35,8 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): sys.path.insert(0, possible_topdir) -from nova import service_eventlet +from nova import service if __name__ == '__main__': - service_eventlet.serve() - service_eventlet.wait() + service.serve() + service.wait() diff --git a/bin/nova-network b/bin/nova-network index 307f7cb59..4baf47e29 100755 --- a/bin/nova-network +++ b/bin/nova-network @@ -35,8 +35,8 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): sys.path.insert(0, possible_topdir) -from nova import service_eventlet +from nova import service if __name__ == '__main__': - service_eventlet.serve() - service_eventlet.wait() + service.serve() + service.wait() diff --git a/bin/nova-scheduler b/bin/nova-scheduler index e4aa0dcae..a1b7ddf60 100755 --- a/bin/nova-scheduler +++ b/bin/nova-scheduler @@ -35,8 +35,8 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): sys.path.insert(0, possible_topdir) -from nova import service_eventlet +from nova import service if __name__ == '__main__': - service_eventlet.serve() - service_eventlet.wait() + service.serve() + service.wait() diff --git a/bin/nova-volume b/bin/nova-volume index 395d16041..ba4a3a502 100755 --- a/bin/nova-volume +++ b/bin/nova-volume @@ -35,8 +35,8 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): sys.path.insert(0, possible_topdir) -from nova import service_eventlet +from nova import service if __name__ == '__main__': - service_eventlet.serve() - service_eventlet.wait() + service.serve() + service.wait() -- cgit From a1640f352806ee12f6b485a8d69a65bd42b51411 Mon Sep 17 00:00:00 2001 From: Andy Smith Date: Thu, 9 Dec 2010 16:05:13 -0800 Subject: formatting and naming cleanup --- bin/nova-api | 6 ++---- bin/nova-combined | 4 +--- bin/nova-compute | 4 +--- bin/nova-network | 4 +--- bin/nova-scheduler | 4 +--- bin/nova-volume | 4 +--- 6 files changed, 7 insertions(+), 19 deletions(-) (limited to 'bin') diff --git a/bin/nova-api b/bin/nova-api index 3215ad5ef..3505cefe7 100755 --- a/bin/nova-api +++ b/bin/nova-api @@ -17,9 +17,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -""" -Nova API daemon. -""" + +"""Starter script for Nova API.""" import os import sys @@ -35,7 +34,6 @@ if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): from nova import api from nova import flags from nova import utils -from nova import server from nova import wsgi FLAGS = flags.FLAGS diff --git a/bin/nova-combined b/bin/nova-combined index c70d1d9ef..964ffd438 100755 --- a/bin/nova-combined +++ b/bin/nova-combined @@ -17,9 +17,7 @@ # License for the specific language governing permissions and limitations # under the License. -""" - Twistd daemon for the nova compute nodes. -""" +"""Combined starter script for Nova services.""" import eventlet eventlet.monkey_patch() diff --git a/bin/nova-compute b/bin/nova-compute index 4baf47e29..f224f0690 100755 --- a/bin/nova-compute +++ b/bin/nova-compute @@ -17,9 +17,7 @@ # License for the specific language governing permissions and limitations # under the License. -""" - Twistd daemon for the nova compute nodes. -""" +"""Starter script for Nova Compute.""" import eventlet eventlet.monkey_patch() diff --git a/bin/nova-network b/bin/nova-network index 4baf47e29..589c75e5a 100755 --- a/bin/nova-network +++ b/bin/nova-network @@ -17,9 +17,7 @@ # License for the specific language governing permissions and limitations # under the License. -""" - Twistd daemon for the nova compute nodes. -""" +"""Starter script for Nova Network.""" import eventlet eventlet.monkey_patch() diff --git a/bin/nova-scheduler b/bin/nova-scheduler index a1b7ddf60..cb345aa3f 100755 --- a/bin/nova-scheduler +++ b/bin/nova-scheduler @@ -17,9 +17,7 @@ # License for the specific language governing permissions and limitations # under the License. -""" - Twistd daemon for the nova scheduler nodes. -""" +""" Starter script for Nova Scheduler.""" import eventlet eventlet.monkey_patch() diff --git a/bin/nova-volume b/bin/nova-volume index ba4a3a502..2f74f4b9a 100755 --- a/bin/nova-volume +++ b/bin/nova-volume @@ -17,9 +17,7 @@ # License for the specific language governing permissions and limitations # under the License. -""" - Twistd daemon for the nova volume nodes. -""" +"""Starter script for Nova Volume.""" import eventlet eventlet.monkey_patch() -- cgit From 4d06429290a373ae3a42b1f9b58d7253d269e048 Mon Sep 17 00:00:00 2001 From: Andy Smith Date: Thu, 9 Dec 2010 16:45:51 -0800 Subject: add back utils.default_flagflie --- bin/nova-api | 1 + bin/nova-combined | 2 ++ bin/nova-compute | 2 ++ bin/nova-network | 2 ++ bin/nova-scheduler | 2 ++ bin/nova-volume | 2 ++ 6 files changed, 11 insertions(+) (limited to 'bin') diff --git a/bin/nova-api b/bin/nova-api index 3505cefe7..210486666 100755 --- a/bin/nova-api +++ b/bin/nova-api @@ -52,4 +52,5 @@ def main(): if __name__ == '__main__': + utils.default_flagfile() main() diff --git a/bin/nova-combined b/bin/nova-combined index 964ffd438..e82b9c9b6 100755 --- a/bin/nova-combined +++ b/bin/nova-combined @@ -36,6 +36,7 @@ if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): from nova import api from nova import flags from nova import service +from nova import utils from nova import wsgi @@ -50,6 +51,7 @@ flags.DEFINE_string('ec2api_host', '0.0.0.0', 'EC2 API host') if __name__ == '__main__': + utils.default_flagfile() FLAGS(sys.argv) compute = service.Service.create(binary='nova-compute') diff --git a/bin/nova-compute b/bin/nova-compute index f224f0690..8b02cd0f5 100755 --- a/bin/nova-compute +++ b/bin/nova-compute @@ -34,7 +34,9 @@ if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): sys.path.insert(0, possible_topdir) from nova import service +from nova import utils if __name__ == '__main__': + utils.default_flagfile() service.serve() service.wait() diff --git a/bin/nova-network b/bin/nova-network index 589c75e5a..01cc9d00d 100755 --- a/bin/nova-network +++ b/bin/nova-network @@ -34,7 +34,9 @@ if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): sys.path.insert(0, possible_topdir) from nova import service +from nova import utils if __name__ == '__main__': + utils.default_flagfile() service.serve() service.wait() diff --git a/bin/nova-scheduler b/bin/nova-scheduler index cb345aa3f..a46dd8dda 100755 --- a/bin/nova-scheduler +++ b/bin/nova-scheduler @@ -34,7 +34,9 @@ if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): sys.path.insert(0, possible_topdir) from nova import service +from nova import utils if __name__ == '__main__': + utils.default_flagfile() service.serve() service.wait() diff --git a/bin/nova-volume b/bin/nova-volume index 2f74f4b9a..efb837ba2 100755 --- a/bin/nova-volume +++ b/bin/nova-volume @@ -34,7 +34,9 @@ if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): sys.path.insert(0, possible_topdir) from nova import service +from nova import utils if __name__ == '__main__': + utils.default_flagfile() service.serve() service.wait() -- cgit From a6645d8a431ed933eef4ea6c42c0224ead6f2272 Mon Sep 17 00:00:00 2001 From: "jaypipes@gmail.com" <> Date: Sat, 11 Dec 2010 15:10:24 -0500 Subject: Initial i18n commit for endpoints. All endpoints must install gettext, which injects the _ function into the builtins. --- bin/nova-api | 3 +++ bin/nova-compute | 3 +++ bin/nova-dhcpbridge | 3 +++ 3 files changed, 9 insertions(+) (limited to 'bin') diff --git a/bin/nova-api b/bin/nova-api index a9c53dbcd..2ae6a099a 100755 --- a/bin/nova-api +++ b/bin/nova-api @@ -21,6 +21,7 @@ Nova API daemon. """ +import gettext import os import sys @@ -32,6 +33,8 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): sys.path.insert(0, possible_topdir) +gettext.install('nova', unicode=1) + from nova import flags from nova import utils from nova import server diff --git a/bin/nova-compute b/bin/nova-compute index ac6378f75..f57b68584 100755 --- a/bin/nova-compute +++ b/bin/nova-compute @@ -21,6 +21,7 @@ Twistd daemon for the nova compute nodes. """ +import gettext import os import sys @@ -32,6 +33,8 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): sys.path.insert(0, possible_topdir) +gettext.install('nova', unicode=1) + from nova import service from nova import twistd from nova import utils diff --git a/bin/nova-dhcpbridge b/bin/nova-dhcpbridge index 17c62da0a..81b9b6dd3 100755 --- a/bin/nova-dhcpbridge +++ b/bin/nova-dhcpbridge @@ -21,6 +21,7 @@ Handle lease database updates from DHCP servers. """ +import gettext import logging import os import sys @@ -33,6 +34,8 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): sys.path.insert(0, possible_topdir) +gettext.install('nova', unicode=1) + from nova import context from nova import db from nova import flags -- cgit From 797e3f8a1cc72599aa8540b5655e29da8975e56f Mon Sep 17 00:00:00 2001 From: "jaypipes@gmail.com" <> Date: Tue, 14 Dec 2010 18:22:03 -0500 Subject: For some reason, I forgot to commit the other endpoints... --- bin/nova-import-canonical-imagestore | 3 +++ bin/nova-instancemonitor | 3 +++ bin/nova-manage | 3 +++ bin/nova-network | 3 +++ bin/nova-objectstore | 3 +++ bin/nova-scheduler | 3 +++ bin/nova-volume | 3 +++ 7 files changed, 21 insertions(+) (limited to 'bin') diff --git a/bin/nova-import-canonical-imagestore b/bin/nova-import-canonical-imagestore index 4ed9e8365..036b41e48 100755 --- a/bin/nova-import-canonical-imagestore +++ b/bin/nova-import-canonical-imagestore @@ -21,6 +21,7 @@ Download images from Canonical Image Store """ +import gettext import json import os import tempfile @@ -37,6 +38,8 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): sys.path.insert(0, possible_topdir) +gettext.install('nova', unicode=1) + from nova import flags from nova import utils from nova.objectstore import image diff --git a/bin/nova-instancemonitor b/bin/nova-instancemonitor index 9b6c40e82..5dac3ffe6 100755 --- a/bin/nova-instancemonitor +++ b/bin/nova-instancemonitor @@ -21,6 +21,7 @@ Daemon for Nova RRD based instance resource monitoring. """ +import gettext import os import logging import sys @@ -34,6 +35,8 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): sys.path.insert(0, possible_topdir) +gettext.install('nova', unicode=1) + from nova import utils from nova import twistd from nova.compute import monitor diff --git a/bin/nova-manage b/bin/nova-manage index 62eec8353..0c1b621ed 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -53,6 +53,7 @@ CLI interface for nova management. """ +import gettext import logging import os import sys @@ -68,6 +69,8 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): sys.path.insert(0, possible_topdir) +gettext.install('nova', unicode=1) + from nova import context from nova import db from nova import exception diff --git a/bin/nova-network b/bin/nova-network index d1fb55261..86d04c723 100755 --- a/bin/nova-network +++ b/bin/nova-network @@ -21,6 +21,7 @@ Twistd daemon for the nova network nodes. """ +import gettext import os import sys @@ -32,6 +33,8 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): sys.path.insert(0, possible_topdir) +gettext.install('nova', unicode=1) + from nova import service from nova import twistd from nova import utils diff --git a/bin/nova-objectstore b/bin/nova-objectstore index 00ae27af9..9fbe228a2 100755 --- a/bin/nova-objectstore +++ b/bin/nova-objectstore @@ -21,6 +21,7 @@ Twisted daemon for nova objectstore. Supports S3 API. """ +import gettext import os import sys @@ -32,6 +33,8 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): sys.path.insert(0, possible_topdir) +gettext.install('nova', unicode=1) + from nova import flags from nova import utils from nova import twistd diff --git a/bin/nova-scheduler b/bin/nova-scheduler index 4d1a40cf1..41e1937c1 100755 --- a/bin/nova-scheduler +++ b/bin/nova-scheduler @@ -21,6 +21,7 @@ Twistd daemon for the nova scheduler nodes. """ +import gettext import os import sys @@ -32,6 +33,8 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): sys.path.insert(0, possible_topdir) +gettext.install('nova', unicode=1) + from nova import service from nova import twistd from nova import utils diff --git a/bin/nova-volume b/bin/nova-volume index e7281d6c0..4f2e96268 100755 --- a/bin/nova-volume +++ b/bin/nova-volume @@ -21,6 +21,7 @@ Twistd daemon for the nova volume nodes. """ +import gettext import os import sys @@ -32,6 +33,8 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): sys.path.insert(0, possible_topdir) +gettext.install('nova', unicode=1) + from nova import service from nova import twistd from nova import utils -- cgit From a2a8406b5d793545c8ecb359e18b80bba618c509 Mon Sep 17 00:00:00 2001 From: termie Date: Tue, 14 Dec 2010 16:05:39 -0800 Subject: updates per review --- bin/nova-api | 9 +++------ bin/nova-combined | 3 --- bin/nova-scheduler | 2 +- 3 files changed, 4 insertions(+), 10 deletions(-) (limited to 'bin') diff --git a/bin/nova-api b/bin/nova-api index 210486666..3f433ea6d 100755 --- a/bin/nova-api +++ b/bin/nova-api @@ -36,6 +36,7 @@ from nova import flags from nova import utils from nova import wsgi + FLAGS = flags.FLAGS flags.DEFINE_integer('osapi_port', 8774, 'OpenStack API port') flags.DEFINE_string('osapi_host', '0.0.0.0', 'OpenStack API host') @@ -43,14 +44,10 @@ flags.DEFINE_integer('ec2api_port', 8773, 'EC2 API port') flags.DEFINE_string('ec2api_host', '0.0.0.0', 'EC2 API host') -def main(): +if __name__ == '__main__': + utils.default_flagfile() FLAGS(sys.argv) server = wsgi.Server() server.start(api.API('os'), FLAGS.osapi_port, host=FLAGS.osapi_host) server.start(api.API('ec2'), FLAGS.ec2api_port, host=FLAGS.ec2api_host) server.wait() - - -if __name__ == '__main__': - utils.default_flagfile() - main() diff --git a/bin/nova-combined b/bin/nova-combined index e82b9c9b6..5f635b3a3 100755 --- a/bin/nova-combined +++ b/bin/nova-combined @@ -40,9 +40,6 @@ from nova import utils from nova import wsgi -FLAGS = flags.FLAGS -flags.DEFINE_integer('api_port', 8773, 'API port') - FLAGS = flags.FLAGS flags.DEFINE_integer('osapi_port', 8774, 'OpenStack API port') flags.DEFINE_string('osapi_host', '0.0.0.0', 'OpenStack API host') diff --git a/bin/nova-scheduler b/bin/nova-scheduler index a46dd8dda..59cb060d4 100755 --- a/bin/nova-scheduler +++ b/bin/nova-scheduler @@ -17,7 +17,7 @@ # License for the specific language governing permissions and limitations # under the License. -""" Starter script for Nova Scheduler.""" +"""Starter script for Nova Scheduler.""" import eventlet eventlet.monkey_patch() -- cgit From e306d236e3cf91c00a36940e277ad2d105b055a1 Mon Sep 17 00:00:00 2001 From: termie Date: Thu, 16 Dec 2010 12:45:06 -0800 Subject: pep8 fixes for bin --- bin/nova-combined | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'bin') diff --git a/bin/nova-combined b/bin/nova-combined index 5f635b3a3..c6a04f7e9 100755 --- a/bin/nova-combined +++ b/bin/nova-combined @@ -50,7 +50,7 @@ flags.DEFINE_string('ec2api_host', '0.0.0.0', 'EC2 API host') if __name__ == '__main__': utils.default_flagfile() FLAGS(sys.argv) - + compute = service.Service.create(binary='nova-compute') network = service.Service.create(binary='nova-network') volume = service.Service.create(binary='nova-volume') @@ -63,4 +63,3 @@ if __name__ == '__main__': server.start(api.API('os'), FLAGS.osapi_port, host=FLAGS.osapi_host) server.start(api.API('ec2'), FLAGS.ec2api_port, host=FLAGS.ec2api_host) server.wait() - -- cgit