cinder upload-to-image cli command unexpectedly returns NoneType error

Bug #1827079 reported by Wendy Mitchell
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
StarlingX
Fix Released
Medium
Liang Fang

Bug Description

Brief Description
-----------------
cli command returns error unexpectedly
cinder upload-to-image <volume id or name> <imagename>
ERROR: 'NoneType' object has no attribute '__getitem__'

Severity
--------
Standard

Steps to Reproduce
------------------
The test performs the following operations
1. Launches an instance using a newly created bootable volume (as tenant2 user for example)
nova boot --boot-volume 7a2ea0cc-0b6e-4655-a176-8644b1fcf4ee --flavor 3aba697a-7bcf-45f1-86d5-d0175be957b9 --key-name keypair-tenant2 --nic net-id=67373864-a951-4286-a477-b6a300e77ba9 --nic net-id=ad6f5e42-3364-4c62-88b3-8660f7f81935 tenant2-vm-1 --poll

Name tenant2-vm-1
ID 145b1957-0024-4096-93e2-1f9d81ab15ca
Status Active
RAM 1GB
VCPUs 1 VCPU
Disk 2GB

2. Creates a snapshot based on the instance

snapshot for tenant2-vm-1_snapshot - 1GiB Available - vol-tenant2
ID 31771929-a3a8-4a1c-8b74-210dfa9a9c2d
Volume vol-tenant2
Group Snapshot

nova image-create 145b1957-0024-4096-93e2-1f9d81ab15ca tenant2-vm-1_snapshot

3. Creates a cinder snapshot eg. 5GiB
cinder create --display-name vol_from_snapshot --snapshot-id 31771929-a3a8-4a1c-8b74-210dfa9a9c2d 5
Name vol_from_snapshot
ID ea32b388-35e6-49c3-af2f-f640805dccc0
Project ID ae2d595da5b24253aee9e1eddae2d3a1
Status Available
Group
Size 5 GiB
Bootable Yes
Encrypted No
Created April 30, 2019, 2:24 p.m.
Attachments
Attached To Not attached
..

4. Then attempts to upload the cinder volume to image
cinder upload-to-image <available volume id or name> <newimagename>
eg.
#cinder upload-to-image vol_from_snapshot cinder_upload3

Expected Behavior
------------------
Expect successful upload without error in cli
#cinder upload-to-image vol_from_snapshot cinder_upload3

Actual Behavior
----------------
unexpected error when cli command is run in step 4 (although the image was created)
ERROR: 'NoneType' object has no attribute '__getitem__'

ID a24e2a69-ca9c-48b3-af4c-9a96b61b1912
Type Status Active
Size 5.00 GB
Min. Disk 0
Min. RAM 0
Disk Format RAW
Container Format BARE
...
Visibility Image from Other Project - Non-Public
...
Custom Properties
direct_url
 rbd://10f49b55-40ba-4a61-be77-fce636c76b15/images/a24e2a69-ca9c-48b3-af4c-9a96b61b1912/snap
file /v2/images/a24e2a69-ca9c-48b3-af4c-9a96b61b1912/file
...

Reproducibility
---------------
yes

System Configuration
--------------------
2+3
Lab: WP_3-7
test_create_snapshot_using_boot_from_volume_vm

Branch/Pull Time/Commit
-----------------------
20190427T013000Z

Timestamp/Logs
--------------
see inline

Revision history for this message
Frank Miller (sensfan22) wrote :

Marking stx.2.0 release gating as it is believed this functionality should be working.

Assigning to the distro.openstack PL.
Next step should be to determine if this is a bug that needs to be addressed and if yes then is this a StarlingX issue or an upstream cinder issue?

Changed in starlingx:
status: New → Triaged
importance: Undecided → Medium
assignee: nobody → Bruce Jones (brucej)
tags: added: stx.2.0
tags: added: stx.distro.openstack
Bruce Jones (brucej)
Changed in starlingx:
assignee: Bruce Jones (brucej) → Cindy Xie (xxie1)
Zhuweiwei (vivian.zhu)
Changed in starlingx:
assignee: Cindy Xie (xxie1) → Zhuweiwei (vivian.zhu)
Liang Fang (liangfang)
Changed in starlingx:
assignee: Zhuweiwei (vivian.zhu) → Liang Fang (liangfang)
Liang Fang (liangfang)
tags: added: stx.storage
Revision history for this message
Liang Fang (liangfang) wrote :

