Bug 1470217

Summary: create from image fails if glance image is raw with qcow2 header
Product: Red Hat OpenStack Reporter: Eric Harney <eharney>
Component: openstack-cinderAssignee: Eric Harney <eharney>
Status: CLOSED ERRATA QA Contact: Avi Avraham <aavraham>
Severity: high Docs Contact:
Priority: high    
Version: 10.0 (Newton)CC: ccollett, eharney, jjoyce, pgrist, pmorey, srevivo, tshefi
Target Milestone: z5Keywords: Triaged, ZStream
Target Release: 10.0 (Newton)Flags: tshefi: automate_bug+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openstack-cinder-9.1.4-9.el7ost Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1481809 (view as bug list) Environment:
Last Closed: 2017-09-28 16:31:38 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: 1481809    
Bug Blocks:    

Description Eric Harney 2017-07-12 14:19:39 UTC
$ qemu-img create -f qcow2 testqcow2.img 1G
$ glance image-create --file ./testqcow2.img  --disk-format raw --container-format bare
$ cinder create 1 --image-id <image>


This fails with:

ImageUnacceptable: Image e020e664-fe3a-40a0-8d32-928fbc7b4a75 is unacceptable: Converted to raw, but format is now qcow2


This is because Cinder does a "qemu-img info" check to determine the file format, which is detected as qcow2.  Raw images from Glance need to do this check differently because they could contain any header/format.

Comment 7 Tzach Shefi 2017-09-14 12:19:34 UTC
Verified on: 
openstack-cinder-9.1.4-9.el7ost

1. Created file
qemu-img create -f qcow2 testqcow2.img 1G

2. Upload to Glance
[stack@undercloud-0 ~]$ openstack image create  --file ./testqcow2.img  --disk-format raw --container-format bare img
+------------------+------------------------------------------------------------------------------+
| Field            | Value                                                                        |
+------------------+------------------------------------------------------------------------------+
| checksum         | 8810863346314775e74ae12bc2228ef1                                             |
| container_format | bare                                                                         |
| created_at       | 2017-09-14T12:15:46Z                                                         |
| disk_format      | raw                                                                          |
| file             | /v2/images/729802e5-ba62-4137-8109-b4e624972f2f/file                         |
| id               | 729802e5-ba62-4137-8109-b4e624972f2f                                         |
| min_disk         | 0                                                                            |
| min_ram          | 0                                                                            |
| name             | img                                                                          |
| owner            | 6a6b9ff12c8f4d908c441bd3ffb77b2a                                             |
| properties       | direct_url='swift+config://ref1/glance/729802e5-ba62-4137-8109-b4e624972f2f' |
| protected        | False                                                                        |
| schema           | /v2/schemas/image                                                            |
| size             | 196624                                                                       |
| status           | active                                                                       |
| tags             |                                                                              |
| updated_at       | 2017-09-14T12:15:48Z                                                         |
| virtual_size     | None                                                                         |
| visibility       | private                                                                      |
+------------------+------------------------------------------------------------------------------+

3. Create vol from image

cinder create 1 --image-id 729802e5-ba62-4137-8109-b4e624972f2f
+--------------------------------+--------------------------------------+
| Property                       | Value                                |
+--------------------------------+--------------------------------------+
| attachments                    | []                                   |
| availability_zone              | nova                                 |
| bootable                       | false                                |
| consistencygroup_id            | None                                 |
| created_at                     | 2017-09-14T12:17:54.000000           |
| description                    | None                                 |
| encrypted                      | False                                |
| id                             | c573fb27-fad6-40aa-8cd9-5f3bbb02cc2d |
| metadata                       | {}                                   |
| migration_status               | None                                 |
| multiattach                    | False                                |
| name                           | None                                 |
| 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   | 6a6b9ff12c8f4d908c441bd3ffb77b2a     |
| replication_status             | disabled                             |
| size                           | 1                                    |
| snapshot_id                    | None                                 |
| source_volid                   | None                                 |
| status                         | creating                             |
| updated_at                     | None                                 |
| user_id                        | 260b3a8c738e4ba9ac4f78f357c00652     |
| volume_type                    | None                                 |
+--------------------------------+--------------------------------------+


4. Volume create successfully, verified. 
cinder list
+--------------------------------------+-----------+------+------+-------------+----------+-------------+
| ID                                   | Status    | Name | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+-----------+------+------+-------------+----------+-------------+
| c573fb27-fad6-40aa-8cd9-5f3bbb02cc2d | available | -    | 1    | -           | true     |             |
+--------------------------------------+-----------+------+------+-------------+----------+-------------+

Comment 8 errata-xmlrpc 2017-09-28 16:31:38 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.

https://access.redhat.com/errata/RHBA-2017:2821