~anso/nova/factorycleanup

« back to all changes in this revision

Viewing changes to bin/nova-combined

  • Committer: Todd Willey
  • Date: 2011-01-13 23:26:18 UTC
  • mfrom: (524.1.9 wsgirouter)
  • Revision ID: todd@ansolabs.com-20110113232618-1dxx9axx65h5fxmj
Merge trunk + wsgirouter.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
 
37
37
gettext.install('nova', unicode=1)
38
38
 
39
 
from nova import api
40
39
from nova import flags
 
40
from nova import log as logging
41
41
from nova import service
42
42
from nova import utils
43
43
from nova import wsgi
44
44
 
45
45
 
46
46
FLAGS = flags.FLAGS
47
 
flags.DEFINE_string('osapi_host', '0.0.0.0', 'OpenStack API host')
48
 
flags.DEFINE_integer('ec2api_port', 8773, 'EC2 API port')
49
 
flags.DEFINE_string('ec2api_host', '0.0.0.0', 'EC2 API host')
50
47
 
51
48
 
52
49
if __name__ == '__main__':
53
50
    utils.default_flagfile()
54
51
    FLAGS(sys.argv)
 
52
    logging.basicConfig()
55
53
 
56
54
    compute = service.Service.create(binary='nova-compute')
57
55
    network = service.Service.create(binary='nova-network')
61
59
 
62
60
    service.serve(compute, network, volume, scheduler)
63
61
 
64
 
    server = wsgi.Server()
65
 
    server.start(api.API('os'), FLAGS.osapi_port, host=FLAGS.osapi_host)
66
 
    server.start(api.API('ec2'), FLAGS.ec2api_port, host=FLAGS.ec2api_host)
67
 
    server.wait()
 
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()