← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1733816] Re: Import api, image becomes active if disk-format and container format are not set

 

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 <akekane@xxxxxxxxxx>
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

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Glance.
https://bugs.launchpad.net/bugs/1733816

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

Status in Glance:
  Fix Released

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.

To manage notifications about this bug go to:
https://bugs.launchpad.net/glance/+bug/1733816/+subscriptions


References