Validation for cinder volume type failed

Bug #1508017 reported by Khanh-Toan TRAN
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Sahara
Fix Released
High
Vitalii Gridnev
Liberty
Fix Released
High
Vitalii Gridnev
Mitaka
Fix Released
High
Vitalii Gridnev

Bug Description

Sahara does support cinder-volume type:

https://bugs.launchpad.net/sahara/+bug/1369574

However, the code is no longer valid. Indeed, it calls volume_types.list() with search_opts parameter which is actually not used in cinderclient. It results in all volume types which will fail the following check:

sahara/service/validations/base.py:

def check_volume_type_exists(volume_type):
    volume_types = cinder.client().volume_types.list(search_opts={'name':
                                                                  volume_type})
    if len(volume_types) == 1 and volume_types[0].name == volume_type:
        return
    raise ex.NotFoundException(volume_type, _("Volume type '%s' not found"))

Revision history for this message
Khanh-Toan TRAN (toan-tran) wrote :

The following patch works for us:

def check_volume_type_exists(volume_type):
    volume_types = cinder.client().volume_types.list()
    matched_volume_types = [vt for vt in volume_types if vt.name == volume_type]
    if len(matched_volume_types) >= 1:
        return
    raise ex.NotFoundException(volume_type, _("Volume type '%s' not found"))

Changed in sahara:
assignee: nobody → Khanh-Toan TRAN (toan-tran)
assignee: Khanh-Toan TRAN (toan-tran) → nobody
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to sahara (master)

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

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

Reviewed: https://review.openstack.org/240190
Committed: https://git.openstack.org/cgit/openstack/sahara/commit/?id=251b86b3f676817b9797788de20faaacb8a954d7
Submitter: Jenkins
Branch: master

commit 251b86b3f676817b9797788de20faaacb8a954d7
Author: Vitaly Gridnev <email address hidden>
Date: Thu Oct 29 13:24:14 2015 +0300

    Add additional filter to volume_type check

    Adding extra filter in volumes_type check
    as a workaround until the issue in cinder
    will be fixed.

    Change-Id: I9590b166072c7191fe079a3aa8b9263b1b212cdb
    Related-bug: 1508102
    Closes-bug: 1508017

Changed in sahara:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to sahara (stable/liberty)

Reviewed: https://review.openstack.org/242628
Committed: https://git.openstack.org/cgit/openstack/sahara/commit/?id=5c7b09d12c1fe6cf3cd7f6a19655e44e0161e2d8
Submitter: Jenkins
Branch: stable/liberty

commit 5c7b09d12c1fe6cf3cd7f6a19655e44e0161e2d8
Author: Vitaly Gridnev <email address hidden>
Date: Thu Oct 29 13:24:14 2015 +0300

    Add additional filter to volume_type check

    Adding extra filter in volumes_type check
    as a workaround until the issue in cinder
    will be fixed.

    Change-Id: I9590b166072c7191fe079a3aa8b9263b1b212cdb
    Related-bug: 1508102
    Closes-bug: 1508017
    (cherry picked from commit 251b86b3f676817b9797788de20faaacb8a954d7)

Changed in sahara:
status: Fix Committed → Fix Released
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.