Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1103500

Summary: Can't change a volume's type from None
Product: Red Hat OpenStack Reporter: Yogev Rabl <yrabl>
Component: openstack-cinderAssignee: Eric Harney <eharney>
Status: CLOSED ERRATA QA Contact: Yogev Rabl <yrabl>
Severity: medium Docs Contact:
Priority: high    
Version: 5.0 (RHEL 7)CC: ddomingo, eharney, nlevinki, scohen, sgotliv, tshefi, yeylon
Target Milestone: rc   
Target Release: 5.0 (RHEL 7)   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: storage
Fixed In Version: openstack-cinder-2014.1-6.el7ost Doc Type: Bug Fix
Doc Text:
With this release, you can now use the 'retype' subcommand to set a volume's type after creating the volume with a type of 'None'.
Story Points: ---
Clone Of:
: 1115615 (view as bug list) Environment:
Last Closed: 2014-07-08 15:31:22 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1115615    

Description Yogev Rabl 2014-06-01 15:01:31 UTC
Description of problem:
Currently, cinder api v2 allows a user to change the type of a volume from type A to type B. But when I ran the command:
# cinder --os-volume-api-version 2 retype <volume-id> <type> 
on a volume without a type, I get the error: 

2014-06-01 17:55:23.152 3670 ERROR oslo.messaging.rpc.dispatcher [req-e6353b14-dead-4706-9c24-22fa5313baa2 0ef6c647596e4390bedc8e48715a23c0 8a03084ee552416c8eea143d33397295 - - -] Exception during message handling: Invalid volume type: id cannot be None
2014-06-01 17:55:23.152 3670 TRACE oslo.messaging.rpc.dispatcher Traceback (most recent call last):
2014-06-01 17:55:23.152 3670 TRACE oslo.messaging.rpc.dispatcher   File "/usr/lib/python2.7/site-packages/oslo/messaging/rpc/dispatcher.py", line 133, in _dispatch_and_reply
2014-06-01 17:55:23.152 3670 TRACE oslo.messaging.rpc.dispatcher     incoming.message))
2014-06-01 17:55:23.152 3670 TRACE oslo.messaging.rpc.dispatcher   File "/usr/lib/python2.7/site-packages/oslo/messaging/rpc/dispatcher.py", line 176, in _dispatch
2014-06-01 17:55:23.152 3670 TRACE oslo.messaging.rpc.dispatcher     return self._do_dispatch(endpoint, method, ctxt, args)
2014-06-01 17:55:23.152 3670 TRACE oslo.messaging.rpc.dispatcher   File "/usr/lib/python2.7/site-packages/oslo/messaging/rpc/dispatcher.py", line 122, in _do_dispatch
2014-06-01 17:55:23.152 3670 TRACE oslo.messaging.rpc.dispatcher     result = getattr(endpoint, method)(ctxt, **new_args)
2014-06-01 17:55:23.152 3670 TRACE oslo.messaging.rpc.dispatcher   File "/usr/lib/python2.7/site-packages/cinder/volume/manager.py", line 1224, in retype
2014-06-01 17:55:23.152 3670 TRACE oslo.messaging.rpc.dispatcher     context, volume_ref.get('volume_type_id'), new_type_id)
2014-06-01 17:55:23.152 3670 TRACE oslo.messaging.rpc.dispatcher   File "/usr/lib/python2.7/site-packages/cinder/volume/volume_types.py", line 220, in volume_types_diff
2014-06-01 17:55:23.152 3670 TRACE oslo.messaging.rpc.dispatcher     vol_type1 = get_volume_type(context, vol_type_id1)
2014-06-01 17:55:23.152 3670 TRACE oslo.messaging.rpc.dispatcher   File "/usr/lib/python2.7/site-packages/cinder/volume/volume_types.py", line 100, in get_volume_type
2014-06-01 17:55:23.152 3670 TRACE oslo.messaging.rpc.dispatcher     raise exception.InvalidVolumeType(reason=msg)
2014-06-01 17:55:23.152 3670 TRACE oslo.messaging.rpc.dispatcher InvalidVolumeType: Invalid volume type: id cannot be None
2014-06-01 17:55:23.152 3670 TRACE oslo.messaging.rpc.dispatcher 
2014-06-01 17:55:23.154 3670 ERROR oslo.messaging._drivers.common [req-e6353b14-dead-4706-9c24-22fa5313baa2 0ef6c647596e4390bedc8e48715a23c0 8a03084ee552416c8eea143d33397295 - - -] Returning exception Invalid volume type: id cannot be None to caller


