Fw Draft: Deleting Service Group with draft mode enabled fails

Bug #1769277 reported by Senthilnathan Murugappan on 2018-05-04
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Juniper Openstack
Status tracked in Trunk
R5.0
Fix Committed
High
Édouard Thuleau
Trunk
Fix Committed
High
Édouard Thuleau

Bug Description

1) Create a Service Group
2) Create a FW-Rule with SG refs
3) Enable draft mode
4) Remove the SG refs from the FW-Rule
5) Delete the Service Group

Step 5) fails with the below error
05/04/2018 03:34:20 PM [contrail-api]: __default__ [SYS_ERR]: VncApiError: <type 'exceptions.TypeError'> Python 2.7.5: /usr/bin/python Fri May 4 15:34:20 2018
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/site-packages/vnc_cfg_api_server/vnc_cfg_api_server.py in handler_trap_exception(*args=(), **kwargs={'id': 'f56cec09-7b02-4e63-aad1-139e7eaa30be'})
 2001 (code, err_msg) = status
 2002 raise cfgm_common.exceptions.HttpError(code, err_msg)
 2003 response = handler(*args, **kwargs)
 2004 self._generate_rest_api_response_trace(trace, response)
 2005 response undefined handler = <functools.partial object>
args = () kwargs = {'id': 'f56cec09-7b02-4e63-aad1-139e7eaa30be'} /usr/lib/python2.7/site-packages/cfgm_common/vnc_api_stats.py in wrapper(api_server_obj=<vnc_cfg_api_server.vnc_cfg_api_server.VncApiServer object>, resource_type='service_group', *args=(), **kwargs={'id': 'f56cec09-7b02-4e63-aad1-139e7eaa30be'})
   15 statistics = VncApiStatistics(
   16 obj_type=resource_type.replace('-', '_'))
   17 response = func(api_server_obj, resource_type, *args, **kwargs)
   18 statistics.response_size = len(str(response))
   19 statistics.response_code = bottle.response.status_code response undefined func = <function http_resource_delete>
api_server_obj = <vnc_cfg_api_server.vnc_cfg_api_server.VncApiServer object>
resource_type = 'service_group'
args = ()
kwargs = {'id': 'f56cec09-7b02-4e63-aad1-139e7eaa30be'}
 /usr/lib/python2.7/site-packages/vnc_cfg_api_server/vnc_cfg_api_server.py in http_resource_delete(self=<vnc_cfg_api_server.vnc_cfg_api_server.VncApiServer object>, obj_type='service_group', id='f56cec09-7b02-4e63-aad1-139e7eaa30be')
 1143 # Permit abort resource deletion and retrun 202 status code
 1144 get_context().set_state('PENDING_DBE_DELETE')
 1145 ok, result = r_class.pending_dbe_delete(read_result)
 1146 if (not ok and isinstance(result, tuple) and result[0] == 409 and
 1147 isinstance(result[1], set)):
