Import api, image becomes active if disk-format and container format are not set

Bug #1733816 reported by Abhishek Kekane
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
High
Abhishek Kekane

Bug Description

If you run image-import api on any image which is in uploading state and does not have container-format and/or disk-format set goes into active state. Ideally image which does not have container-format or disk-format set should raise bad request error.

Prerequisites:
1. Ensure you have latest version of python-glanceclient (version 2.8.0) installed
2. Due to isssue [1] to execute taskflow you need to modify line [2] as shown below and restart glance-api service
   - pool.spawn_n(import_task.run, task_executor)
   + import_task.run(task_executor)
   [1] https://bugs.launchpad.net/glance/+bug/1712463
   [2] https://github.com/openstack/glance/blob/master/glance/api/v2/images.py#L106

Steps to reporoduce:
1. Create an image without container format and disk-format
    $ glance image-create --name cirros_image
2. Run stage call to upload data in staging area
    $ glance image-stage <ID of image created in 1st step> --file ~/devstack/local.conf
3. Run image-import call
   $ glance image-import <ID of image created in 1st step> --import-method glance-direct

Output:
+------------------+--------------------------------------+
| Property | Value |
+------------------+--------------------------------------+
| checksum | 527294ab8d1550529d6e5ef853cf1933 |
| container_format | None |
| created_at | 2017-11-22T09:28:42Z |
| disk_format | None |
| id | 303e1af0-4273-4a40-a719-9bd2e6a89864 |
| min_disk | 0 |
| min_ram | 0 |
| name | cirros_image |
| owner | 40ab3e7ce43e4b6bb31a912b434490b5 |
| protected | False |
| size | 314 |
| status | active |
| tags | [] |
| updated_at | 2017-11-22T09:29:46Z |
| virtual_size | None |
| visibility | shared |
+------------------+--------------------------------------+

From the above output you can easily figure out that image is in active state and container_format and disk_format are set to None.

Changed in glance:
assignee: nobody → Abhishek Kekane (abhishek-kekane)
description: updated
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/522774

Changed in glance:
status: New → In Progress
Changed in glance:
importance: Undecided → High
milestone: none → queens-2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)

Reviewed: https://review.openstack.org/522774
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=778c46763e40cfa90e23cdfdbb28295cbbee5cf9
Submitter: Zuul
Branch: master

commit 778c46763e40cfa90e23cdfdbb28295cbbee5cf9
Author: Abhishek Kekane <email address hidden>
Date: Fri Nov 24 10:38:36 2017 +0000

    Prevent image become active without disk and container formats

    If you run image-import api on any image which is in uploading
    state and does not have container-format and/or disk-format set
    goes into active state. The reason is during import call status
    is set to importing from uploading and while checking container
    format and disk formats are specified only 'queued' status was
    taken into consideration.

    Added 'uploading' status where validation is done to check whether
    disk format and container format is added to the image.

    Change-Id: I2865d81a01e5ab5d113bd809c273a2876213e7d4
    Closes-Bug: #1733816

Changed in glance:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/glance 16.0.0.0b3

This issue was fixed in the openstack/glance 16.0.0.0b3 development milestone.

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.