Bug 1004439 - glance: we can update size of image created from file even though we would fail to create it with a smaller size
glance: we can update size of image created from file even though we would fa...
Status: CLOSED ERRATA
Product: Red Hat OpenStack
Classification: Red Hat
Component: openstack-glance (Show other bugs)
unspecified
x86_64 Linux
unspecified Severity medium
: rc
: 5.0 (RHEL 7)
Assigned To: Giulio Fidente
Tzach Shefi
storage
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-09-04 12:01 EDT by Dafna Ron
Modified: 2016-04-26 11:11 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-07-08 11:31:35 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
log on error for create from file (688 bytes, application/x-xz)
2013-09-04 12:01 EDT, Dafna Ron
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
Launchpad 1220797 None None None Never
Launchpad 1256593 None None None Never
OpenStack gerrit 59227 None None None Never
OpenStack gerrit 59282 None None None Never

  None (edit)
Description Dafna Ron 2013-09-04 12:01:48 EDT
Created attachment 793745 [details]
log on error for create from file

Description of problem:

if we try to create an image from file and giving it a --size which is smaller than the source image file we would fail. 
but after we create the image, if we run image-update on the image with a smaller size we succeed. 
so wither the size test is irrelevant and can be removed or we should prevent an update 

Version-Release number of selected component (if applicable):

openstack-glance-2013.1.3-1.el6ost.noarch

How reproducible:

100%

Steps to Reproduce:
1. try to create an image from a file and giving it --size 1
2. create the image without --size 
3. run glance image-update <image> --size 1

Actual results:

we are not able to create an image which is smaller but we are able to update the image after we create it

Expected results:

if there is no problem updating the image than we should remove the check for smaller size from the create as well, else we should create a test for both commands. 

Additional info:


[root@opens-vdsb ~(keystone_admin)]# glance image-create --name image_size_file --disk-format qcow2 --container-format bare --file /tmp/39f89a6a-7fbb-43c0-a5ea-19b271f51829 
+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| checksum         | 18b7d574b7a1f0093fefc5484d9fb68d     |
| container_format | bare                                 |
| created_at       | 2013-09-04T15:47:55                  |
| deleted          | False                                |
| deleted_at       | None                                 |
| disk_format      | qcow2                                |
| id               | 23bf4915-9f83-4eb5-a7c2-702de4d825e7 |
| is_public        | False                                |
| min_disk         | 0                                    |
| min_ram          | 0                                    |
| name             | image_size_file                      |
| owner            | ad326a6c11a742c6bfdf4ad63be0c889     |
| protected        | False                                |
| size             | 1440612352                           |
| status           | active                               |
| updated_at       | 2013-09-04T15:48:03                  |
+------------------+--------------------------------------+


