creating namespace in k8s does not result in creating a contrail-api project

Bug #1677439 reported by Vedamurthy Joshi
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Juniper Openstack
Status tracked in Trunk
Trunk
Fix Committed
High
Yuvaraja Mariappan

Bug Description

4.0 Build 3049

On creating a namespace, below error is seen in kube manager log

03/30/2017 03:16:25 AM [contrail-kube-manager]: SANDESH: [DROP: NoSession] __default__ [SYS_ERR]: KubeManagerErrorLog: <type 'exceptions.AttributeError'>
Python 2.7.6: /usr/bin/python
Thu Mar 30 03:16:25 2017

A problem occurred in a Python script. Here is the sequence of
function calls leading up to the error, in the order they occurred.

 /usr/lib/python2.7/dist-packages/cfgm_common/vnc_amqp.py in _vnc_subscribe_callback(self=<cfgm_common.vnc_amqp.VncAmqpHandle object>, oper_info={u'fq_name': [u'default-domain', u'default', u'default-cluster-test-2-sg'], u'obj_dict': {u'display_name': u'default-cluster-test-2-sg', u'fq_name': [u'default-domain', u'default', u'default-cluster-test-2-sg'], u'id_perms': {u'created': u'2017-03-30T03:16:25.038822', u'creator': None, u'description': u'Namespace security group', u'enable': True, u'last_modified': u'2017-03-30T03:16:25.038822', u'permissions': {u'group': u'cloud-admin-group', u'group_access': 7, u'other_access': 7, u'owner': u'cloud-admin', u'owner_access': 7}, u'user_visible': True, u'uuid': {u'uuid_lslong': 10526577208852374382L, u'uuid_mslong': 891617255975240656}}, u'parent_type': u'project', u'parent_uuid': u'1beeba60-a81c-45bf-bb06-a6df3d5c11fe', u'perms2': {u'global_access': 0, u'owner': u'cloud-admin', u'owner_access': 7, u'share': []}, u'security_group_id': 8000008, u'uuid': u'0c5fa92b-9a03-43d0-9215-ea33025e636e'}, u'oper': u'CREATE', u'request-id': u'req-43c60953-7499-4a70-8f21-761962fc7d69', u'type': u'security_group', u'uuid': u'0c5fa92b-9a03-43d0-9215-ea33025e636e'})
   46 try:
   47 self.oper_info = oper_info
   48 self.vnc_subscribe_actions()
   49
   50 except Exception:
self = <cfgm_common.vnc_amqp.VncAmqpHandle object>
self.vnc_subscribe_actions = <bound method VncAmqpHandle.vnc_subscribe_actions of <cfgm_common.vnc_amqp.VncAmqpHandle object>>

 /usr/lib/python2.7/dist-packages/cfgm_common/vnc_amqp.py in vnc_subscribe_actions(self=<cfgm_common.vnc_amqp.VncAmqpHandle object>)
   90 oper, obj_id)
   91 if oper == 'CREATE':
   92 self.handle_create()
   93 elif oper == 'UPDATE':
   94 self.handle_update()