@Wendy What's the meaning of configuration 2+3? bare metal or virtualization? It looks like a real bug in cinder or glance and I want to reproduce in my side. Can it be reproduced in an AIO-Simplex virtualization environment? Thanks

Revision history for this message
Wendy Mitchell (wmitchellwr) wrote :

It was hardware system with 2 controllers, 1 (or more) worker nodes.

Revision history for this message
Liang Fang (liangfang) wrote :

Reproduced.

The root cause is:
/usr/lib/python2.7/site-packages/cinderclient/shell_utils.py, line 32
The image volume_type is None if the uploading volume is created from an instance snapshot.

Next step, will investigate if this is the normal situation(volume_type is None), if so, then just add the check of None here, otherwise need to add the volume type for image. Code review will be sent out after this.

Liang Fang (liangfang)
Changed in starlingx:
status: Triaged → In Progress
Revision history for this message
Liang Fang (liangfang) wrote :
Revision history for this message
Liang Fang (liangfang) wrote :

this is fixed by another patch at the same time:
https://review.opendev.org/#/c/648157/
This patch is merged today.

Changed in starlingx:
status: In Progress → Fix Committed
Revision history for this message
Ghada Khalil (gkhalil) wrote :

The above review (https://review.opendev.org/#/c/648157/) was merged in openstack. Is there a plan to merge it in the stein branch? Otherwise starlingx will not pick up the fix.

Revision history for this message
Ghada Khalil (gkhalil) wrote :

The above review (https://review.opendev.org/#/c/648157/) was merged in openstack master. Is there a plan to merge it in the stein branch? Otherwise starlingx will not pick up the fix.

Revision history for this message
Liang Fang (liangfang) wrote :

cherry pick to stein in progress now, review:
https://review.opendev.org/#/c/662782/

Revision history for this message
Liang Fang (liangfang) wrote :

This patch has been merged to stein branch.

Revision history for this message
Ghada Khalil (gkhalil) wrote :

Indeed, starlingx picked up the change in the cengn build on 2019-06-13

20190613T013000Z/outputs/CHANGELOG.txt:./cgcs-root/stx/git/python-cinderclient 0a2bab1d4d01df99bc9594f3f055ad99584949aa 2019-06-03 14:54:13 +0000 Sean McGinnis <email address hidden> Fix shell upload-to-image with no volume type

Marking this as fix released.

Changed in starlingx:
status: Fix Committed → Fix Released
Revision history for this message
Wendy Mitchell (wmitchellwr) wrote :
Download full text (4.0 KiB)

verified in BUILD_ID="20190613T013000Z"

$ cinder upload-to-image vol_from_snapshot cinder_upload3
+---------------------+--------------------------------------+
| Property | Value |
+---------------------+--------------------------------------+
| container_format | bare |
| disk_format | raw |
| display_description | None |
| id | 38d7a3a7-f4dd-4cbd-9661-b2fe211dfb83 |
| image_id | 0ab5892b-48bd-4480-9730-e6ca0a829ce4 |
| image_name | cinder_upload3 |
| protected | False |
| size | 5 |
| status | uploading |
| updated_at | 2019-06-14T15:13:31.000000 |
| visibility | shared |
| volume_type | None

$ cinder list
| ID | Status | Name | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+-----------+-------------------+------+-------------+----------+--------------------------------------+
| 38d7a3a7-f4dd-4cbd-9661-b2fe211dfb83 | uploading | vol_from_snapshot | 5 | - | true |

]$ cinder show 38d7a3a7-f4dd-4cbd-9661-b2fe211dfb83
+------------------------------+-------------------------------------------------+
| Property | Value |
+------------------------------+-------------------------------------------------+
| attached_servers | [] |
| attachment_ids | [] |
| availability_zone | nova |
| bootable | true |
| consistencygroup_id | None |
| created_at | 2019-06-14T15:13:30.000000 |
| description | None |
| encrypted | False |
| id | 38d7a3a7-f4dd-4cbd-9661-b2fe211dfb83 |
| metadata | |
| multiattach | False |
| name | vol_from_snapshot |
| os-vol-tenant-attr:tenant_id | 73a53491ff1146c8917ba14f340b328f |
| replication_status | None |
| size | 5 |
| snapshot_id | 83244119-1c99-4544-ba47-97d5db1df42c |
| source_volid | None |
| status | avai...

Read more...

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.