]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Add admin tenant name to nova notifier
authorErik Colnick <erik.colnick@hp.com>
Wed, 18 Jun 2014 17:31:52 +0000 (11:31 -0600)
committerErik Colnick <erik.colnick@hp.com>
Tue, 30 Sep 2014 18:18:55 +0000 (12:18 -0600)
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

etc/neutron.conf
neutron/common/config.py
neutron/notifiers/nova.py

index 0836626424af65b9dd7dc65ec5b683fffe6c9535..1c7042a3f7db35c4957de72cf6ea929f4f48b61a 100644 (file)
@@ -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 =
 
index cda8d0503bbc91d38e3c096c9effa8e758d61fae..7f60851a60796329d8d695d9cf0735308138eb5b 100644 (file)
@@ -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 '
index aa4f1b53e11811ada9e9f48052d323d3a9d3dce3..2b2bab63d1bac547bd1803314a7c387d522cf898 100644 (file)
@@ -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,