summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/nova-api23
-rwxr-xr-xbin/nova-combined65
-rwxr-xr-xbin/nova-compute18
-rwxr-xr-xbin/nova-dhcpbridge3
-rwxr-xr-xbin/nova-import-canonical-imagestore3
-rwxr-xr-xbin/nova-instancemonitor5
-rwxr-xr-xbin/nova-manage14
-rwxr-xr-xbin/nova-network18
-rwxr-xr-xbin/nova-objectstore5
-rwxr-xr-xbin/nova-scheduler18
-rwxr-xr-xbin/nova-volume18
11 files changed, 137 insertions, 53 deletions
diff --git a/bin/nova-api b/bin/nova-api
index a9c53dbcd..1c671201e 100755
--- a/bin/nova-api
+++ b/bin/nova-api
@@ -17,10 +17,10 @@
# 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 gettext
import os
import sys
@@ -32,9 +32,13 @@ 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 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,15 +47,10 @@ 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
+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()
- server.serve('nova-api', main)
diff --git a/bin/nova-combined b/bin/nova-combined
new file mode 100755
index 000000000..c6a04f7e9
--- /dev/null
+++ b/bin/nova-combined
@@ -0,0 +1,65 @@
+#!/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 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)
+
+from nova import api
+from nova import flags
+from nova import service
+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')
+flags.DEFINE_integer('ec2api_port', 8773, 'EC2 API port')
+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')
+ scheduler = service.Service.create(binary='nova-scheduler')
+ #objectstore = service.Service.create(binary='nova-objectstore')
+
+ service.serve(compute, network, volume, scheduler)
+
+ 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 a66477af5..d2d352da2 100755
--- a/bin/nova-compute
+++ b/bin/nova-compute
@@ -17,10 +17,12 @@
# 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()
+
+import gettext
import os
import sys
@@ -32,14 +34,12 @@ 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
-
if __name__ == '__main__':
- twistd.serve(__file__)
-
-if __name__ == '__builtin__':
utils.default_flagfile()
- application = service.Service.create() # pylint: disable=C0103
+ service.serve()
+ service.wait()
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
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 a7b7fb0c6..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
@@ -42,10 +45,10 @@ logging.getLogger('boto').setLevel(logging.WARN)
if __name__ == '__main__':
+ utils.default_flagfile()
twistd.serve(__file__)
if __name__ == '__builtin__':
- utils.default_flagfile()
logging.warn('Starting instance monitor')
# pylint: disable-msg=C0103
monitor = monitor.InstanceMonitor()
diff --git a/bin/nova-manage b/bin/nova-manage
index 20b7c8dfc..599e02a7e 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 crypto
from nova import db
@@ -379,9 +382,14 @@ class ProjectCommands(object):
def zipfile(self, project_id, user_id, filename='nova.zip'):
"""Exports credentials for project to a zip file
arguments: project_id user_id [filename='nova.zip]"""
- zip_file = self.manager.get_credentials(user_id, project_id)
- with open(filename, 'w') as f:
- f.write(zip_file)
+ try:
+ zip_file = self.manager.get_credentials(user_id, project_id)
+ with open(filename, 'w') as f:
+ f.write(zip_file)
+ except db.api.NoMoreNetworks:
+ print ('No more networks available. If this is a new '
+ 'installation, you need\nto call something like this:\n\n'
+ ' nova-manage network create 10.0.0.0/8 10 64\n\n')
class FloatingIpCommands(object):
diff --git a/bin/nova-network b/bin/nova-network
index 342a63058..0143846a7 100755
--- a/bin/nova-network
+++ b/bin/nova-network
@@ -17,10 +17,12 @@
# License for the specific language governing permissions and limitations
# under the License.
-"""
- Twistd daemon for the nova network nodes.
-"""
+"""Starter script for Nova Network."""
+import eventlet
+eventlet.monkey_patch()
+
+import gettext
import os
import sys
@@ -32,14 +34,12 @@ 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
-
if __name__ == '__main__':
- twistd.serve(__file__)
-
-if __name__ == '__builtin__':
utils.default_flagfile()
- application = service.Service.create() # pylint: disable-msg=C0103
+ service.serve()
+ service.wait()
diff --git a/bin/nova-objectstore b/bin/nova-objectstore
index 728f2ee5b..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
@@ -42,8 +45,8 @@ FLAGS = flags.FLAGS
if __name__ == '__main__':
+ utils.default_flagfile()
twistd.serve(__file__)
if __name__ == '__builtin__':
- utils.default_flagfile()
application = handler.get_application() # pylint: disable-msg=C0103
diff --git a/bin/nova-scheduler b/bin/nova-scheduler
index 069b5a6fa..f4c0eaed6 100755
--- a/bin/nova-scheduler
+++ b/bin/nova-scheduler
@@ -17,10 +17,12 @@
# 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()
+
+import gettext
import os
import sys
@@ -32,14 +34,12 @@ 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
-
if __name__ == '__main__':
- twistd.serve(__file__)
-
-if __name__ == '__builtin__':
utils.default_flagfile()
- application = service.Service.create()
+ service.serve()
+ service.wait()
diff --git a/bin/nova-volume b/bin/nova-volume
index 26148b0ec..ad3ddc405 100755
--- a/bin/nova-volume
+++ b/bin/nova-volume
@@ -17,10 +17,12 @@
# 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()
+
+import gettext
import os
import sys
@@ -32,14 +34,12 @@ 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
-
if __name__ == '__main__':
- twistd.serve(__file__)
-
-if __name__ == '__builtin__':
utils.default_flagfile()
- application = service.Service.create() # pylint: disable-msg=C0103
+ service.serve()
+ service.wait()