Move os_* options into a group

Change-Id: I1c4942cdc474658222ab3ddcd71849150bbc8db4
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2013-05-29 17:48:40 +02:00
parent 522e6324b6
commit b2d7ecc4ce
5 changed files with 67 additions and 47 deletions

View File

@ -69,10 +69,10 @@ class AgentManager(agent.AgentManager):
def interval_task(self, task):
self.keystone = ksclient.Client(
username=cfg.CONF.os_username,
password=cfg.CONF.os_password,
tenant_id=cfg.CONF.os_tenant_id,
tenant_name=cfg.CONF.os_tenant_name,
auth_url=cfg.CONF.os_auth_url)
username=cfg.CONF.service_credentials.os_username,
password=cfg.CONF.service_credentials.os_password,
tenant_id=cfg.CONF.service_credentials.os_tenant_id,
tenant_name=cfg.CONF.service_credentials.os_tenant_name,
auth_url=cfg.CONF.service_credentials.os_auth_url)
super(AgentManager, self).interval_task(task)

View File

@ -42,13 +42,14 @@ class Client(object):
def __init__(self):
"""Returns a nova Client object."""
conf = cfg.CONF
conf = cfg.CONF.service_credentials
tenant = conf.os_tenant_id and conf.os_tenant_id or conf.os_tenant_name
self.nova_client = nova_client.Client(username=cfg.CONF.os_username,
api_key=cfg.CONF.os_password,
project_id=tenant,
auth_url=cfg.CONF.os_auth_url,
no_cache=True)
self.nova_client = nova_client.Client(
username=cfg.CONF.service_credentials.os_username,
api_key=cfg.CONF.service_credentials.os_password,
project_id=tenant,
auth_url=cfg.CONF.service_credentials.os_auth_url,
no_cache=True)
def _with_flavor(self, instances):
flavors = dict((f.id, f) for f in self.nova_client.flavors.list())

View File

@ -41,24 +41,29 @@ cfg.CONF.register_opts([
CLI_OPTIONS = [
cfg.StrOpt('os-username',
deprecated_group="DEFAULT",
default=os.environ.get('OS_USERNAME', 'ceilometer'),
help='Username to use for openstack service access'),
cfg.StrOpt('os-password',
deprecated_group="DEFAULT",
secret=True,
default=os.environ.get('OS_PASSWORD', 'admin'),
help='Password to use for openstack service access'),
cfg.StrOpt('os-tenant-id',
deprecated_group="DEFAULT",
default=os.environ.get('OS_TENANT_ID', ''),
help='Tenant ID to use for openstack service access'),
cfg.StrOpt('os-tenant-name',
deprecated_group="DEFAULT",
default=os.environ.get('OS_TENANT_NAME', 'admin'),
help='Tenant name to use for openstack service access'),
cfg.StrOpt('os-auth-url',
deprecated_group="DEFAULT",
default=os.environ.get('OS_AUTH_URL',
'http://localhost:5000/v2.0'),
help='Auth URL to use for openstack service access'),
]
cfg.CONF.register_cli_opts(CLI_OPTIONS)
cfg.CONF.register_cli_opts(CLI_OPTIONS, group="service_credentials")
def _sanitize_cmd_line(argv):

View File

@ -40,11 +40,6 @@ metering_topic metering the topic
counter_source openstack The source name of emited counters
control_exchange ceilometer AMQP exchange to connect to if using RabbitMQ or Qpid
periodic_interval 600 seconds between running periodic tasks
os_username ceilometer Username to use for openstack service access
os_password admin Password to use for openstack service access
os_tenant_id Tenant ID to use for openstack service access
os_tenant_name admin Tenant name to use for openstack service access
os_auth_url http://localhost:5000/v2.0 Auth URL to use for openstack service access
database_connection mongodb://localhost:27017/ceilometer Database connection string
metering_api_port 8777 The port for the ceilometer API server
disabled_central_pollsters List of central pollsters to skip loading
@ -53,6 +48,23 @@ disabled_notification_listeners List of n
reseller_prefix AUTH\_ Prefix used by swift for reseller token
=============================== ==================================== ==============================================================
Service polling authentication
==============================
The following options must be placed into a [service_credentials] sections
and will be used by Ceilometer to retrieve information from OpenStack
components.
=============================== ==================================== ==============================================================
Parameter Default Note
=============================== ==================================== ==============================================================
os_username ceilometer Username to use for openstack service access
os_password admin Password to use for openstack service access
os_tenant_id Tenant ID to use for openstack service access
os_tenant_name admin Tenant name to use for openstack service access
os_auth_url http://localhost:5000/v2.0 Auth URL to use for openstack service access
=============================== ==================================== ==============================================================
Keystone Middleware Authentication
==================================

View File

@ -27,27 +27,6 @@
#policy_default_rule=default
#
# Options defined in ceilometer.service
#
# Username to use for openstack service access (string value)
#os_username=ceilometer
# Password to use for openstack service access (string value)
#os_password=admin
# Tenant ID to use for openstack service access (string value)
#os_tenant_id=
# Tenant name to use for openstack service access (string
# value)
#os_tenant_name=admin
# Auth URL to use for openstack service access (string value)
#os_auth_url=http://localhost:5000/v2.0
#
# Options defined in ceilometer.api.app
#
@ -444,7 +423,7 @@
# Name of this node. Must be a valid hostname, FQDN, or IP
# address. Must match "host" option, if running Nova. (string
# value)
#rpc_zmq_host=ceilometer
#rpc_zmq_host=dex
#
@ -588,20 +567,27 @@
#host=0.0.0.0
[matchmaker_redis]
[service_credentials]
#
# Options defined in ceilometer.openstack.common.rpc.matchmaker_redis
# Options defined in ceilometer.service
#
# Host to locate redis (string value)
#host=127.0.0.1
# Username to use for openstack service access (string value)
#os_username=ceilometer
# Use this port to connect to redis host. (integer value)
#port=6379
# Password to use for openstack service access (string value)
#os_password=admin
# Password for Redis server. (optional) (string value)
#password=<None>
# Tenant ID to use for openstack service access (string value)
#os_tenant_id=
# Tenant name to use for openstack service access (string
# value)
#os_tenant_name=admin
# Auth URL to use for openstack service access (string value)
#os_auth_url=http://localhost:5000/v2.0
[collector]
@ -631,4 +617,20 @@
#ringfile=/etc/oslo/matchmaker_ring.json
[matchmaker_redis]
#
# Options defined in ceilometer.openstack.common.rpc.matchmaker_redis
#
# Host to locate redis (string value)
#host=127.0.0.1
# Use this port to connect to redis host. (integer value)
#port=6379
# Password for Redis server. (optional) (string value)
#password=<None>
# Total option count: 120