ok = True
result undefined
r_class = <class 'vnc_cfg_api_server.vnc_cfg_types.ServiceGroupServer'>
r_class.pending_dbe_delete = <bound method __metaclass__.pending_dbe_delete o...fg_api_server.vnc_cfg_types.ServiceGroupServer'>>
read_result = {'display_name': 'ctest-TestFirewallDraft_1-23019693-42513721', 'firewall_rule_back_refs': [{'attr': None, 'to': ['default-policy-management', 'ctest-TestFirewallDraft_1-23019693-52018482'], 'uuid': '15bdcc4a-2a20-402e-9c1f-e4a858197676'}], 'fq_name': ['default-policy-management', 'ctest-TestFirewallDraft_1-23019693-42513721'], 'id_perms': {'created': '2018-05-04T22:32:57.145428', 'creator': None, 'description': None, 'enable': True, 'last_modified': '2018-05-04T22:32:57.145428', 'permissions': {'group': 'admin', 'group_access': 7, 'other_access': 7, 'owner': 'contrail-api', 'owner_access': 7}, 'user_visible': True, 'uuid': {'uuid_lslong': 12308640828031119550L, 'uuid_mslong': 17684769362239704675L}}, 'parent_type': 'policy-management', 'parent_uuid': 'ecdad3df-0860-4472-a19a-3fa227a57934', 'perms2': {'global_access': 0, 'owner': 'cloud-admin', 'owner_access': 7, 'share': []}, 'service_group_firewall_service_list': {u'firewall_service': [{'dst_ports': {'end_port': 65535, 'start_port': 0}, 'protocol': 'icmp', 'protocol_id': 1, 'src_ports': {'end_port': 65535, 'start_port': 0}}]}, 'uuid': 'f56cec09-7b02-4e63-aad1-139e7eaa30be'}

 /usr/lib/python2.7/site-packages/vnc_cfg_api_server/vnc_cfg_types.py in wrapper(cls=<class 'vnc_cfg_api_server.vnc_cfg_types.ServiceGroupServer'>, obj_dict={'display_name': 'ctest-TestFirewallDraft_1-23019693-42513721', 'firewall_rule_back_refs': [{'attr': None, 'to': ['default-policy-management', 'ctest-TestFirewallDraft_1-23019693-52018482'], 'uuid': '15bdcc4a-2a20-402e-9c1f-e4a858197676'}], 'fq_name': ['default-policy-management', 'ctest-TestFirewallDraft_1-23019693-42513721'], 'id_perms': {'created': '2018-05-04T22:32:57.145428', 'creator': None, 'description': None, 'enable': True, 'last_modified': '2018-05-04T22:32:57.145428', 'permissions': {'group': 'admin', 'group_access': 7, 'other_access': 7, 'owner': 'contrail-api', 'owner_access': 7}, 'user_visible': True, 'uuid': {'uuid_lslong': 12308640828031119550L, 'uuid_mslong': 17684769362239704675L}}, 'parent_type': 'policy-management', 'parent_uuid': 'ecdad3df-0860-4472-a19a-3fa227a57934', 'perms2': {'global_access': 0, 'owner': 'cloud-admin', 'owner_access': 7, 'share': []}, 'service_group_firewall_service_list': {u'firewall_service': [{'dst_ports': {'end_port': 65535, 'start_port': 0}, 'protocol': 'icmp', 'protocol_id': 1, 'src_ports': {'end_port': 65535, 'start_port': 0}}]}, 'uuid': 'f56cec09-7b02-4e63-aad1-139e7eaa30be'}, *args=(), **kwargs={})
  251 draft_pm = result
  252
  253 return func(cls, draft_pm, obj_dict, *args, **kwargs)
  254 return wrapper
  255
