create volume with multiattach > NoneType has no attribute get

Bug #1683431 reported by Steve Noyes
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Undecided
wangxiyuan

Bug Description

When you try to create volume with --allow-multiattach and with no volume_type specified (defaults to None), the filter-scheduler hits this exception:

^[[01;31m2017-04-17 12:13:49.923 TRACE oslo_messaging.rpc.server ^[[01;35m^[[00m File "/opt/stack/cinder/cinder/scheduler/filter_scheduler.py", line 90, in schedule_create_volume^M
^[[01;31m2017-04-17 12:13:49.923 TRACE oslo_messaging.rpc.server ^[[01;35m^[[00m backend = self._schedule(context, request_spec, filter_properties)^M
^[[01;31m2017-04-17 12:13:49.923 TRACE oslo_messaging.rpc.server ^[[01;35m^[[00m File "/opt/stack/cinder/cinder/scheduler/filter_scheduler.py", line 508, in _schedule^M
^[[01;31m2017-04-17 12:13:49.923 TRACE oslo_messaging.rpc.server ^[[01;35m^[[00m filter_properties)^M
^[[01;31m2017-04-17 12:13:49.923 TRACE oslo_messaging.rpc.server ^[[01;35m^[[00m File "/opt/stack/cinder/cinder/scheduler/filter_scheduler.py", line 305, in _get_weighted_candidates^M
^[[01;31m2017-04-17 12:13:49.923 TRACE oslo_messaging.rpc.server ^[[01;35m^[[00m if multiattach and 'multiattach' not in resource_type.get(^M
^[[01;31m2017-04-17 12:13:49.923 TRACE oslo_messaging.rpc.server ^[[01;35m^[[00mAttributeError: 'NoneType' object has no attribute 'get'^M

The problem is in this code in scheduler/filter_scheduler.py:

        volume_type = resource_type = request_spec.get("volume_type")
...
303 >>>> if multiattach and 'multiattach' not in resource_type.get(
                'extra_specs', {}):

/opt/stack/cinder$ git show
commit 40076180928405dd9ce3e2369d265977968732a5
Merge: 22777e5 1347602
Author: Jenkins <email address hidden>
Date: Thu Apr 13 20:14:33 2017 +0000

    Merge "Tests: mock psutil usage in quobyte tests"

Revision history for this message
Steve Noyes (steve-noyes) wrote :

The workaround is to specify a volume type.

wangxiyuan (wangxiyuan)
Changed in cinder:
assignee: nobody → wangxiyuan (wangxiyuan)
status: New → Confirmed
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/457431

Changed in cinder:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

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

commit a58f66e180333ace479983e1287a62793bbd26aa
Author: wangxiyuan <email address hidden>
Date: Tue Apr 18 09:56:29 2017 +0800

    Fix NoneType has no attribute get

    If volume_type is None and then create volumes with allow-multiattach,
    Cinder-schduler will raise error:

    AttributeError: 'NoneType' object has no attribute 'get'

    Change-Id: Ied42d13b642617dd239ea92c019354b90657821a
    Closes-bug: #1683431

Changed in cinder:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to cinder (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/471672

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/cinder 11.0.0.0b2

This issue was fixed in the openstack/cinder 11.0.0.0b2 development milestone.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to cinder (master)

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

commit f3d66c3254f7a5424be4088dfa767f128ae6cfc3
Author: wangxiyuan <email address hidden>
Date: Wed Jun 7 17:07:56 2017 +0800

    Fix NoneType has no attribute get error

    If volume_type is None and then create volumes with allow-multiattach,
    Cinder-schduler will raise error:
    AttributeError: 'NoneType' object has no attribute 'get'

    Ied42d13b642617dd239ea92c019354b90657821a didn't fix it completely.
    The error still exists. Here is the reproduce command:
    "cinder create 1 ----allow-multiattach"

    Because that the volume_type is always in the "request_spec", if
    users doesn't pass it, its value is None.

    Change-Id: I1140234dd69a644dcbf6fc3a01f382ee101624b2
    Related-bug: #1683431

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (stable/ocata)

Fix proposed to branch: stable/ocata
Review: https://review.openstack.org/518673

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to cinder (stable/ocata)

Related fix proposed to branch: stable/ocata
Review: https://review.openstack.org/518674

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on cinder (stable/ocata)

Change abandoned by Xiaojun Liao (<email address hidden>) on branch: stable/ocata
Review: https://review.openstack.org/518673

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Change abandoned by Xiaojun Liao (<email address hidden>) on branch: stable/ocata
Review: https://review.openstack.org/518674

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Change abandoned by Xiaojun Liao (<email address hidden>) on branch: stable/ocata
Review: https://review.openstack.org/518673

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Change abandoned by Xiaojun Liao (<email address hidden>) on branch: stable/ocata
Review: https://review.openstack.org/518674

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Change abandoned by Xiaojun Liao (<email address hidden>) on branch: stable/ocata
Review: https://review.openstack.org/518673

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (stable/ocata)

Reviewed: https://review.openstack.org/518673
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=8a0c155a9890efd28064da9173086e60579e3121
Submitter: Zuul
Branch: stable/ocata

commit 8a0c155a9890efd28064da9173086e60579e3121
Author: wangxiyuan <email address hidden>
Date: Tue Apr 18 09:56:29 2017 +0800

    Fix NoneType has no attribute get

    If volume_type is None and then create volumes with allow-multiattach,
    Cinder-schduler will raise error:

    AttributeError: 'NoneType' object has no attribute 'get'

    Change-Id: Ied42d13b642617dd239ea92c019354b90657821a
    Closes-bug: #1683431
    (cherry picked from commit a58f66e180333ace479983e1287a62793bbd26aa)

tags: added: in-stable-ocata
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/cinder 10.0.7

This issue was fixed in the openstack/cinder 10.0.7 release.

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.