Version-Release number of selected component (if applicable):
openstack-cinder-2014.1-3.1.el7ost.noarch
python-cinder-2014.1-3.1.el7ost.noarch
python-cinderclient-1.0.8-1.el7ost.noarch

How reproducible:
100%

Steps to Reproduce:
1. create a volume without a type.
2. create a type.
3. retype the volume with the command: 
# cinder --os-volume-api-version 2 retype <volume-id> <type>

Actual results:
An Error appears in the cinder's volume.log & the volume status is stuck on retyping.

Expected results:
The volume's type will change to the targeted volume.

Additional info:

Comment 2 Tzach Shefi 2014-06-25 10:13:49 UTC
Verified on: 
RHEL7
openstack-cinder-2014.1-6.el7ost.noarch

Created new volume without type
Created new volume type
Set volume's type via api v2 

Volume type was updated successfully. 
Checked that volume type indeed updated via CLI as well as Horizon. 


root@cougar09 ~(keystone_admin)]# cinder show bf90fa77-1b80-4c72-854b-46367f9caf46
+--------------------------------+--------------------------------------+
|            Property            |                Value                 |
+--------------------------------+--------------------------------------+
|          attachments           |                  []                  |
|       availability_zone        |                 nova                 |
|            bootable            |                false                 |
|           created_at           |      2014-06-25T10:03:13.000000      |
|      display_description       |         basic sanity testing         |
|          display_name          |              tshefivol1              |
|           encrypted            |                False                 |
|               id               | bf90fa77-1b80-4c72-854b-46367f9caf46 |
|            metadata            |                  {}                  |
|     os-vol-host-attr:host      |   cougar09.scl.lab.tlv.redhat.com    |
| os-vol-mig-status-attr:migstat |                 None                 |
| os-vol-mig-status-attr:name_id |                 None                 |
|  os-vol-tenant-attr:tenant_id  |   56a39e85fdca4efe8435fb4be8970885   |
|              size              |                  1                   |
|          snapshot_id           |                 None                 |
|          source_volid          |                 None                 |
|             status             |              available               |
|          volume_type           |                 None                 |
+--------------------------------+--------------------------------------+
[root@cougar09 ~(keystone_admin)]# cinder --os-volume-api-version 2 retype bf90fa77-1b80-4c72-854b-46367f9caf46 ssdvol
[root@cougar09 ~(keystone_admin)]# cinder show bf90fa77-1b80-4c72-854b-46367f9caf46
+--------------------------------+--------------------------------------+
|            Property            |                Value                 |
+--------------------------------+--------------------------------------+
|          attachments           |                  []                  |
|       availability_zone        |                 nova                 |
|            bootable            |                false                 |
|           created_at           |      2014-06-25T10:03:13.000000      |
|      display_description       |         basic sanity testing         |
|          display_name          |              tshefivol1              |
|           encrypted            |                False                 |
|               id               | bf90fa77-1b80-4c72-854b-46367f9caf46 |
|            metadata            |                  {}                  |
|     os-vol-host-attr:host      |   cougar09.scl.lab.tlv.redhat.com    |
| os-vol-mig-status-attr:migstat |                 None                 |
| os-vol-mig-status-attr:name_id |                 None                 |
|  os-vol-tenant-attr:tenant_id  |   56a39e85fdca4efe8435fb4be8970885   |
|              size              |                  1                   |
|          snapshot_id           |                 None                 |
|          source_volid          |                 None                 |
|             status             |              available               |
|          volume_type           |                ssdvol                |
+--------------------------------+--------------------------------------+

Comment 5 errata-xmlrpc 2014-07-08 15:31:22 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHEA-2014-0852.html