image is creating with option min_disk and min_ram as negative number

Bug #1265711 reported by renminmin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Low
Yanis Guenane

Bug Description

I try to create a image with the min_ram and min_disk as negative number, and create image operation is successful.
I use the glance api V2 to create image.

curl -i -X POST -H "X-Auth-Token: $token" -H "content-type: application/json" -d '{"name": "image-7", "type": "kernel", "foo": "bar", "disk_format": "aki", "container_format": "aki", "protected": false, "tags": ["test","image"], "visibility": "public", "min_ram":-1, "min_disk":-1' \
http://192.168.0.100:9292/v2/images

glance image-show image-7

+------------------+--------------------------------------+
| Property | Value |
+------------------+--------------------------------------+
| Property 'foo' | bar |
| Property 'type' | kernel |
| container_format | aki |
| created_at | 2014-01-03T06:01:14 |
| deleted | False |
| disk_format | aki |
| id | aaa8e463-10aa-4518-a590-52feebaabcb5 |
| is_public | True |
| min_disk | -1 |
| min_ram | -1 |
| name | image-7 |
| owner | 25adaa8f93ee4199b6a362c45745231d |
| protected | False |
| status | queued |
| updated_at | 2014-01-03T06:01:14 |
+------------------+--------------------------------------+

I think glance need to check the value of min_ram and min_disk. They need to be greater than or equal 0.

Revision history for this message
Feilong Wang (flwang) wrote :

Can you help verify if v1 has the same issue? Thanks.

summary: - mage is creating with option min_disk and min_ram as negative number
+ image is creating with option min_disk and min_ram as negative number
Changed in glance:
assignee: nobody → Yanis Guenane (yanis-guenane)
Revision history for this message
Yanis Guenane (yanis-guenane) wrote :

I confirm that v1 has the same issue

stack@devstack:~/devstack$ glance image-create --name alex --min-disk -1 --min-ram -1
+------------------+--------------------------------------+
| Property | Value |
+------------------+--------------------------------------+
| checksum | None |
| container_format | None |
| created_at | 2014-01-06T21:20:30 |
| deleted | False |
| deleted_at | None |
| disk_format | None |
| id | e3637dce-45b4-4076-ad72-953e579618fe |
| is_public | False |
| min_disk | -1 |
| min_ram | -1 |
| name | alex |
| owner | e22f499513e744e9829f461ede787788 |
| protected | False |
| size | 0 |
| status | queued |
| updated_at | 2014-01-06T21:20:30 |
+------------------+--------------------------------------+

Changed in glance:
status: New → Triaged
importance: Undecided → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (master)

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

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

Reviewed: https://review.openstack.org/65354
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=a5b78ae0b502ad0ee95037f5b1d9619dba3dab81
Submitter: Jenkins
Branch: master

commit a5b78ae0b502ad0ee95037f5b1d9619dba3dab81
Author: Yanis Guenane <email address hidden>
Date: Tue Jan 7 19:45:26 2014 +0000

    Prevent min_disk and min_ram from being negative

    At the moment, in both api versions, min_disk and min_ram can be set to
    negative value - which doesn't make sense. This commit fixes this behavior
    in the two versions of the glance api.

    Change-Id: Ib7855c1d928ab8262dd2a109619a4e3d2299ff9e
    Closes-bug: #1265711

Changed in glance:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in glance:
milestone: none → icehouse-2
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (stable/havana)

Fix proposed to branch: stable/havana
Review: https://review.openstack.org/85880

Thierry Carrez (ttx)
Changed in glance:
milestone: icehouse-2 → 2014.1
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.