~ubuntu-branches/ubuntu/natty/nova/natty

« back to all changes in this revision

Viewing changes to bin/nova-combined

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short, Chuck Short, Thierry Carrez
  • Date: 2011-02-25 14:01:06 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20110225140106-0gfh4sof7wafe9ra
Tags: 2011.2~bzr740-0ubuntu1

[Chuck Short]
* New upstream release.

[Thierry Carrez]
* Add python-distutils-extra as build-dep (for i18n)
* Ship .mo files in /usr/share/locale
* Add lvdisplay to nova_sudoers, clean up dupe entries

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env python
2
 
# vim: tabstop=4 shiftwidth=4 softtabstop=4
3
 
 
4
 
# Copyright 2010 United States Government as represented by the
5
 
# Administrator of the National Aeronautics and Space Administration.
6
 
# All Rights Reserved.
7
 
#
8
 
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
9
 
#    not use this file except in compliance with the License. You may obtain
10
 
#    a copy of the License at
11
 
#
12
 
#         http://www.apache.org/licenses/LICENSE-2.0
13
 
#
14
 
#    Unless required by applicable law or agreed to in writing, software
15
 
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
16
 
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
17
 
#    License for the specific language governing permissions and limitations
18
 
#    under the License.
19
 
 
20
 
"""Combined starter script for Nova services."""
21
 
 
22
 
import eventlet
23
 
eventlet.monkey_patch()
24
 
 
25
 
import gettext
26
 
import os
27
 
import sys
28
 
 
29
 
# If ../nova/__init__.py exists, add ../ to Python search path, so that
30
 
# it will override what happens to be installed in /usr/(local/)lib/python...
31
 
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
32
 
                                   os.pardir,
33
 
                                   os.pardir))
34
 
if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
35
 
    sys.path.insert(0, possible_topdir)
36
 
 
37
 
gettext.install('nova', unicode=1)
38
 
 
39
 
from nova import flags
40
 
from nova import log as logging
41
 
from nova import service
42
 
from nova import utils
43
 
from nova import wsgi
44
 
 
45
 
 
46
 
FLAGS = flags.FLAGS
47
 
 
48
 
 
49
 
if __name__ == '__main__':
50
 
    utils.default_flagfile()
51
 
    FLAGS(sys.argv)
52
 
    logging.basicConfig()
53
 
 
54
 
    compute = service.Service.create(binary='nova-compute')
55
 
    network = service.Service.create(binary='nova-network')
56
 
    volume = service.Service.create(binary='nova-volume')
57
 
    scheduler = service.Service.create(binary='nova-scheduler')
58
 
    #objectstore = service.Service.create(binary='nova-objectstore')
59
 
 
60
 
    service.serve(compute, network, volume, scheduler)
61
 
 
62
 
    apps = []
63
 
    paste_config_file = wsgi.paste_config_file('nova-api.conf')
64
 
    for api in ['osapi', 'ec2']:
65
 
        config = wsgi.load_paste_configuration(paste_config_file, api)
66
 
        if config is None:
67
 
            continue
68
 
        wsgi.paste_config_to_flags(config, {
69
 
            "verbose": FLAGS.verbose,
70
 
            "%s_host" % api: config.get('host', '0.0.0.0'),
71
 
            "%s_port" % api: getattr(FLAGS, "%s_port" % api)})
72
 
        app = wsgi.load_paste_app(paste_config_file, api)
73
 
        apps.append((app, getattr(FLAGS, "%s_port" % api),
74
 
                     getattr(FLAGS, "%s_host" % api)))
75
 
    if len(apps) > 0:
76
 
        logging.basicConfig()
77
 
        server = wsgi.Server()
78
 
        for app in apps:
79
 
            server.start(*app)
80
 
        server.wait()