From 209bf1ef495d2d599ef51e207e8de0694dec9790 Mon Sep 17 00:00:00 2001 From: Josh Kearney Date: Fri, 8 Jul 2011 17:12:14 -0500 Subject: [PATCH] Add a flag to disable ec2 or osapi. --- bin/nova-api | 14 +++++++++----- nova/flags.py | 2 ++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/bin/nova-api b/bin/nova-api index 4c5164ea1478..fe8e833660b5 100755 --- a/bin/nova-api +++ b/bin/nova-api @@ -36,17 +36,21 @@ if os.path.exists(os.path.join(possible_topdir, "nova", "__init__.py")): import nova.service import nova.utils +from nova import flags + + +FLAGS = flags.FLAGS + def main(): """Launch EC2 and OSAPI services.""" nova.utils.Bootstrapper.bootstrap_binary(sys.argv) - ec2 = nova.service.WSGIService("ec2") - osapi = nova.service.WSGIService("osapi") - launcher = nova.service.Launcher() - launcher.launch_service(ec2) - launcher.launch_service(osapi) + + for api in FLAGS.enabled_apis: + service = nova.service.WSGIService(api) + launcher.launch_service(service) signal.signal(signal.SIGTERM, lambda *_: launcher.stop()) diff --git a/nova/flags.py b/nova/flags.py index 57a4ecf2f449..49355b436b5a 100644 --- a/nova/flags.py +++ b/nova/flags.py @@ -305,6 +305,8 @@ DEFINE_string('rabbit_virtual_host', '/', 'rabbit virtual host') DEFINE_integer('rabbit_retry_interval', 10, 'rabbit connection retry interval') DEFINE_integer('rabbit_max_retries', 12, 'rabbit connection attempts') DEFINE_string('control_exchange', 'nova', 'the main exchange to connect to') +DEFINE_list('enabled_apis', ['ec2', 'osapi'], + 'list of APIs to enable by default') DEFINE_string('ec2_host', '$my_ip', 'ip of api server') DEFINE_string('ec2_dmz_host', '$my_ip', 'internal ip of api server') DEFINE_integer('ec2_port', 8773, 'cloud controller port')