From b2d7ecc4ceda3a3b4224984042f905fa9b9ec582 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Wed, 29 May 2013 17:48:40 +0200 Subject: [PATCH] Move os_* options into a group Change-Id: I1c4942cdc474658222ab3ddcd71849150bbc8db4 Signed-off-by: Julien Danjou --- ceilometer/central/manager.py | 10 ++--- ceilometer/nova_client.py | 13 +++--- ceilometer/service.py | 7 ++- doc/source/configuration.rst | 22 +++++++--- etc/ceilometer/ceilometer.conf.sample | 62 ++++++++++++++------------- 5 files changed, 67 insertions(+), 47 deletions(-) diff --git a/ceilometer/central/manager.py b/ceilometer/central/manager.py index ef6281a61..866c66584 100644 --- a/ceilometer/central/manager.py +++ b/ceilometer/central/manager.py @@ -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) diff --git a/ceilometer/nova_client.py b/ceilometer/nova_client.py index 9bbff9ff2..3d8419e40 100644 --- a/ceilometer/nova_client.py +++ b/ceilometer/nova_client.py @@ -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()) diff --git a/ceilometer/service.py b/ceilometer/service.py index fa91a1b14..22591c2d3 100644 --- a/ceilometer/service.py +++ b/ceilometer/service.py @@ -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): diff --git a/doc/source/configuration.rst b/doc/source/configuration.rst index 73104f568..2c3d233a0 100644 --- a/doc/source/configuration.rst +++ b/doc/source/configuration.rst @@ -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 ================================== diff --git a/etc/ceilometer/ceilometer.conf.sample b/etc/ceilometer/ceilometer.conf.sample index aaea5b3ea..db8d834fb 100644 --- a/etc/ceilometer/ceilometer.conf.sample +++ b/etc/ceilometer/ceilometer.conf.sample @@ -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= +# 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= + + # Total option count: 120