~0x44/nova/extdoc

« back to all changes in this revision

Viewing changes to bin/nova-api

  • Committer: NTT PF Lab.
  • Date: 2010-12-24 11:38:49 UTC
  • mto: This revision was merged to the branch mainline in revision 564.
  • Revision ID: openstack@lab.ntt.co.jp-20101224113849-z9nemzmki17bxnvw
SupportĀ IPv6

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 API.
21
 
 
22
 
Starts both the EC2 and OpenStack APIs in separate greenthreads.
23
 
 
24
 
"""
25
 
 
26
 
import eventlet
27
 
eventlet.monkey_patch()
28
 
 
29
 
import os
30
 
import sys
31
 
 
32
 
 
33
 
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(
34
 
        sys.argv[0]), os.pardir, os.pardir))
35
 
if os.path.exists(os.path.join(possible_topdir, "nova", "__init__.py")):
36
 
    sys.path.insert(0, possible_topdir)
37
 
 
38
 
 
39
 
from nova import flags
40
 
from nova import log as logging
41
 
from nova import service
42
 
from nova import utils
43
 
 
44
 
if __name__ == '__main__':
45
 
    utils.default_flagfile()
46
 
    flags.FLAGS(sys.argv)
47
 
    logging.setup()
48
 
    utils.monkey_patch()
49
 
    servers = []
50
 
    for api in flags.FLAGS.enabled_apis:
51
 
        servers.append(service.WSGIService(api))
52
 
    service.serve(*servers)
53
 
    service.wait()