Create volume without volume type failed

Bug #1610073 reported by Tina Tang
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
High
Eric Harney

Bug Description

Creating volume without volume type failed due to the exception thrown in Scheduler:

2016-08-04 20:37:32.183 203920 ERROR cinder.scheduler.manager Traceback (most recent call last):
2016-08-04 20:37:32.183 203920 ERROR cinder.scheduler.manager File "/usr/local/lib/python2.7/dist-packages/taskflow/engines/action_engine/executor.py", line 53, in _execute_task
2016-08-04 20:37:32.183 203920 ERROR cinder.scheduler.manager result = task.execute(**arguments)
2016-08-04 20:37:32.183 203920 ERROR cinder.scheduler.manager File "/opt/stack/cinder/cinder/scheduler/flows/create_volume.py", line 146, in execute
2016-08-04 20:37:32.183 203920 ERROR cinder.scheduler.manager reason=e)
2016-08-04 20:37:32.183 203920 ERROR cinder.scheduler.manager File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
2016-08-04 20:37:32.183 203920 ERROR cinder.scheduler.manager self.force_reraise()
2016-08-04 20:37:32.183 203920 ERROR cinder.scheduler.manager File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
2016-08-04 20:37:32.183 203920 ERROR cinder.scheduler.manager six.reraise(self.type_, self.value, self.tb)
2016-08-04 20:37:32.183 203920 ERROR cinder.scheduler.manager File "/opt/stack/cinder/cinder/scheduler/flows/create_volume.py", line 126, in execute
2016-08-04 20:37:32.183 203920 ERROR cinder.scheduler.manager filter_properties)
2016-08-04 20:37:32.183 203920 ERROR cinder.scheduler.manager File "/opt/stack/cinder/cinder/scheduler/filter_scheduler.py", line 86, in schedule_create_volume
2016-08-04 20:37:32.183 203920 ERROR cinder.scheduler.manager filter_properties)
2016-08-04 20:37:32.183 203920 ERROR cinder.scheduler.manager File "/opt/stack/cinder/cinder/scheduler/filter_scheduler.py", line 416, in _schedule
2016-08-04 20:37:32.183 203920 ERROR cinder.scheduler.manager filter_properties)
2016-08-04 20:37:32.183 203920 ERROR cinder.scheduler.manager File "/opt/stack/cinder/cinder/scheduler/filter_scheduler.py", line 275, in _get_weighted_candidates
2016-08-04 20:37:32.183 203920 ERROR cinder.scheduler.manager raise exception.InvalidVolumeType(reason=msg)
2016-08-04 20:37:32.183 203920 ERROR cinder.scheduler.manager InvalidVolumeType: Invalid volume type: volume_type cannot be None

Reproduce Step:
1. Ensure the 'default_volume_type' is not configured in cinder.conf

2. Create a volume without specify the volume type
     stack@ubuntu-server7:~/devstack$ cinder create --name vol-wo-type 3
+--------------------------------+--------------------------------------+
| Property | Value |
+--------------------------------+--------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable | false |
| consistencygroup_id | None |
| created_at | 2016-08-05T00:37:31.000000 |
| description | None |
| encrypted | False |
| id | 775db6ca-feac-4e85-ba9b-158264a91d68 |
| metadata | {} |
| migration_status | None |
| multiattach | False |
| name | vol-wo-type |
| 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 | 037876c7d6464d71aa4761b33dcba42a |
| replication_status | disabled |
| size | 3 |
| snapshot_id | None |
| source_volid | None |
| status | creating |
| updated_at | None |
| user_id | d7521073c53e4c98a8b8a86dd62f5abd |
| volume_type | None

3. Check that the new created volume will be in error status
    stack@ubuntu-server7:/opt/stack/logs$ cinder show vol-wo-type | grep status
| migration_status | None |
| os-vol-mig-status-attr:migstat | None |
| os-vol-mig-status-attr:name_id | None |
| replication_status | disabled |
| status | error |

Version:
This issue is only seen with the latest code (newer than Aug. 2st)
stack@ubuntu-server7:/opt/stack/cinder$ git log -1
commit 5fdfe1f69977e061ecae5526016343d631d10a70
Merge: 1681672 0cbb34c
Author: Jenkins <email address hidden>
Date: Thu Aug 4 14:59:50 2016 +0000

    Merge "Imported Translations from Zanata"

Tina Tang (tina-tang)
description: updated
Revision history for this message
Tina Tang (tina-tang) wrote :

Whether the volume without volume type is supported by Cinder? The exception message "volume_type cannot be None" confused me. Waiting for this issue to be triaged.

Seems to me, this is valid case, and it is supported for a long time. If the cinder doesn't want to support this case anymore, it should failed in the Cinder-API instead of Cinder Scheduler.

