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

Bug 1365268

Summary: while creating volume from image, cinder do not fetch/consider "virtual-size" of image
Product: Red Hat OpenStack Reporter: Eric Harney <eharney>
Component: openstack-cinderAssignee: Eric Harney <eharney>
Status: CLOSED ERRATA QA Contact: lkuchlan <lkuchlan>
Severity: high Docs Contact:
Priority: high    
Version: 9.0 (Mitaka)CC: egafford, eharney, jjoyce, lkuchlan, nlevinki, pbandark, pgrist, scohen, srevivo, tshefi
Target Milestone: asyncKeywords: Unconfirmed, ZStream
Target Release: 9.0 (Mitaka)Flags: tshefi: automate_bug-
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: openstack-cinder-8.1.0-2.el7ost Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1353937 Environment:
Last Closed: 2016-10-05 19:14:41 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: 1353937    
Bug Blocks:    

Comment 3 lkuchlan 2016-09-28 13:56:06 UTC
Tested using:
openstack-cinder-8.1.1-1.el7ost.noarch
python-cinderclient-1.6.0-1.el7ost.noarch
python-cinder-8.1.1-1.el7ost.noarch

Verification flow:

[root@cougar09 ~(keystone_admin)]# glance image-create  --file rhel-guest-image-7.2-20160302.0.x86_64.qcow2 --name rhel_image --disk-format qcow2 --container-format bare 
+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| checksum         | d59c63f4ccc4ac3f7086c41ae7f2a15b     |
| container_format | bare                                 |
| created_at       | 2016-09-28T13:33:14Z                 |
| disk_format      | qcow2                                |
| id               | 159d002b-2531-4088-91e7-6936360b8d63 |
| min_disk         | 0                                    |
| min_ram          | 0                                    |
| name             | rhel_image                           |
| owner            | 14873d81838244f68f0d5c8ce904bcd9     |
| protected        | False                                |
| size             | 500563968                            |
| status           | active                               |
| tags             | []                                   |
| updated_at       | 2016-09-28T13:33:20Z                 |
| virtual_size     | None                                 |
| visibility       | private                              |
+------------------+--------------------------------------+

[root@cougar09 ~(keystone_admin)]# cinder create 12 --image-id 159d002b-2531-4088-91e7-6936360b8d63 --name volume_from_image
+--------------------------------+--------------------------------------+
|            Property            |                Value                 |
+--------------------------------+--------------------------------------+
|          attachments           |                  []                  |
|       availability_zone        |                 nova                 |
|            bootable            |                false                 |
|      consistencygroup_id       |                 None                 |
|           created_at           |      2016-09-28T13:37:16.000000      |
|          description           |                 None                 |
|           encrypted            |                False                 |
|               id               | d8a0e23e-bd35-4bd0-9fa1-5511cd80ed1a |
|            metadata            |                  {}                  |
|        migration_status        |                 None                 |
|          multiattach           |                False                 |
|              name              |          volume_from_image           |
|     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  |   14873d81838244f68f0d5c8ce904bcd9   |
|       replication_status       |               disabled               |
|              size              |                  12                  |
|          snapshot_id           |                 None                 |
|          source_volid          |                 None                 |
|             status             |               creating               |
|           updated_at           |                 None                 |
|            user_id             |   778719f70e21481bb2e4cfaacb4eebbd   |
|          volume_type           |                 None                 |
+--------------------------------+--------------------------------------+

[root@cougar09 ~(keystone_admin)]# cinder list | grep volume_from_image
| d8a0e23e-bd35-4bd0-9fa1-5511cd80ed1a | available |   volume_from_image   |  12  |      -      |   true   |

[root@cougar09 ~(keystone_admin)]# nova boot --boot-volume 20ea8df1-34ab-4a8a-bc76-27822fc1d12d --nic net-id=5be39566-497c-4e94-aa56-a3dc482c081c --flavor 3 vm_test
+--------------------------------------+--------------------------------------------------+
| Property                             | Value                                            |
+--------------------------------------+--------------------------------------------------+
| OS-DCF:diskConfig                    | MANUAL                                           |
| OS-EXT-AZ:availability_zone          |                                                  |
| OS-EXT-SRV-ATTR:host                 | -                                                |
| OS-EXT-SRV-ATTR:hypervisor_hostname  | -                                                |
| OS-EXT-SRV-ATTR:instance_name        | instance-00000005                                |
| OS-EXT-STS:power_state               | 0                                                |
| OS-EXT-STS:task_state                | scheduling                                       |
| OS-EXT-STS:vm_state                  | building                                         |
| OS-SRV-USG:launched_at               | -                                                |
| OS-SRV-USG:terminated_at             | -                                                |
| accessIPv4                           |                                                  |
| accessIPv6                           |                                                  |
| adminPass                            | TJhg5MUUXgKV                                     |
| config_drive                         |                                                  |
| created                              | 2016-09-28T13:46:23Z                             |
| flavor                               | m1.medium (3)                                    |
| hostId                               |                                                  |
| id                                   | 53f417d8-b5a4-4651-bf4f-8e00e9d84f4a             |
| image                                | Attempt to boot from volume - no image supplied  |
| key_name                             | -                                                |
| metadata                             | {}                                               |
| name                                 | vm_test                                          |
| os-extended-volumes:volumes_attached | [{"id": "20ea8df1-34ab-4a8a-bc76-27822fc1d12d"}] |
| progress                             | 0                                                |
| security_groups                      | default                                          |
| status                               | BUILD                                            |
| tenant_id                            | 14873d81838244f68f0d5c8ce904bcd9                 |
| updated                              | 2016-09-28T13:46:24Z                             |
| user_id                              | 778719f70e21481bb2e4cfaacb4eebbd                 |
+--------------------------------------+--------------------------------------------------+

[root@cougar09 ~(keystone_admin)]# nova list | grep vm_test
| 53f417d8-b5a4-4651-bf4f-8e00e9d84f4a | vm_test             | ACTIVE | -          | Running     | private=10.0.0.3    |

Comment 5 errata-xmlrpc 2016-10-05 19:14:41 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://rhn.redhat.com/errata/RHBA-2016-2030.html

Comment 6 Tzach Shefi 2019-04-30 12:19:59 UTC
Per close loop noting to test/automate,
unfortunately Cinder's client doesn't check images size during create request, this probably won't change in the near future. 

Cinder volume create accepts the request and assumes it's valid, no error to catch which is what I'd expect to see happen.  
Only later in the process when Cinder starts pushing image into new volume does it fail changes volume's state to error. 

As such there is no point in testing/automating this right now. 
If Cinder's client will address this in the future I'll revisit and test this.