create group with group type name raises exception

Bug #1654098 reported by Xing Yang
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
High
Xing Yang

Bug Description

When creating a group with a group type name, an exception was raised: "AttributeError: 'dict' object has no attribute 'id'". This is because group_types.get_group_type_by_name returns a
dictionary of a group type, not an object. req_group_type.id needs to be changed to req_group_type['id'].

Logs are here:

19192 2017-01-03 21:58:56.881 DEBUG cinder.api.v3.groups [req-645ba4fa-baf5-4890-9e2d-f2ec26564667 admin] Creating new group {u'group': {u'status': u'creating', u'user_id': None, u'name': u'gg', u' availability_zone': None, u'volume_types': [u'ThinType-6439'], u'project_id': None, u'group_type': u'group-type', u'description': None}} create /opt/stack/cinder/cinder/api/v3/groups.py:194
19193 2017-01-03 21:58:56.888 ERROR cinder.api.middleware.fault [req-645ba4fa-baf5-4890-9e2d-f2ec26564667 admin] Caught error: <type 'exceptions.AttributeError'> 'dict' object has no attribute 'id'
19194 2017-01-03 21:58:56.888 108699 ERROR cinder.api.middleware.fault Traceback (most recent call last):

19235 2017-01-03 21:58:56.888 108699 ERROR cinder.api.middleware.fault File "/opt/stack/cinder/cinder/api/openstack/wsgi.py", line 843, in __call__
19236 2017-01-03 21:58:56.888 108699 ERROR cinder.api.middleware.fault content_type, body, accept)
19237 2017-01-03 21:58:56.888 108699 ERROR cinder.api.middleware.fault File "/opt/stack/cinder/cinder/api/openstack/wsgi.py", line 902, in _process_stack
19238 2017-01-03 21:58:56.888 108699 ERROR cinder.api.middleware.fault action_result = self.dispatch(meth, request, action_args)
19239 2017-01-03 21:58:56.888 108699 ERROR cinder.api.middleware.fault File "/opt/stack/cinder/cinder/api/openstack/wsgi.py", line 997, in dispatch
19240 2017-01-03 21:58:56.888 108699 ERROR cinder.api.middleware.fault return method(req=request, **action_args)
19241 2017-01-03 21:58:56.888 108699 ERROR cinder.api.middleware.fault File "/opt/stack/cinder/cinder/api/openstack/wsgi.py", line 1163, in version_select
19242 2017-01-03 21:58:56.888 108699 ERROR cinder.api.middleware.fault return func.func(self, *args, **kwargs)
19243 2017-01-03 21:58:56.888 108699 ERROR cinder.api.middleware.fault File "/opt/stack/cinder/cinder/api/v3/groups.py", line 210, in create
19244 2017-01-03 21:58:56.888 108699 ERROR cinder.api.middleware.fault group_type = req_group_type.id
19245 2017-01-03 21:58:56.888 108699 ERROR cinder.api.middleware.fault AttributeError: 'dict' object has no attribute 'id'
19246 2017-01-03 21:58:56.888 108699 ERROR cinder.api.middleware.fault·

Xing Yang (xing-yang)
Changed in cinder:
assignee: nobody → Xing Yang (xing-yang)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

Fix proposed to branch: master
Review: https://review.openstack.org/416769

Changed in cinder:
status: New → In Progress
Xing Yang (xing-yang)
Changed in cinder:
importance: Undecided → High
milestone: none → ocata-3
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/416769
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=21365abd52979e0db18b113831528b9dd1a60220
Submitter: Jenkins
Branch: master

commit 21365abd52979e0db18b113831528b9dd1a60220
Author: xing-yang <email address hidden>
Date: Thu Nov 24 07:08:01 2016 -0500

    Fix create_group with group type name

    When creating a group with a group type name, an exception
    was raised: AttributeError: 'dict' object has no attribute 'id'
    This is because group_types.get_group_type_by_name returns a
    dictionary of a group type, not an object. This patch fixes it.

    Change-Id: I36c0ccd6262dfb392241b2898f57ecaef5dc5162
    Closes-Bug: #1654098

Changed in cinder:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/cinder 10.0.0.0b3

This issue was fixed in the openstack/cinder 10.0.0.0b3 development milestone.

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.