func = <function pending_dbe_delete>
cls = <class 'vnc_cfg_api_server.vnc_cfg_types.ServiceGroupServer'>
draft_pm = {'display_name': 'draft-policy-management', 'firewall_rules': [{'to': ['draft-policy-management', 'ctest-TestFirewallDraft_1-23019693-52018482'], 'uuid': '2e4d0aec-8a5d-4ec5-82d3-1114a8b0f85b'}], 'fq_name': ['draft-policy-management'], 'id_perms': {'created': '2018-05-04T22:31:34.331215', 'creator': None, 'description': None, 'enable': True, 'last_modified': '2018-05-04T22:31:34.331215', 'permissions': {'group': 'cloud-admin-group', 'group_access': 7, 'other_access': 7, 'owner': 'cloud-admin', 'owner_access': 7}, 'user_visible': True, 'uuid': {'uuid_lslong': 11291817657827629788L, 'uuid_mslong': 9988897986560214114L}}, 'perms2': {'global_access': 0, 'owner': 'cloud-admin', 'owner_access': 7, 'share': []}, 'uuid': '8a9fb1cb-9a89-4462-9cb4-98554b4c9adc'}
obj_dict = {'display_name': 'ctest-TestFirewallDraft_1-23019693-42513721', 'firewall_rule_back_refs': [{'attr': None, 'to': ['default-policy-management', 'ctest-TestFirewallDraft_1-23019693-52018482'], 'uuid': '15bdcc4a-2a20-402e-9c1f-e4a858197676'}], 'fq_name': ['default-policy-management', 'ctest-TestFirewallDraft_1-23019693-42513721'], 'id_perms': {'created': '2018-05-04T22:32:57.145428', 'creator': None, 'description': None, 'enable': True, 'last_modified': '2018-05-04T22:32:57.145428', 'permissions': {'group': 'admin', 'group_access': 7, 'other_access': 7, 'owner': 'contrail-api', 'owner_access': 7}, 'user_visible': True, 'uuid': {'uuid_lslong': 12308640828031119550L, 'uuid_mslong': 17684769362239704675L}}, 'parent_type': 'policy-management', 'parent_uuid': 'ecdad3df-0860-4472-a19a-3fa227a57934', 'perms2': {'global_access': 0, 'owner': 'cloud-admin', 'owner_access': 7, 'share': []}, 'service_group_firewall_service_list': {u'firewall_service': [{'dst_ports': {'end_port': 65535, 'start_port': 0}, 'protocol': 'icmp', 'protocol_id': 1, 'src_ports': {'end_port': 65535, 'start_port': 0}}]}, 'uuid': 'f56cec09-7b02-4e63-aad1-139e7eaa30be'}
args = ()
kwargs = {}

 /usr/lib/python2.7/site-packages/vnc_cfg_api_server/vnc_cfg_types.py in pending_dbe_delete(cls=<class 'vnc_cfg_api_server.vnc_cfg_types.ServiceGroupServer'>, draft_pm={'display_name': 'draft-policy-management', 'firewall_rules': [{'to': ['draft-policy-management', 'ctest-TestFirewallDraft_1-23019693-52018482'], 'uuid': '2e4d0aec-8a5d-4ec5-82d3-1114a8b0f85b'}], 'fq_name': ['draft-policy-management'], 'id_perms': {'created': '2018-05-04T22:31:34.331215', 'creator': None, 'description': None, 'enable': True, 'last_modified': '2018-05-04T22:31:34.331215', 'permissions': {'group': 'cloud-admin-group', 'group_access': 7, 'other_access': 7, 'owner': 'cloud-admin', 'owner_access': 7}, 'user_visible': True, 'uuid': {'uuid_lslong': 11291817657827629788L, 'uuid_mslong': 9988897986560214114L}}, 'perms2': {'global_access': 0, 'owner': 'cloud-admin', 'owner_access': 7, 'share': []}, 'uuid': '8a9fb1cb-9a89-4462-9cb4-98554b4c9adc'}, obj_dict={'display_name': 'ctest-TestFirewallDraft_1-23019693-42513721', 'firewall_rule_back_refs': [{'attr': None, 'to': ['default-policy-management', 'ctest-TestFirewallDraft_1-23019693-52018482'], 'uuid': '15bdcc4a-2a20-402e-9c1f-e4a858197676'}], 'fq_name': ['default-policy-management', 'ctest-TestFirewallDraft_1-23019693-42513721'], 'id_perms': {'created': '2018-05-04T22:32:57.145428', 'creator': None, 'description': None, 'enable': True, 'last_modified': '2018-05-04T22:32:57.145428', 'permissions': {'group': 'admin', 'group_access': 7, 'other_access': 7, 'owner': 'contrail-api', 'owner_access': 7}, 'user_visible': True, 'uuid': {'uuid_lslong': 12308640828031119550L, 'uuid_mslong': 17684769362239704675L}}, 'parent_type': 'policy-management', 'parent_uuid': 'ecdad3df-0860-4472-a19a-3fa227a57934', 'perms2': {'global_access': 0, 'owner': 'cloud-admin', 'owner_access': 7, 'share': []}, 'service_group_firewall_service_list': {u'firewall_service': [{'dst_ports': {'end_port': 65535, 'start_port': 0}, 'protocol': 'icmp', 'protocol_id': 1, 'src_ports': {'end_port': 65535, 'start_port': 0}}]}, 'uuid': 'f56cec09-7b02-4e63-aad1-139e7eaa30be'})
  455 uuid = obj_dict['uuid']
  456 exist_refs = set()
  457 relaxed_refs = set(cls.db_conn.dbe_get_relaxed_refs(id))
  458
  459 for backref_field in cls.backref_fields:
relaxed_refs undefined
builtinset = <type 'set'>
cls = <class 'vnc_cfg_api_server.vnc_cfg_types.ServiceGroupServer'>
cls.db_conn = <vnc_cfg_api_server.vnc_db.VncDbClient object>
cls.db_conn.dbe_get_relaxed_refs = <bound method VncDbClient.dbe_get_relaxed_refs of <vnc_cfg_api_server.vnc_db.VncDbClient object>>
builtinid = <built-in function id>
 /usr/lib/python2.7/site-packages/vnc_cfg_api_server/vnc_db.py in get_relaxed_refs(self=<vnc_cfg_api_server.vnc_db.VncServerCassandraClient object>, obj_uuid=<built-in function id>)
  178 def get_relaxed_refs(self, obj_uuid):
  179 relaxed_cols = self.get(self._OBJ_UUID_CF_NAME, obj_uuid,
  180 start='relaxbackref:', finish='relaxbackref;')
  181 if not relaxed_cols:
  182 return []
start undefined
finish undefined

 /usr/lib/python2.7/site-packages/cfgm_common/vnc_cassandra.py in get(self=<vnc_cfg_api_server.vnc_db.VncServerCassandraClient object>, cf_name='obj_uuid_table', key=<built-in function id>, columns=None, start='relaxbackref:', finish='relaxbackref;')
  199 columns=columns,
  200 start=start,
  201 finish=finish)
  202 return result.get(key)
  203
