diff --git a/bin/glance-api b/bin/glance-api index 9f214ca8cb..d35f6bd24b 100755 --- a/bin/glance-api +++ b/bin/glance-api @@ -57,7 +57,7 @@ if __name__ == '__main__': (options, args) = config.parse_options(oparser) try: - conf, app = config.load_paste_app('api', options, args) + conf, app = config.load_paste_app('glance-api', options, args) server = wsgi.Server() server.start(app, int(conf['bind_port']), conf['bind_host']) diff --git a/bin/glance-control b/bin/glance-control index 12b070fb55..eb19e86490 100755 --- a/bin/glance-control +++ b/bin/glance-control @@ -133,7 +133,7 @@ def do_start(server, options, args): pid_file = '/var/run/glance/%s.pid' % server else: pid_file = os.path.abspath(options['pid_file']) - conf_file = config.find_config_file(options, args) + conf_file = config.find_config_file(server, options, args) if not conf_file: sys.exit("Could not find any configuration file to use!") launch_args = [(conf_file, pid_file)] diff --git a/doc/source/configuring.rst b/doc/source/configuring.rst index 80e841acfb..467f09608c 100644 --- a/doc/source/configuring.rst +++ b/doc/source/configuring.rst @@ -17,10 +17,34 @@ Configuring Glance ================== +Glance has a number of options that you can use to configure the Glance API +server, the Glance Registry server, and the various storage backends that +Glance can use to store images. + +Most configuration is done via configuration files, with the Glance API +server and Glance Registry server using separate configuration files. + +When starting up a Glance server, you can specify the configuration file to +use (see `the documentation on controller Glance servers `_). +If you do **not** specify a configuration file, Glance will look in the following +directories for a configuration file, in order: + +* ``$CWD`` +* ``~/.glance`` +* ``~/`` +* ``/etc/glance`` +* ``/etc`` + +The Glance API server configuration file should be named ``glance-api.conf``. +Similarly, the Glance Registry server configuration file should be named +``glance-registry.conf``. If you installed Glance via your operating system's +package management system, it is likely that you will have sample +configuration files installed in ``/etc/glance``. + In addition to this documentation page, you can check the -``etc/glance.conf.sample`` sample configuration file distributed with Glance -for an example configuration file with detailed comments on what each options -does. +``etc/glance-api.conf`` and ``etc/glance-registry.conf`` sample configuration +files distributed with Glance for example configuration files for each server +application with detailed comments on what each options does. Common Configuration Options in Glance -------------------------------------- @@ -67,7 +91,7 @@ Configuring Logging in Glance There are a number of configuration options in Glance that control how Glance servers log messages. The configuration options can be specified both on the -command line and in the ``glance.conf`` config file. +command line and in config files. * ``--log-config=PATH`` @@ -113,7 +137,7 @@ Configuring Glance Storage Backends There are a number of configuration options in Glance that control how Glance stores disk images. These configuration options are specified in the -``glance.conf`` config file `in the section [app:glance-api]`. +``glance-api.conf`` config file in the section ``[DEFAULT]``. * ``default_store=STORE`` @@ -199,7 +223,7 @@ Configuring the Glance Registry Glance ships with a default, reference implementation registry server. There are a number of configuration options in Glance that control how this registry server operates. These configuration options are specified in the -``glance.conf`` config file `in the section [app:glance-registry]`. +``glance-registry.conf`` config file in the section ``[DEFAULT]``. * ``sql_connection=CONNECTION_STRING`` (``--sql-connection`` when specified on command line) diff --git a/etc/api.conf b/etc/glance-api.conf similarity index 98% rename from etc/api.conf rename to etc/glance-api.conf index 829128bf59..1cbf67d0da 100644 --- a/etc/api.conf +++ b/etc/glance-api.conf @@ -51,7 +51,7 @@ swift_store_container = glance # Do we create the container if it does not exist? swift_store_create_container_on_put = False -[composite:api] +[composite:glance-api] use = egg:Paste#urlmap /: versions /v1.0: api_1_0 diff --git a/etc/registry.conf b/etc/glance-registry.conf similarity index 100% rename from etc/registry.conf rename to etc/glance-registry.conf diff --git a/glance/common/config.py b/glance/common/config.py index d073bd7dc0..3d34c6b066 100644 --- a/glance/common/config.py +++ b/glance/common/config.py @@ -175,14 +175,14 @@ def setup_logging(options, conf): root_logger.addHandler(handler) -def find_config_file(options, args): +def find_config_file(app_name, options, args): """ - Return the first config file found. + Return the first config file found for an application. We search for the paste config file in the following order: * If --config-file option is used, use that * If args[0] is a file, use that - * Search for glance.conf in standard directories: + * Search for $app.conf in standard directories: * . * ~.glance/ * ~ @@ -208,7 +208,7 @@ def find_config_file(options, args): '/etc'] for cfg_dir in config_file_dirs: - cfg_file = os.path.join(cfg_dir, 'glance.conf') + cfg_file = os.path.join(cfg_dir, '%s.conf' % app_name) if os.path.exists(cfg_file): return cfg_file @@ -238,7 +238,7 @@ def load_paste_config(app_name, options, args): :raises RuntimeError when config file cannot be located or there was a problem loading the configuration file. """ - conf_file = find_config_file(options, args) + conf_file = find_config_file(app_name, options, args) if not conf_file: raise RuntimeError("Unable to locate any configuration file. " "Cannot load application %s" % app_name) diff --git a/tests/functional/__init__.py b/tests/functional/__init__.py index dcb29ecad2..160a2c2913 100644 --- a/tests/functional/__init__.py +++ b/tests/functional/__init__.py @@ -148,7 +148,7 @@ registry_host = 0.0.0.0 registry_port = %(registry_port)s log_file = %(log_file)s -[composite:api] +[composite:glance-api] use = egg:Paste#urlmap /: versions /v1.0: api_1_0 diff --git a/tests/functional/test_logging.py b/tests/functional/test_logging.py index 8045b536ff..4070df6471 100644 --- a/tests/functional/test_logging.py +++ b/tests/functional/test_logging.py @@ -45,7 +45,7 @@ class TestLogging(functional.FunctionalTest): api_log_out = open(self.api_server.log_file, 'r').read() - self.assertTrue('DEBUG [api]' in api_log_out) + self.assertTrue('DEBUG [glance-api]' in api_log_out) self.assertTrue(os.path.exists(self.registry_server.log_file))