self = <cfgm_common.vnc_amqp.VncAmqpHandle object>
self.handle_create = <bound method VncAmqpHandle.handle_create of <cfgm_common.vnc_amqp.VncAmqpHandle object>>

 /usr/lib/python2.7/dist-packages/cfgm_common/vnc_amqp.py in handle_create(self=<cfgm_common.vnc_amqp.VncAmqpHandle object>)
  115 self.db_cls._object_db.cache_uuid_to_fq_name_add(
  116 obj_id, obj_fq_name, self.obj_type)
  117 self.obj = self.obj_class.locate(obj_key)
  118 if self.obj is None:
  119 self.logger.info('%s id %s fq_name %s not found' % (
self = <cfgm_common.vnc_amqp.VncAmqpHandle object>
self.obj = None
self.obj_class = <class 'kube_manager.vnc.config_db.SecurityGroupKM'>
self.obj_class.locate = <bound method __metaclass__.locate of <class 'kube_manager.vnc.config_db.SecurityGroupKM'>>
obj_key = u'0c5fa92b-9a03-43d0-9215-ea33025e636e'

 /usr/lib/python2.7/dist-packages/cfgm_common/vnc_db.py in locate(cls=<class 'kube_manager.vnc.config_db.SecurityGroupKM'>, key=u'0c5fa92b-9a03-43d0-9215-ea33025e636e', *args=())
   74 if key not in cls._dict:
   75 try:
   76 obj = cls(key, *args)
   77 cls._dict[key] = obj
   78 return obj
obj undefined
cls = <class 'kube_manager.vnc.config_db.SecurityGroupKM'>
key = u'0c5fa92b-9a03-43d0-9215-ea33025e636e'
args = ()

 /usr/lib/python2.7/dist-packages/kube_manager/vnc/config_db.py in __init__(self=<kube_manager.vnc.config_db.SecurityGroupKM object>, uuid=u'0c5fa92b-9a03-43d0-9215-ea33025e636e', obj_dict=None)
  718 self.dst_pod_selector = None
  719 self.dst_ports = None
  720 obj_dict = self.update(obj_dict)
  721 super(SecurityGroupKM, self).__init__(uuid, obj_dict)
  722
obj_dict = None
self = <kube_manager.vnc.config_db.SecurityGroupKM object>
self.update = <bound method SecurityGroupKM.update of <kube_manager.vnc.config_db.SecurityGroupKM object>>

 /usr/lib/python2.7/dist-packages/kube_manager/vnc/config_db.py in update(self=<kube_manager.vnc.config_db.SecurityGroupKM object>, obj={'display_name': u'default-cluster-test-2-sg', 'fq_name': [u'default-domain', u'default', u'default-cluster-test-2-sg'], 'id_perms': {u'created': u'2017-03-30T03:16:25.038822', u'creator': None, u'description': u'Namespace security group', u'enable': True, u'last_modified': u'2017-03-30T03:16:25.038822', u'permissions': {u'group': u'cloud-admin-group', u'group_access': 7, u'other_access': 7, u'owner': u'cloud-admin', u'owner_access': 7}, u'user_visible': True, u'uuid': {u'uuid_lslong': 10526577208852374382L, u'uuid_mslong': 891617255975240656}}, 'parent_type': u'project', 'parent_uuid': '1beeba60-a81c-45bf-bb06-a6df3d5c11fe', 'perms2': {u'global_access': 0, u'owner': u'cloud-admin', u'owner_access': 7, u'share': []}, 'security_group_id': 8000008, 'uuid': u'0c5fa92b-9a03-43d0-9215-ea33025e636e'})
  728 self.build_fq_name_to_uuid(self.uuid, obj)
  729 self.annotations = obj.get('annotations', None)
  730 for kvp in self.annotations.get('key_value_pair', []):
  731 if kvp.get('key') == 'namespace':
  732 self.namespace = kvp.get('value')
kvp undefined
self = <kube_manager.vnc.config_db.SecurityGroupKM object>
self.annotations = None
self.annotations.get undefined
<type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'get'
    __class__ = <type 'exceptions.AttributeError'>
    __delattr__ = <method-wrapper '__delattr__' of exceptions.AttributeError object>
    __dict__ = {}
    __doc__ = 'Attribute not found.'
    __format__ = <built-in method __format__ of exceptions.AttributeError object>
    __getattribute__ = <method-wrapper '__getattribute__' of exceptions.AttributeError object>
    __getitem__ = <method-wrapper '__getitem__' of exceptions.AttributeError object>
    __getslice__ = <method-wrapper '__getslice__' of exceptions.AttributeError object>
    __hash__ = <method-wrapper '__hash__' of exceptions.AttributeError object>
    __init__ = <method-wrapper '__init__' of exceptions.AttributeError object>
    __new__ = <built-in method __new__ of type object>
    __reduce__ = <built-in method __reduce__ of exceptions.AttributeError object>
    __reduce_ex__ = <built-in method __reduce_ex__ of exceptions.AttributeError object>
    __repr__ = <method-wrapper '__repr__' of exceptions.AttributeError object>
    __setattr__ = <method-wrapper '__setattr__' of exceptions.AttributeError object>
    __setstate__ = <built-in method __setstate__ of exceptions.AttributeError object>
    __sizeof__ = <built-in method __sizeof__ of exceptions.AttributeError object>
    __str__ = <method-wrapper '__str__' of exceptions.AttributeError object>
    __subclasshook__ = <built-in method __subclasshook__ of type object>
    __unicode__ = <built-in method __unicode__ of exceptions.AttributeError object>
    args = ("'NoneType' object has no attribute 'get'",)
    message = "'NoneType' object has no attribute 'get'"

The above is a description of an error in a Python program. Here is
the original traceback:

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/cfgm_common/vnc_amqp.py", line 48, in _vnc_subscribe_callback
    self.vnc_subscribe_actions()
  File "/usr/lib/python2.7/dist-packages/cfgm_common/vnc_amqp.py", line 92, in vnc_subscribe_actions
    self.handle_create()
  File "/usr/lib/python2.7/dist-packages/cfgm_common/vnc_amqp.py", line 117, in handle_create
    self.obj = self.obj_class.locate(obj_key)
  File "/usr/lib/python2.7/dist-packages/cfgm_common/vnc_db.py", line 76, in locate
    obj = cls(key, *args)
  File "/usr/lib/python2.7/dist-packages/kube_manager/vnc/config_db.py", line 720, in __init__
    obj_dict = self.update(obj_dict)
  File "/usr/lib/python2.7/dist-packages/kube_manager/vnc/config_db.py", line 730, in update
    for kvp in self.annotations.get('key_value_pair', []):
AttributeError: 'NoneType' object has no attribute 'get'

03/30/2017 03:16:25 AM [contrail-kube-manager]: Error in rabbitmq drainer greenlet: 'Namespace' object has no attribute 'trace_file'
03/30/2017 03:16:25 AM [contrail-kube-manager]: RabbitMQ connection down

Revision history for this message
Vedamurthy Joshi (vedujoshi) wrote :

From 3049 onwards, the default behavior has been changed. Only came to know about it now

Changed in juniperopenstack:
status: New → Invalid
status: Invalid → Confirmed
Revision history for this message
Vedamurthy Joshi (vedujoshi) wrote :

The backtrace got still needs to be fixed...per Yuvaraja, it is being looked at

Changed in juniperopenstack:
assignee: nobody → ymariappan (ymariappan)
Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] master

Review in progress for https://review.opencontrail.org/30025
Submitter: Yuvaraja Mariappan

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : A change has been merged

Reviewed: https://review.opencontrail.org/30025
Committed: http://github.org/Juniper/contrail-controller/commit/a7cbf0130041041924beb6cb54bc23b6df656285
Submitter: Zuul (<email address hidden>)
Branch: master

commit a7cbf0130041041924beb6cb54bc23b6df656285
Author: Yuvaraja Mariappan <email address hidden>
Date: Thu Mar 30 21:01:49 2017 -0700

Fixed issue in handling annotations in SecurityGroupKM

Since the annotations value are sent in the second update,
it is possible to get the none value for the first update.
using empty dict on those cases would fix the issue.

Change-Id: I35ca83fccaaa86f43779a085273231b2685885d3
Closes-bug: #1677439

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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