From: Erik Colnick Date: Wed, 18 Jun 2014 17:31:52 +0000 (-0600) Subject: Add admin tenant name to nova notifier X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=cf92bbead9b25ee40a3336bd76110b3733a4f7ee;p=openstack-build%2Fneutron-build.git Add admin tenant name to nova notifier This change introduces the ability to use the nova admin tenant name with the nova notifier in place of the nova admin tenant id which may not be available when the neutron service is being configured as is the case with tripleo installations where the neutron service is configured and started before the nova admin tenant has been configured in keystone and thus does not have a known id. DocImpact Introduces the nova_admin_tenant_name configuration entry as an optional configurable value in neutron.conf. If the nova_admin_tenant_name is configured and the nova_admin_tenanat_id is not configured, a performance impact may be seen because keystone will become involved in communication between neutron and nova. Change-Id: I33701d4dc9bf61595e44a49050c405ebca779091 Closes-Bug: #1331566 --- diff --git a/etc/neutron.conf b/etc/neutron.conf index 083662642..1c7042a3f 100644 --- a/etc/neutron.conf +++ b/etc/neutron.conf @@ -251,6 +251,11 @@ lock_path = $state_path/lock # The uuid of the admin nova tenant # nova_admin_tenant_id = +# The name of the admin nova tenant. If the uuid of the admin nova tenant +# is set, this is optional. Useful for cases where the uuid of the admin +# nova tenant is not available when configuration is being done. +# nova_admin_tenant_name = + # Password for connection to nova in admin context. # nova_admin_password = diff --git a/neutron/common/config.py b/neutron/common/config.py index cda8d0503..7f60851a6 100644 --- a/neutron/common/config.py +++ b/neutron/common/config.py @@ -101,6 +101,8 @@ core_opts = [ secret=True), cfg.StrOpt('nova_admin_tenant_id', help=_('The uuid of the admin nova tenant')), + cfg.StrOpt('nova_admin_tenant_name', + help=_('The name of the admin nova tenant')), cfg.StrOpt('nova_admin_auth_url', default='http://localhost:5000/v2.0', help=_('Authorization URL for connecting to nova in admin ' diff --git a/neutron/notifiers/nova.py b/neutron/notifiers/nova.py index aa4f1b53e..2b2bab63d 100644 --- a/neutron/notifiers/nova.py +++ b/neutron/notifiers/nova.py @@ -41,12 +41,16 @@ class Notifier(object): def __init__(self): # TODO(arosen): we need to cache the endpoints and figure out # how to deal with different regions here.... - bypass_url = "%s/%s" % (cfg.CONF.nova_url, - cfg.CONF.nova_admin_tenant_id) + if cfg.CONF.nova_admin_tenant_id: + bypass_url = "%s/%s" % (cfg.CONF.nova_url, + cfg.CONF.nova_admin_tenant_id) + else: + bypass_url = None + self.nclient = nclient.Client( username=cfg.CONF.nova_admin_username, api_key=cfg.CONF.nova_admin_password, - project_id=None, + project_id=cfg.CONF.nova_admin_tenant_name, tenant_id=cfg.CONF.nova_admin_tenant_id, auth_url=cfg.CONF.nova_admin_auth_url, cacert=cfg.CONF.nova_ca_certificates_file,