cinder list returned empty volume_image_metadata

Bug #1680122 reported by wangxiyuan
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Undecided
wangxiyuan
tempest
Invalid
Undecided
wangxiyuan

Bug Description

This bug is found by tempest test when I use use local user to run the tempest test:

reproduce:
1. make sure to use the local user

tempest.conf:
[auth]
use_dynamic_credentials = False
test_accounts_file = /opt/stack/tempest/test_auth.yaml

test_auth.yaml:
- domain_name: Default
  password: root
  project_name: admin
  resources:
    network: 72b815a6-68ad-4cf4-8b23-6b3fee758f44
  username: admin

2. Make sure there are some volumes in Cinder already, and one of the volumes is created from image at least.

3.run the test: tempest.api.volume.test_volumes_list.VolumesListTestJSON.test_volume_list_with_details
this test will fail.

The reason is that Cinder returned "volume_image_metadata" for each volume even the volume doesn't contain "volume_image_metadata" property. (it will return "volume_image_metadata": {} )

But cinder show {volume_id} doesn't return "volume_image_metadata": {} for an unbootable volume.

So the response body format is not the same between list and show API

We should drop the empty volume_image_metadata for cinder list IMO.

Error tests:
tempest.api.volume.test_volumes_list.VolumesV2ListTestJSON.test_volume_list_with_details
tempest.api.volume.test_volumes_list.VolumesV2ListTestJSON.test_volumes_list_details_by_availability_zone
tempest.api.volume.test_volumes_list.VolumesV2ListTestJSON.test_volumes_list_details_by_status
tempest.api.volume.test_volumes_list.VolumesV2ListTestJSON.test_volumes_list_details_by_bootable

wangxiyuan (wangxiyuan)
Changed in cinder:
assignee: nobody → wangxiyuan (wangxiyuan)
affects: cinder → tempest
Changed in tempest:
assignee: wangxiyuan (wangxiyuan) → nobody
affects: tempest → cinder
Changed in cinder:
assignee: nobody → wangxiyuan (wangxiyuan)
Revision history for this message
wangxiyuan (wangxiyuan) wrote :

add tempest as well. I'm not sure if this is a tempest bug.

Revision history for this message
Ghanshyam Mann (ghanshyammann) wrote :

yes, cinder seems to omit "volume_image_metadata" in SHOW API if no image metadata passed and not in DB also. Which is not case of detail list where if any volume has image metadata it append "volume_image_metadata" with empty dict for other volumes also.

https://github.com/openstack/cinder/blob/6fff3565211b10a86c46f64d3a180024f5c80bde/cinder/api/contrib/volume_image_metadata.py#L69

On Tempest tests side, all the volume created in this tests are non-bootable and either SHOW or detail list does not return "volume_image_metadata".
So i am not sure how this tests is failing. can you please provide log location or more info where failure happened ?

Revision history for this message
wangxiyuan (wangxiyuan) wrote :

@Ghanshyam tempest test create and use random tenant/user to test by default. (use_dynamic_credentials = True ) This tenant can't list the volume which are already existed. So it passed.

here is the tempest log:
http://paste.openstack.org/show/605590/

the error happened here:
https://github.com/openstack/tempest/blob/master/tempest/api/volume/test_volumes_list.py#L108

Actually I know we can pass the test by using random credentials, but our production env uses the existed credentials to test the tempest. So it happened.

Changed in tempest:
status: New → Incomplete
wangxiyuan (wangxiyuan)
Changed in tempest:
assignee: nobody → wangxiyuan (wangxiyuan)
wangxiyuan (wangxiyuan)
description: updated
wangxiyuan (wangxiyuan)
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tempest (master)

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

Changed in tempest:
status: Incomplete → In Progress
Revision history for this message
Ghanshyam Mann (ghanshyammann) wrote :

seems like you are running tests with tenants/users of your actual production env which can be very dangerous where tests touch their resources.

You should either tests using dynamic credential or some predefined test credential. if you are going to use production env actual credential then, you may find some of other tests failing too But i am not say that is invalid till you are aware what you are doing.

Revision history for this message
wangxiyuan (wangxiyuan) wrote :

@Ghanshyam, yeah, I know it's better to use dynamic credential. But the reason why I still use actual credential is that I run the tempest test in a public cloud env. In this env, it's impossible for me to let tempest create/delete keystone user/project automatically.

For this bug, I don't want to fix it at Cinder side, because it may change API behavior, so we need a micro version bump. Then I'm not sure if tempest support to test with microversion, can it?

For the tempest patch, Thanks for your review. I'll take a look and update later.

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

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

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

commit e7aac1e9737dafd2bcee7bebdc6d2f48125fb1b2
Author: wangxiyuan <email address hidden>
Date: Wed Apr 19 18:16:22 2017 +0800

    Don't return empty volume_image_metadata when list volume

    Now the response format of volume show and list is not the same if
    there are some bootable volumes already in Cinder.

    Volume list will always return volume_image_metadata property but
    volume show won't return the empty volume_image_metadata.

    This behavior causes a tempest error.(See bug for more detail)

    This patch let the response format be the same.

    Change-Id: If8022b9c06afbcc011db0a62f279ad3520122baa
    Closes-bug: #1680122

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

Change abandoned by wangxiyuan (<email address hidden>) on branch: master
Review: https://review.openstack.org/456858
Reason: Fixed on Cinder side

wangxiyuan (wangxiyuan)
Changed in tempest:
status: In Progress → Invalid
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
Neal Oakey (neal.oakey) wrote :

The failing Tests include Tests, which are required InterOp as of 2016.08.
And the statement from them was that we should "patch and re run. All test results that aren't flagged must be passed."

Therefore I'd like to ask, what the plans are on backporting the patch to older versions of cinder?

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.