finish = 'relaxbackref;'

 /usr/lib/python2.7/site-packages/cfgm_common/vnc_cassandra.py in multiget(self=<vnc_cfg_api_server.vnc_db.VncServerCassandraClient object>, cf_name='obj_uuid_table', keys=[<built-in function id>], columns=None, start='relaxbackref:', finish='relaxbackref;', timestamp=False, num_columns=None)
  220 column_finish=finish,
  221 include_timestamp=timestamp,
  222 column_count=column_count)
  223 except OverflowError:
  224 for key in keys:
column_count = 10000000

 /usr/lib/python2.7/site-packages/cfgm_common/vnc_cassandra.py in wrapper(*args=(<pycassa.columnfamily.ColumnFamily object>, [<built-in function id>]), **kwargs={'column_count': 10000000, 'column_finish': 'relaxbackref;', 'column_start': 'relaxbackref:', 'include_timestamp': False})
  512
  513 self.start_time = datetime.datetime.now()
  514 return func(*args, **kwargs)
  515 except (AllServersUnavailable, MaximumRetryException) as e:
  516 if self._conn_state != ConnectionStatus.DOWN:
func = <unbound method ColumnFamily.multiget>
args = (<pycassa.columnfamily.ColumnFamily object>, [<built-in function id>])
kwargs = {'column_count': 10000000, 'column_finish': 'relaxbackref;', 'column_start': 'relaxbackref:', 'include_timestamp': False}
 /usr/lib/python2.7/site-packages/pycassa/columnfamily.py in multiget(self=<pycassa.columnfamily.ColumnFamily object>, keys=[<built-in function id>], columns=None, column_start='relaxbackref:', column_finish='relaxbackref;', column_reversed=False, column_count=10000000, include_timestamp=False, super_column=None, read_consistency_level=None, buffer_size=None, include_ttl=False)
  759 """
  760
  761 packed_keys = map(self._pack_key, keys)
  762 cp = self._column_parent(super_column)
  763 sp = self._slice_predicate(columns, column_start, column_finish,
packed_keys undefined
builtinmap = <built-in function map>
self = <pycassa.columnfamily.ColumnFamily object> self._pack_key = <bound method ColumnFamily._pack_key of <pycassa.columnfamily.ColumnFamily object>>
keys = [<built-in function id>]

 /usr/lib/python2.7/site-packages/pycassa/columnfamily.py in _pack_key(self=<pycassa.columnfamily.ColumnFamily object>, key=<built-in function id>)
  486 return key
  487 try:
  488 return self._key_packer(key)
  489 except struct.error:
  490 d_type = self.key_validation_class self = <pycassa.columnfamily.ColumnFamily object>
self._key_packer = <function pack_bytes>
key = <built-in function id>

 /usr/lib/python2.7/site-packages/pycassa/marshal.py in pack_bytes(v=<built-in function id>, _=None)
  317 raise TypeError("A str or unicode value was expected, " +
  318 "but %s was received instead (%s)"
  319 % (v.__class__.__name__, str(v)))
  320 return v 321 return pack_bytes
v = <built-in function id>
v.__class__ = <type 'builtin_function_or_method'>
v.__class__.__name__ = 'builtin_function_or_method'
builtinstr = <type 'str'>
<type 'exceptions.TypeError'>: A str or unicode value was expected, but builtin_function_or_method was received instead (<built-in function id>)
    __class__ = <type 'exceptions.TypeError'>
    __delattr__ = <method-wrapper '__delattr__' of exceptions.TypeError object>
    __dict__ = {}
    __doc__ = 'Inappropriate argument type.'
    __format__ = <built-in method __format__ of exceptions.TypeError object>
    __getattribute__ = <method-wrapper '__getattribute__' of exceptions.TypeError object>
    __getitem__ = <method-wrapper '__getitem__' of exceptions.TypeError object>
    __getslice__ = <method-wrapper '__getslice__' of exceptions.TypeError object>
    __hash__ = <method-wrapper '__hash__' of exceptions.TypeError object>
    __init__ = <method-wrapper '__init__' of exceptions.TypeError object>
    __new__ = <built-in method __new__ of type object>
    __reduce__ = <built-in method __reduce__ of exceptions.TypeError object>
    __reduce_ex__ = <built-in method __reduce_ex__ of exceptions.TypeError object>
    __repr__ = <method-wrapper '__repr__' of exceptions.TypeError object>
    __setattr__ = <method-wrapper '__setattr__' of exceptions.TypeError object>
    __setstate__ = <built-in method __setstate__ of exceptions.TypeError object>
    __sizeof__ = <built-in method __sizeof__ of exceptions.TypeError object>
    __str__ = <method-wrapper '__str__' of exceptions.TypeError object>
    __subclasshook__ = <built-in method __subclasshook__ of type object>
    __unicode__ = <built-in method __unicode__ of exceptions.TypeError object>
    args = ('A str or unicode value was expected, but builtin...hod was received instead (<built-in function id>)',)
    message = 'A str or unicode value was expected, but builtin...hod was received instead (<built-in function id>)'

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/site-packages/vnc_cfg_api_server/vnc_cfg_api_server.py", line 2003, in handler_trap_exception
    response = handler(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/cfgm_common/vnc_api_stats.py", line 17, in wrapper
    response = func(api_server_obj, resource_type, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/vnc_cfg_api_server/vnc_cfg_api_server.py", line 1145, in http_resource_delete
    ok, result = r_class.pending_dbe_delete(read_result)
  File "/usr/lib/python2.7/site-packages/vnc_cfg_api_server/vnc_cfg_types.py", line 253, in wrapper
    return func(cls, draft_pm, obj_dict, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/vnc_cfg_api_server/vnc_cfg_types.py", line 457, in pending_dbe_delete
    relaxed_refs = set(cls.db_conn.dbe_get_relaxed_refs(id))
  File "/usr/lib/python2.7/site-packages/vnc_cfg_api_server/vnc_db.py", line 1375, in dbe_get_relaxed_refs
    return self._object_db.get_relaxed_refs(obj_id)
  File "/usr/lib/python2.7/site-packages/vnc_cfg_api_server/vnc_db.py", line 180, in get_relaxed_refs
    start='relaxbackref:', finish='relaxbackref;')
  File "/usr/lib/python2.7/site-packages/cfgm_common/vnc_cassandra.py", line 201, in get
    finish=finish)
  File "/usr/lib/python2.7/site-packages/cfgm_common/vnc_cassandra.py", line 222, in multiget
    column_count=column_count)
  File "/usr/lib/python2.7/site-packages/cfgm_common/vnc_cassandra.py", line 514, in wrapper
    return func(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/pycassa/columnfamily.py", line 761, in multiget
    packed_keys = map(self._pack_key, keys)
  File "/usr/lib/python2.7/site-packages/pycassa/columnfamily.py", line 488, in _pack_key
    return self._key_packer(key)
  File "/usr/lib/python2.7/site-packages/pycassa/marshal.py", line 319, in pack_bytes
    % (v.__class__.__name__, str(v)))
TypeError: A str or unicode value was expected, but builtin_function_or_method was received instead (<built-in function id>)

prasad miriyala (pmiriyala) wrote :

We are not able to delete any object, when policy configuration in draft mode.
Tried deleting APS and Policy object, doesn't get deleted and comes out with an error message box as follows for APS deletion

Delete Application Policy Set(s)
Error:Internal Server Error<br>

Review in progress for https://review.opencontrail.org/43089
Submitter: Édouard Thuleau (<email address hidden>)

Reviewed: https://review.opencontrail.org/43089
Committed: http://github.com/Juniper/contrail-controller/commit/2a96e42b81010e8cdfef9fe168ed929e6223efee
Submitter: Zuul v3 CI (<email address hidden>)
Branch: master

commit 2a96e42b81010e8cdfef9fe168ed929e6223efee
Author: Édouard Thuleau <email address hidden>
Date: Wed May 16 17:53:15 2018 +0200

[config] fail to delete resource with draft mode enabled

Typo was introduced in code to validate a resource does not have back-ref
before delete it when draft mode is enabled.

Change-Id: Ic39b472c0c5e547e2871a000c4f2ed34bce16bc2
Closes-Bug: #1769277

Review in progress for https://review.opencontrail.org/43438
Submitter: Édouard Thuleau (<email address hidden>)

information type: Proprietary → Public

Reviewed: https://review.opencontrail.org/43438
Committed: http://github.com/Juniper/contrail-controller/commit/0a5f4cc9ef8fd3b83e77d00a124130b59385fa0b
Submitter: Zuul v3 CI (<email address hidden>)
Branch: R5.0

commit 0a5f4cc9ef8fd3b83e77d00a124130b59385fa0b
Author: Édouard Thuleau <email address hidden>
Date: Wed May 16 17:53:15 2018 +0200

[config] fail to delete resource with draft mode enabled

Typo was introduced in code to validate a resource does not have back-ref
before delete it when draft mode is enabled.

Change-Id: Ic39b472c0c5e547e2871a000c4f2ed34bce16bc2
Closes-Bug: #1769277
(cherry picked from commit 2a96e42b81010e8cdfef9fe168ed929e6223efee)

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

Other bug subscribers