Also, I have checked the change log, this behavior is introduced in change: L750
https://review.openstack.org/#/c/246600/43/cinder/volume/flows/api/create_volume.py

Changed in cinder:
status: New → Confirmed
importance: Undecided → High
Revision history for this message
Karthik Prabhu Vinod (karthik-prabhu-vinod) wrote :

By debugging i Found that the problem precedes

https://github.com/openstack/cinder/blob/master/cinder/volume/flows/api/create_volume.py#L748

The **kwargs there does not contain the volume_type. I believe there is a problem with api code somewhere.

Revision history for this message
Tina Tang (tina-tang) wrote :

Not sure whether I am using the same version with Karthik. When I saw this issue, the **kwargs does include the volume_type. And the volume_type is an empty list. Thus the check on L752 is false.

https://github.com/openstack/cinder/blob/master/cinder/volume/flows/api/create_volume.py#L752

Please see the debug trace:
-> kwargs['volume_type'] = None
(Pdb) l
747
748 def execute(self, context, **kwargs):
749 scheduler_hints = kwargs.pop('scheduler_hints', None)
750 db_vt = kwargs.pop('volume_type')
751 import pdb; pdb.set_trace()
752 -> kwargs['volume_type'] = None
753 if db_vt:
754 kwargs['volume_type'] = objects.VolumeType()
755 objects.VolumeType()._from_db_object(context,
756 kwargs['volume_type'], db_vt)
757 request_spec = objects.RequestSpec(**kwargs)
(Pdb) db_vt
{}

Revision history for this message
Wenjun Wang (wangwenjun) wrote :

I think the point is why not set 'default_volume_type' in your first step.

the code about default type as link:
https://github.com/openstack/cinder/blob/master/cinder/volume/volume_types.py#L134

the value will be 'None' if we don't set 'default_volume_type' in cinder.conf,
and the 'default_volume_type' will be set by devstack as follow when env is deployed:
default_volume_type = lvmdriver-1

the conclusion is 'default_volume_type' must be set in cinder.conf.

Wenjun Wang (wangwenjun)
Changed in cinder:
status: Confirmed → Opinion
Revision history for this message
Alfredo Moralejo (amoralej) wrote :

I think changing the behavior of the service in a non-backwards compatible mode must be understood as a bug unless there is a clear reason to change it. In that case it should be reported accordingly in release notes for the change.

In this case, cinder is clearly changing the behavior of cinder for a particular use-case.

Note devstack is only one of the existing deployment tools for OpenStack, but other tools may do it in a different way. In my case, packstack has not been setting default_volume_type in the past but cinder worked fine.

Revision history for this message
Scott DAngelo (scott-dangelo) wrote :

This is definitely a bug. It is a regression from previous behaviour when not setting a default volume type in cinder.CONF allowed a volume to be created.

Changed in cinder:
status: Opinion → 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/353120

Changed in cinder:
assignee: nobody → Karthik Prabhu Vinod (karthik-prabhu-vinod)
status: Confirmed → In Progress
Changed in tripleo:
status: New → Confirmed
importance: Undecided → High
milestone: none → newton-3
assignee: nobody → James Slagle (james-slagle)
milestone: newton-3 → none
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to tripleo-heat-templates (master)

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

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

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on tripleo-heat-templates (master)

Change abandoned by Emilien Macchi (<email address hidden>) on branch: master
Review: https://review.openstack.org/353645

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/353665

Changed in cinder:
assignee: Karthik Prabhu Vinod (karthik-prabhu-vinod) → Eric Harney (eharney)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on cinder (master)

Change abandoned by Karthik Prabhu Vinod (<email address hidden>) on branch: master
Review: https://review.openstack.org/353120
Reason: Abandoning as this has been fixed in another change

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

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

commit 9abeca399e3e006e1ac6e8df2ba89b007cd93eac
Author: Eric Harney <email address hidden>
Date: Wed Aug 10 13:14:45 2016 -0400

    Fix volume creation with no volume type

    Allow creation of volumes with no volume type. This
    has always been supported but was accidentally broken
    with recent changes.

    If a type is not specified, the capabilities filter can
    skip processing type-related checks.

    This reverts most of 8a594c8 "Fix NoneType Attribute Error"

    Closes-Bug: #1610073
    Co-Author: Tom Barron <email address hidden>
    Change-Id: I7cb8435af379099c60f0f84d7bad4a6660d2d636

Changed in cinder:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on tripleo-heat-templates (master)

Change abandoned by Giulio Fidente (<email address hidden>) on branch: master
Review: https://review.openstack.org/353644
Reason: resolved in cinder by https://review.openstack.org/#/c/353665/

no longer affects: tripleo
Revision history for this message
Thierry Carrez (ttx) wrote : Fix included in openstack/cinder 9.0.0.0b3

This issue was fixed in the openstack/cinder 9.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.