[root@opens-vdsb ~(keystone_admin)]# glance image-list 
+--------------------------------------+------------------+-------------+------------------+------------+--------+
| ID                                   | Name             | Disk Format | Container Format | Size       | Status |
+--------------------------------------+------------------+-------------+------------------+------------+--------+
| 1433f462-0079-49dc-b6be-a7927c12be77 | check            | qcow2       | bare             | 1974140928 | active |
| 208bf4d0-f760-4212-8cf5-dd3ab0015a7d | disk_size        | qcow2       | bare             | 1440612352 | active |
| 43421785-6fb0-4ef2-8068-7993072a7735 | file             | qcow2       | bare             | 1440612352 | active |
| 55d45384-6b4b-40c6-b399-639b03c06c3b | human            | qcow2       | bare             | 1          | active |
| 23bf4915-9f83-4eb5-a7c2-702de4d825e7 | image_size_file  | qcow2       | bare             | 1440612352 | active |
| 0c4bc71a-4fa0-4585-9af1-e49b06d57082 | just_copy        | qcow2       | bare             | 1          | active |
| 9df487b3-6a71-48ff-a012-668324aae01f | not_public       | qcow2       | bare             | 1974140928 | active |
| 6e860237-2110-428c-870a-a81b1c7df258 | not_public_dafna | qcow2       | bare             | 1974140928 | active |
| 723dfae6-fd58-440a-9f71-1f1da82e3229 | not_public_dafna | qcow2       | bare             | 1974140928 | active |
| e2e2fa1a-55b4-426a-a05b-9d9e70ffed72 | no_del           | qcow2       | bare             | 1974140928 | active |
| 05c9b5e2-3082-4ad3-8d03-faf74b61234c | rhel64           | qcow2       | bare             | 1974140928 | active |
| fbf238ee-8396-4da2-961b-613b7c4ed9ec | rhevm_image      | qcow2       | bare             | 1440612352 | active |
| ec358c7a-6579-4cda-93a5-8e409fb6e7d9 | tenant           | qcow2       | bare             | 1974140928 | active |
| dc79349e-de25-4ec5-8b12-5a6145270c47 | test             | qcow2       | bare             | 1974140928 | active |
+--------------------------------------+------------------+-------------+------------------+------------+--------+
[root@opens-vdsb ~(keystone_admin)]# glance image-update 23bf4915-9f83-4eb5-a7c2-702de4d825e7 --size 1
+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| checksum         | 18b7d574b7a1f0093fefc5484d9fb68d     |
| container_format | bare                                 |
| created_at       | 2013-09-04T15:47:55                  |
| deleted          | False                                |
| deleted_at       | None                                 |
| disk_format      | qcow2                                |
| id               | 23bf4915-9f83-4eb5-a7c2-702de4d825e7 |
| is_public        | False                                |
| min_disk         | 0                                    |
| min_ram          | 0                                    |
| name             | image_size_file                      |
| owner            | ad326a6c11a742c6bfdf4ad63be0c889     |
| protected        | False                                |
| size             | 1                                    |
| status           | active                               |
| updated_at       | 2013-09-04T15:49:26                  |
+------------------+--------------------------------------+
[root@opens-vdsb ~(keystone_admin)]# glance image-list 
+--------------------------------------+------------------+-------------+------------------+------------+--------+
| ID                                   | Name             | Disk Format | Container Format | Size       | Status |
+--------------------------------------+------------------+-------------+------------------+------------+--------+
| 1433f462-0079-49dc-b6be-a7927c12be77 | check            | qcow2       | bare             | 1974140928 | active |
| 208bf4d0-f760-4212-8cf5-dd3ab0015a7d | disk_size        | qcow2       | bare             | 1440612352 | active |
| 43421785-6fb0-4ef2-8068-7993072a7735 | file             | qcow2       | bare             | 1440612352 | active |
| 55d45384-6b4b-40c6-b399-639b03c06c3b | human            | qcow2       | bare             | 1          | active |
| 23bf4915-9f83-4eb5-a7c2-702de4d825e7 | image_size_file  | qcow2       | bare             | 1          | active |
| 0c4bc71a-4fa0-4585-9af1-e49b06d57082 | just_copy        | qcow2       | bare             | 1          | active |
| 9df487b3-6a71-48ff-a012-668324aae01f | not_public       | qcow2       | bare             | 1974140928 | active |
| 6e860237-2110-428c-870a-a81b1c7df258 | not_public_dafna | qcow2       | bare             | 1974140928 | active |
| 723dfae6-fd58-440a-9f71-1f1da82e3229 | not_public_dafna | qcow2       | bare             | 1974140928 | active |
| e2e2fa1a-55b4-426a-a05b-9d9e70ffed72 | no_del           | qcow2       | bare             | 1974140928 | active |
| 05c9b5e2-3082-4ad3-8d03-faf74b61234c | rhel64           | qcow2       | bare             | 1974140928 | active |
| fbf238ee-8396-4da2-961b-613b7c4ed9ec | rhevm_image      | qcow2       | bare             | 1440612352 | active |
| ec358c7a-6579-4cda-93a5-8e409fb6e7d9 | tenant           | qcow2       | bare             | 1974140928 | active |
| dc79349e-de25-4ec5-8b12-5a6145270c47 | test             | qcow2       | bare             | 1974140928 | active |
+--------------------------------------+------------------+-------------+------------------+------------+--------+
Comment 1 Dafna Ron 2013-09-04 12:02:13 EDT
https://bugs.launchpad.net/glance/+bug/1220797
Comment 4 Flavio Percoco 2013-11-29 10:30:31 EST
So, I think there are 2 different issues. The first is that the size attribute is currently overloaded, which is what that blueprint aims to fix. The second is that glance allows users to update the size and set a smaller size, although it forbids you to do that on image creation.

Al that being said, this all falls down to the fact that size is overloaded - as already mentioned - and it's not completely immutable - as Giulio mentioned.

I think that admins should be allowed to modify the size, anyway. This bug needs to be fixed. Getting the size of the image from the store and comparing it to the user's input should be enough.
Comment 5 Giulio Fidente 2014-01-13 05:25:35 EST
as per upstream comment, the submission was rejected because update of image size is only possible to admins and that looks like a good feature to have

Dafna are you okay with closing this as WONTFIX?
Comment 6 Dafna Ron 2014-01-13 05:29:49 EST
(In reply to Giulio Fidente from comment #5)
> as per upstream comment, the submission was rejected because update of image
> size is only possible to admins and that looks like a good feature to have
> 
> Dafna are you okay with closing this as WONTFIX?

no. 
the tests are done with admin user and I think that a size check on update is a good idea (even when command is run as admin).
Comment 7 Giulio Fidente 2014-01-13 06:49:19 EST
newer V2 glance api does not suffer from the same issue, it prevents updates to image size (and checksum) so we agreed on moving this bug into ON_QA state

testing will have to be performed against the V2 interface
Comment 8 Tzach Shefi 2014-01-19 03:38:28 EST
Verified on API V2 - image-size is read only and can't be updated. 

Checked with both smaller\bigger than real image size figures, both failed as expected. 
  
RHEL 6.5, AIO setup
openstack-glance-2013.2.1-3.el6ost.noarch

Test output below: 

[root@orange-vdse ~(keystone_admin)]# glance --os-image-api-version 2 image-update 317e29ea-1419-4a0b-8936-6efea4574151  --size 4
Request returned failure status.
403 Forbidden
Attribute 'size' is read-only.
    (HTTP 403)

[root@orange-vdse ~(keystone_admin)]# glance --os-image-api-version 2 image-update 317e29ea-1419-4a0b-8936-6efea4574151  --size 4444444
Request returned failure status.
403 Forbidden
Attribute 'size' is read-only.
    (HTTP 403)
Comment 11 errata-xmlrpc 2014-07-08 11:31:35 EDT
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.

http://rhn.redhat.com/errata/RHEA-2014-0851.html

Note You need to log in before you can comment on or make changes to this bug.