summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorSandy Walsh <sandy.walsh@rackspace.com>2011-02-25 05:12:28 -0400
committerSandy Walsh <sandy.walsh@rackspace.com>2011-02-25 05:12:28 -0400
commit459616ac2fdf243e65ecdc0f4b5750fa6d073edb (patch)
treeb6bb7fa8ac8c3cfacdea4920b52b097a0f483cd6 /bin
parent18e573a14414838f11e772edca3eb5510f852c94 (diff)
parentbb7c1b8c63632c789ed0cd3785a22b7baa90fd83 (diff)
downloadnova-459616ac2fdf243e65ecdc0f4b5750fa6d073edb.tar.gz
nova-459616ac2fdf243e65ecdc0f4b5750fa6d073edb.tar.xz
nova-459616ac2fdf243e65ecdc0f4b5750fa6d073edb.zip
merged with trunk
Diffstat (limited to 'bin')
-rwxr-xr-xbin/nova-ajax-console-proxy20
-rwxr-xr-xbin/nova-api28
-rwxr-xr-xbin/nova-combined80
-rwxr-xr-xbin/nova-compute4
-rwxr-xr-xbin/nova-console4
-rwxr-xr-xbin/nova-dhcpbridge13
-rwxr-xr-xbin/nova-direct-api6
-rwxr-xr-xbin/nova-import-canonical-imagestore2
-rwxr-xr-xbin/nova-instancemonitor3
-rwxr-xr-xbin/nova-manage8
-rwxr-xr-xbin/nova-network4
-rwxr-xr-xbin/nova-scheduler4
-rwxr-xr-xbin/nova-volume4
13 files changed, 67 insertions, 113 deletions
diff --git a/bin/nova-ajax-console-proxy b/bin/nova-ajax-console-proxy
index 2bc407658..bbd60bade 100755
--- a/bin/nova-ajax-console-proxy
+++ b/bin/nova-ajax-console-proxy
@@ -25,7 +25,6 @@ from eventlet.green import urllib2
import exceptions
import gettext
-import logging
import os
import sys
import time
@@ -48,9 +47,11 @@ from nova import utils
from nova import wsgi
FLAGS = flags.FLAGS
-
flags.DEFINE_integer('ajax_console_idle_timeout', 300,
'Seconds before idle connection destroyed')
+flags.DEFINE_flag(flags.HelpFlag())
+flags.DEFINE_flag(flags.HelpshortFlag())
+flags.DEFINE_flag(flags.HelpXMLFlag())
LOG = logging.getLogger('nova.ajax_console_proxy')
LOG.setLevel(logging.DEBUG)
@@ -62,10 +63,16 @@ class AjaxConsoleProxy(object):
def __call__(self, env, start_response):
try:
- req_url = '%s://%s%s?%s' % (env['wsgi.url_scheme'],
- env['HTTP_HOST'],
- env['PATH_INFO'],
- env['QUERY_STRING'])
+ if 'QUERY_STRING' in env:
+ req_url = '%s://%s%s?%s' % (env['wsgi.url_scheme'],
+ env['HTTP_HOST'],
+ env['PATH_INFO'],
+ env['QUERY_STRING'])
+ else:
+ req_url = '%s://%s%s' % (env['wsgi.url_scheme'],
+ env['HTTP_HOST'],
+ env['PATH_INFO'])
+
if 'HTTP_REFERER' in env:
auth_url = env['HTTP_REFERER']
else:
@@ -130,6 +137,7 @@ class AjaxConsoleProxy(object):
if __name__ == '__main__':
utils.default_flagfile()
FLAGS(sys.argv)
+ logging.setup()
server = wsgi.Server()
acp = AjaxConsoleProxy()
acp.register_listeners()
diff --git a/bin/nova-api b/bin/nova-api
index 11176a021..14be4b841 100755
--- a/bin/nova-api
+++ b/bin/nova-api
@@ -36,14 +36,22 @@ gettext.install('nova', unicode=1)
from nova import flags
from nova import log as logging
+from nova import utils
from nova import version
from nova import wsgi
-logging.basicConfig()
LOG = logging.getLogger('nova.api')
-LOG.setLevel(logging.DEBUG)
FLAGS = flags.FLAGS
+flags.DEFINE_string('ec2_listen', "0.0.0.0",
+ 'IP address for EC2 API to listen')
+flags.DEFINE_integer('ec2_listen_port', 8773, 'port for ec2 api to listen')
+flags.DEFINE_string('osapi_listen', "0.0.0.0",
+ 'IP address for OpenStack API to listen')
+flags.DEFINE_integer('osapi_listen_port', 8774, 'port for os api to listen')
+flags.DEFINE_flag(flags.HelpFlag())
+flags.DEFINE_flag(flags.HelpshortFlag())
+flags.DEFINE_flag(flags.HelpXMLFlag())
API_ENDPOINTS = ['ec2', 'osapi']
@@ -57,21 +65,15 @@ def run_app(paste_config_file):
LOG.debug(_("No paste configuration for app: %s"), api)
continue
LOG.debug(_("App Config: %(api)s\n%(config)r") % locals())
- wsgi.paste_config_to_flags(config, {
- "verbose": FLAGS.verbose,
- "%s_host" % api: config.get('host', '0.0.0.0'),
- "%s_port" % api: getattr(FLAGS, "%s_port" % api)})
LOG.info(_("Running %s API"), api)
app = wsgi.load_paste_app(paste_config_file, api)
- apps.append((app, getattr(FLAGS, "%s_port" % api),
- getattr(FLAGS, "%s_host" % api)))
+ apps.append((app, getattr(FLAGS, "%s_listen_port" % api),
+ getattr(FLAGS, "%s_listen" % api)))
if len(apps) == 0:
LOG.error(_("No known API applications configured in %s."),
paste_config_file)
return
- # NOTE(todd): redo logging config, verbose could be set in paste config
- logging.basicConfig()
server = wsgi.Server()
for app in apps:
server.start(*app)
@@ -79,9 +81,15 @@ def run_app(paste_config_file):
if __name__ == '__main__':
+ utils.default_flagfile()
FLAGS(sys.argv)
+ logging.setup()
LOG.audit(_("Starting nova-api node (version %s)"),
version.version_string_with_vcs())
+ LOG.debug(_("Full set of FLAGS:"))
+ for flag in FLAGS:
+ flag_get = FLAGS.get(flag, None)
+ LOG.debug("%(flag)s : %(flag_get)s" % locals())
conf = wsgi.paste_config_file('nova-api.conf')
if conf:
run_app(conf)
diff --git a/bin/nova-combined b/bin/nova-combined
deleted file mode 100755
index 913c866bf..000000000
--- a/bin/nova-combined
+++ /dev/null
@@ -1,80 +0,0 @@
-#!/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.
-
-"""Combined starter script for Nova services."""
-
-import eventlet
-eventlet.monkey_patch()
-
-import gettext
-import os
-import sys
-
-# 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)
-
-gettext.install('nova', unicode=1)
-
-from nova import flags
-from nova import log as logging
-from nova import service
-from nova import utils
-from nova import wsgi
-
-
-FLAGS = flags.FLAGS
-
-
-if __name__ == '__main__':
- utils.default_flagfile()
- FLAGS(sys.argv)
- logging.basicConfig()
-
- 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.serve(compute, network, volume, scheduler)
-
- apps = []
- paste_config_file = wsgi.paste_config_file('nova-api.conf')
- for api in ['osapi', 'ec2']:
- config = wsgi.load_paste_configuration(paste_config_file, api)
- if config is None:
- continue
- wsgi.paste_config_to_flags(config, {
- "verbose": FLAGS.verbose,
- "%s_host" % api: config.get('host', '0.0.0.0'),
- "%s_port" % api: getattr(FLAGS, "%s_port" % api)})
- app = wsgi.load_paste_app(paste_config_file, api)
- apps.append((app, getattr(FLAGS, "%s_port" % api),
- getattr(FLAGS, "%s_host" % api)))
- if len(apps) > 0:
- logging.basicConfig()
- server = wsgi.Server()
- for app in apps:
- server.start(*app)
- server.wait()
diff --git a/bin/nova-compute b/bin/nova-compute
index d2d352da2..95fa393b1 100755
--- a/bin/nova-compute
+++ b/bin/nova-compute
@@ -36,10 +36,14 @@ if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
gettext.install('nova', unicode=1)
+from nova import flags
+from nova import log as logging
from nova import service
from nova import utils
if __name__ == '__main__':
utils.default_flagfile()
+ flags.FLAGS(sys.argv)
+ logging.setup()
service.serve()
service.wait()
diff --git a/bin/nova-console b/bin/nova-console
index 802cc80b6..40608b995 100755
--- a/bin/nova-console
+++ b/bin/nova-console
@@ -35,10 +35,14 @@ if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
gettext.install('nova', unicode=1)
+from nova import flags
+from nova import log as logging
from nova import service
from nova import utils
if __name__ == '__main__':
utils.default_flagfile()
+ flags.FLAGS(sys.argv)
+ logging.setup()
service.serve()
service.wait()
diff --git a/bin/nova-dhcpbridge b/bin/nova-dhcpbridge
index d38ba2543..3dd9de367 100755
--- a/bin/nova-dhcpbridge
+++ b/bin/nova-dhcpbridge
@@ -102,19 +102,10 @@ def main():
flagfile = os.environ.get('FLAGFILE', FLAGS.dhcpbridge_flagfile)
utils.default_flagfile(flagfile)
argv = FLAGS(sys.argv)
- logging.basicConfig()
+ logging.setup()
interface = os.environ.get('DNSMASQ_INTERFACE', 'br0')
if int(os.environ.get('TESTING', '0')):
- FLAGS.fake_rabbit = True
- FLAGS.network_size = 16
- FLAGS.connection_type = 'fake'
- FLAGS.fake_network = True
- FLAGS.auth_driver = 'nova.auth.dbdriver.DbDriver'
- FLAGS.num_networks = 5
- path = os.path.abspath(os.path.join(os.path.dirname(__file__),
- '..',
- 'nova.sqlite'))
- FLAGS.sql_connection = 'sqlite:///%s' % path
+ from nova.tests import fake_flags
action = argv[1]
if action in ['add', 'del', 'old']:
mac = argv[2]
diff --git a/bin/nova-direct-api b/bin/nova-direct-api
index 173b39bdb..bf29d9a5e 100755
--- a/bin/nova-direct-api
+++ b/bin/nova-direct-api
@@ -35,6 +35,7 @@ if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
gettext.install('nova', unicode=1)
from nova import flags
+from nova import log as logging
from nova import utils
from nova import wsgi
from nova.api import direct
@@ -44,10 +45,15 @@ from nova.compute import api as compute_api
FLAGS = flags.FLAGS
flags.DEFINE_integer('direct_port', 8001, 'Direct API port')
flags.DEFINE_string('direct_host', '0.0.0.0', 'Direct API host')
+flags.DEFINE_flag(flags.HelpFlag())
+flags.DEFINE_flag(flags.HelpshortFlag())
+flags.DEFINE_flag(flags.HelpXMLFlag())
+
if __name__ == '__main__':
utils.default_flagfile()
FLAGS(sys.argv)
+ logging.setup()
direct.register_service('compute', compute_api.API())
direct.register_service('reflect', direct.Reflection())
diff --git a/bin/nova-import-canonical-imagestore b/bin/nova-import-canonical-imagestore
index 036b41e48..404ae37f4 100755
--- a/bin/nova-import-canonical-imagestore
+++ b/bin/nova-import-canonical-imagestore
@@ -41,6 +41,7 @@ if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
gettext.install('nova', unicode=1)
from nova import flags
+from nova import log as logging
from nova import utils
from nova.objectstore import image
@@ -92,6 +93,7 @@ def main():
"""Main entry point."""
utils.default_flagfile()
argv = FLAGS(sys.argv)
+ logging.setup()
images = get_images()
if len(argv) == 2:
diff --git a/bin/nova-instancemonitor b/bin/nova-instancemonitor
index 7dca02014..24cc9fd23 100755
--- a/bin/nova-instancemonitor
+++ b/bin/nova-instancemonitor
@@ -41,9 +41,6 @@ from nova import utils
from nova import twistd
from nova.compute import monitor
-# TODO(todd): shouldn't this be done with flags? And what about verbose?
-logging.getLogger('boto').setLevel(logging.WARN)
-
LOG = logging.getLogger('nova.instancemonitor')
diff --git a/bin/nova-manage b/bin/nova-manage
index 6d67252b8..89332f2af 100755
--- a/bin/nova-manage
+++ b/bin/nova-manage
@@ -86,8 +86,6 @@ from nova.auth import manager
from nova.cloudpipe import pipelib
from nova.db import migration
-
-logging.basicConfig()
FLAGS = flags.FLAGS
flags.DECLARE('fixed_range', 'nova.network.manager')
flags.DECLARE('num_networks', 'nova.network.manager')
@@ -95,6 +93,9 @@ flags.DECLARE('network_size', 'nova.network.manager')
flags.DECLARE('vlan_start', 'nova.network.manager')
flags.DECLARE('vpn_start', 'nova.network.manager')
flags.DECLARE('fixed_range_v6', 'nova.network.manager')
+flags.DEFINE_flag(flags.HelpFlag())
+flags.DEFINE_flag(flags.HelpshortFlag())
+flags.DEFINE_flag(flags.HelpXMLFlag())
def param2id(object_id):
@@ -552,7 +553,7 @@ class ServiceCommands(object):
args: [host] [service]"""
ctxt = context.get_admin_context()
now = datetime.datetime.utcnow()
- services = db.service_get_all(ctxt)
+ services = db.service_get_all(ctxt) + db.service_get_all(ctxt, True)
if host:
services = [s for s in services if s['host'] == host]
if service:
@@ -710,6 +711,7 @@ def main():
"""Parse options and call the appropriate class/method."""
utils.default_flagfile()
argv = FLAGS(sys.argv)
+ logging.setup()
script_name = argv.pop(0)
if len(argv) < 1:
diff --git a/bin/nova-network b/bin/nova-network
index 0143846a7..101761ef7 100755
--- a/bin/nova-network
+++ b/bin/nova-network
@@ -36,10 +36,14 @@ if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
gettext.install('nova', unicode=1)
+from nova import flags
+from nova import log as logging
from nova import service
from nova import utils
if __name__ == '__main__':
utils.default_flagfile()
+ flags.FLAGS(sys.argv)
+ logging.setup()
service.serve()
service.wait()
diff --git a/bin/nova-scheduler b/bin/nova-scheduler
index f4c0eaed6..0c205a80f 100755
--- a/bin/nova-scheduler
+++ b/bin/nova-scheduler
@@ -36,10 +36,14 @@ if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
gettext.install('nova', unicode=1)
+from nova import flags
+from nova import log as logging
from nova import service
from nova import utils
if __name__ == '__main__':
utils.default_flagfile()
+ flags.FLAGS(sys.argv)
+ logging.setup()
service.serve()
service.wait()
diff --git a/bin/nova-volume b/bin/nova-volume
index ad3ddc405..8dcdbc500 100755
--- a/bin/nova-volume
+++ b/bin/nova-volume
@@ -36,10 +36,14 @@ if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
gettext.install('nova', unicode=1)
+from nova import flags
+from nova import log as logging
from nova import service
from nova import utils
if __name__ == '__main__':
utils.default_flagfile()
+ flags.FLAGS(sys.argv)
+ logging.setup()
service.serve()
service.wait()