config: cannot create virtual-network in default-domain in keystone v3 mode

Bug #1375984 reported by Hampapur Ajay
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Juniper Openstack
Fix Committed
Critical
Hampapur Ajay

Bug Description

When keystone v3 is used, the default domain id in contrail is tracked to match with 'default' in keystone in OpenstackDriver object which should be a singleton.

However the ResourceApiDriver class instead of using this singleton constructs another instance of OpenstackDriver and then loses the value of _vnc_default_domain_id leading to a traceback on network create of:

Traceback (most recent call last):
  File "/opt/contrail/api-venv/lib/python2.7/site-packages/stevedore/extension.py", line 171, in _invoke_one_plugin
    response_callback(func(e, *args, **kwds))
  File "/opt/contrail/api-venv/lib/python2.7/site-packages/stevedore/extension.py", line 145, in _call_extension_method
    return getattr(extension.obj, method_name)(*args, **kwds)
  File "/opt/contrail/api-venv/lib/python2.7/site-packages/vnc_openstack/__init__.py", line 612, in pre_project_read
    self._openstack_drv.sync_project_to_vnc(id)
  File "/opt/contrail/api-venv/lib/python2.7/site-packages/vnc_openstack/__init__.py", line 256, in _ksv3_sync_project_to_vnc
    proj_obj = vnc_api.Project(project_name, parent_obj=dom_obj)
  File "/usr/lib/python2.7/dist-packages/vnc_api/gen/resource_client.py", line 5107, in __init__
    super(Project, self).__init__(name, parent_obj, quota, id_perms, display_name, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/vnc_api/gen/resource_common.py", line 7879, in __init__
    self.parent_type = parent_obj._type
AttributeError: 'str' object has no attribute '_type'

This is because dom_obj is in fact an error message asking for either name or id to be specified.

This can be fixed by using a singleton as below:

--- /opt/contrail/api-venv/lib/python2.7/site-packages/vnc_openstack/__init__.py 2014-09-30 19:38:08.765484124 +0000
+++ vnc_openstack_init.py 2014-09-30 19:34:49.321549842 +0000
@@ -49,8 +49,11 @@
     return (auth_user, auth_passwd, admin_token, admin_tenant, auth_url,
             keystone_sync_on_demand)

+openstack_driver = None
 class OpenstackDriver(vnc_plugin_base.Resync):
     def __init__(self, api_server_ip, api_server_port, conf_sections):
+ global openstack_driver
+ openstack_driver = self
         self._vnc_api_ip = api_server_ip
         self._vnc_api_port = api_server_port

@@ -481,7 +484,7 @@
          self._keystone_sync_on_demand) = get_keystone_opts(conf_sections)

         self._vnc_lib = None
- self._openstack_drv = OpenstackDriver(api_server_ip, api_server_port, conf_sections)
+ self._openstack_drv = openstack_driver
         # Tracks which domains/projects have been sync'd from keystone to contrail api server
         self._vnc_domains = set()
         self._vnc_projects = set()

Hampapur Ajay (hajay)
Changed in juniperopenstack:
assignee: nobody → Hampapur Ajay (hajay)
importance: Undecided → Critical
Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : A change has been merged

Reviewed: https://review.opencontrail.org/3310
Committed: http://github.org/Juniper/contrail-controller/commit/fb3ff4fce3b7459c6333cde82be6fdb9407d6ffb
Submitter: Zuul
Branch: master

commit fb3ff4fce3b7459c6333cde82be6fdb9407d6ffb
Author: Hampapur Ajay <email address hidden>
Date: Tue Sep 30 18:16:38 2014 -0700

Use a singleton instance of OpenstackDriver and use it where needed

Change-Id: I689a6a72f9e4b88130a87a1008309d5f593e50d5
Closes-Bug: 1375984

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Reviewed: https://review.opencontrail.org/3334
Committed: http://github.org/Juniper/contrail-controller/commit/4b9103ae0d4eced391812619d81dc788e5b4ef7e
Submitter: Zuul
Branch: R1.10

commit 4b9103ae0d4eced391812619d81dc788e5b4ef7e
Author: Hampapur Ajay <email address hidden>
Date: Wed Oct 1 09:58:03 2014 -0700

Use a singleton instance of OpenstackDriver and use it where needed

Change-Id: I49a789563b0d998374ef6c52ea343dd6da6a7064
Closes-Bug: 1375984

Sachin Bansal (sbansal)
Changed in juniperopenstack:
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.