~markmc/nova/flat-dhcp-without-bridge-iface

« back to all changes in this revision

Viewing changes to bin/nova-api-os

  • Committer: Tarmac
  • Author(s): Vishvananda Ishaya
  • Date: 2011-08-19 00:04:02 UTC
  • mfrom: (1450.4.8 united-launch-strategy)
  • Revision ID: tarmac-20110819000402-dp9hs0eosmunud8x
Makes all of the binary services launch using the same strategy.
 * Removes helper methods from utils for loading flags and logging
 * Changes service.serve to use Launcher
 * Changes service.wait to actually wait for all the services to exit
 * Changes nova-api to explicitly load flags and logging and use service.serve
 * Fixes the annoying IOError when /etc/nova/nova.conf doesn't exist

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");
 
9
#    you may not use this file except in compliance with the License.
 
10
#    You may obtain 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,
 
16
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
17
#    See the License for the specific language governing permissions and
 
18
#    limitations under the License.
 
19
 
 
20
"""Starter script for Nova OS API."""
 
21
 
 
22
import eventlet
 
23
eventlet.monkey_patch()
 
24
 
 
25
import os
 
26
import sys
 
27
 
 
28
 
 
29
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(
 
30
        sys.argv[0]), os.pardir, os.pardir))
 
31
if os.path.exists(os.path.join(possible_topdir, "nova", "__init__.py")):
 
32
    sys.path.insert(0, possible_topdir)
 
33
 
 
34
 
 
35
from nova import flags
 
36
from nova import log as logging
 
37
from nova import service
 
38
from nova import utils
 
39
 
 
40
if __name__ == '__main__':
 
41
    utils.default_flagfile()
 
42
    flags.FLAGS(sys.argv)
 
43
    logging.setup()
 
44
    server = service.WSGIService('osapi')
 
45
    service.serve(server)
 
46
    service.wait()