Create volume failed because of volume type name

Bug #1794237 reported by Guangfeng Su
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Undecided
Yikun Jiang

Bug Description

I create a volume type, then create a volume using the volume type, eventually create failed.

When the volume type name is defined in the uuid format, an error is reported.
Error is as follows:
ERROR: Volume type 64cc00e2-168c-4190-afaa-48d680d2ac89 could not be found. (HTTP 404) (Request-ID: req-ed7cae1e-63f0-4abe-b750-48247e8ddb3b)

The steps are as follows:
1. Creating a volume type
[root@node01 nova]# cinder type-create 64cc00e2-168c-4190-afaa-48d680d2ac89
+--------------------------------------+--------------------------------------+-------------+-----------+
| ID | Name | Description | Is_Public |
+--------------------------------------+--------------------------------------+-------------+-----------+
| 29e5c288-613f-4033-a30c-3e655494653d | 64cc00e2-168c-4190-afaa-48d680d2ac89 | - | True |
+--------------------------------------+--------------------------------------+-------------+-----------+

2. Setting the volume backend for the volume type
[root@node01 nova]# cinder type-key 64cc00e2-168c-4190-afaa-48d680d2ac89 set volume_backend_name='lvmdriver-1'
[root@node01 nova]# cinder extra-specs-list
+--------------------------------------+--------------------------------------+----------------------------------------+
| ID | Name | extra_specs |
+--------------------------------------+--------------------------------------+----------------------------------------+
| 29e5c288-613f-4033-a30c-3e655494653d | 64cc00e2-168c-4190-afaa-48d680d2ac89 | {'volume_backend_name': 'lvmdriver-1'} |

3.Creating a volume failed because of using the volume type name

[root@node01 nova]# cinder create --volume-type 64cc00e2-168c-4190-afaa-48d680d2ac89 --name sogof 1
ERROR: Volume type 64cc00e2-168c-4190-afaa-48d680d2ac89 could not be found. (HTTP 404) (Request-ID: req-ed7cae1e-63f0-4abe-b750-48247e8ddb3b)

4. But creating a volume success with using the volume type id, as the same volume type above setp 3.
[root@node01 nova]# cinder create --volume-type 29e5c288-613f-4033-a30c-3e655494653d --name sogof 1
+--------------------------------+--------------------------------------+
| Property | Value |
+--------------------------------+--------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable | false |
| consistencygroup_id | None |
| created_at | 2018-09-25T06:26:36.000000 |
| description | None |
| encrypted | False |
| id | 755d52f3-93fe-4e65-ba14-89fdb6068a89 |
| metadata | {} |
| migration_status | None |
| multiattach | False |
| name | sogof |
| os-vol-host-attr:host | None |
| os-vol-mig-status-attr:migstat | None |
| os-vol-mig-status-attr:name_id | None |
| os-vol-tenant-attr:tenant_id | 90b4ae28c9874e6394e428250705ee12 |
| replication_status | None |
| size | 1 |
| snapshot_id | None |
| source_volid | None |
| status | creating |
| updated_at | None |
| user_id | 27c9af73a62a4eee81ef9f0e83ce61f6 |
| volume_type | 64cc00e2-168c-4190-afaa-48d680d2ac89 |
+--------------------------------+--------------------------------------+

[root@node01 nova]# cinder list | grep sogof
| 755d52f3-93fe-4e65-ba14-89fdb6068a89 | available | sogof | 1 | 64cc00e2-168c-4190-afaa-48d680d2ac89 | false |

Guangfeng Su (sogof)
Changed in cinder:
assignee: nobody → Guangfeng Su (sogof)
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/605020

Changed in cinder:
status: New → In Progress
Changed in cinder:
assignee: Guangfeng Su (sogof) → Yikun Jiang (yikunkero)
Yikun Jiang (yikunkero)
Changed in cinder:
assignee: Yikun Jiang (yikunkero) → nobody
assignee: nobody → Yikun Jiang (yikunkero)
assignee: Yikun Jiang (yikunkero) → nobody
Guangfeng Su (sogof)
Changed in cinder:
assignee: nobody → Guangfeng Su (sogof)
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/605666

Changed in cinder:
assignee: Guangfeng Su (sogof) → Yikun Jiang (yikunkero)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/605020
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=f037d6a264a78740f915d5a07db00689f069fd73
Submitter: Zuul
Branch: master

commit f037d6a264a78740f915d5a07db00689f069fd73
Author: suguangfeng <email address hidden>
Date: Tue Sep 25 04:55:48 2018 -0400

    Fix wrong NotFound in get_by_name_or_id

    When we create or retype a volume using the volume type which
    has a uuid format type name, the operation would be failed and
    raise a 404 error.

    There are a uuid check in "get_by_name_or_id()", and the
    uuid-like type name would be mistakenly recognized as a id,
    will use "get_volume_type"(by_id) to get volume type .

    So, this patch try to fix this error, if we can't find a
    type by uuid, we need call "get_volume_type_by_name" to check
    again if we can get this type by name.

    Co-Authored-By: Yikun Jiang <email address hidden>

    Closes-Bug: #1794237
    Change-Id: I83f12a5b858aced117286e8d2dee717d14dbdba6

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

Reviewed: https://review.openstack.org/605666
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=0b8b3a4b47b29d43ff93ff92fbef7036f19e3540
Submitter: Zuul
Branch: master

commit 0b8b3a4b47b29d43ff93ff92fbef7036f19e3540
Author: Yikun Jiang <email address hidden>
Date: Thu Sep 27 19:08:25 2018 +0800

    Fix wrong uuid recognized when create group

    We can't create a group with a uuid format name volume type,
    there is a uuid check in "volume_types_get_by_name_or_id()",
    and the uuid-like type name would be mistakenly recognized as
    a id, finally, it will use "get_volume_type"(by_id) to get
    volume type and cause a 404 error.

    So, this patch try to fix this error, if we can't find a
    type by uuid, we need call "_volume_type_get_by_name" to check
    again can we get this type by name.

    Change-Id: Id09230bffc0ad83093bb6254b2e09aca5d1c58b1
    Closes-bug: #1794716
    Related-bug: #1794237

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

Related fix proposed to branch: stable/rocky
Review: https://review.openstack.org/639752

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

This issue was fixed in the openstack/cinder 14.0.0.0rc1 release candidate.

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

Reviewed: https://review.openstack.org/639752
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=77d54c2124c27e1fda4fc1ca679021747560c6a0
Submitter: Zuul
Branch: stable/rocky

commit 77d54c2124c27e1fda4fc1ca679021747560c6a0
Author: Yikun Jiang <email address hidden>
Date: Thu Sep 27 19:08:25 2018 +0800

    Fix wrong uuid recognized when create group

    We can't create a group with a uuid format name volume type,
    there is a uuid check in "volume_types_get_by_name_or_id()",
    and the uuid-like type name would be mistakenly recognized as
    a id, finally, it will use "get_volume_type"(by_id) to get
    volume type and cause a 404 error.

    So, this patch try to fix this error, if we can't find a
    type by uuid, we need call "_volume_type_get_by_name" to check
    again can we get this type by name.

    Change-Id: Id09230bffc0ad83093bb6254b2e09aca5d1c58b1
    Closes-bug: #1794716
    Related-bug: #1794237
    (cherry picked from commit 0b8b3a4b47b29d43ff93ff92fbef7036f19e3540)

tags: added: in-stable-rocky
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.