Only create volume with an acitve image

Bug #1302621 reported by ling-yun
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Low
ling-yun

Bug Description

When call create volume api with image id "", it will create an empty
volume.
But when create volume with snapshot id "" or srv volume "", it will
return an 404 error.
So it should create volume fail when call create volume api with image id
"".

ling-yun (zengyunling)
Changed in cinder:
assignee: nobody → ling-yun (zengyunling)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

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

Changed in cinder:
status: New → In Progress
Revision history for this message
Huang Zhiteng (zhiteng-huang) wrote : Re: Just create volume with an acitve image

What is the consequence of creating a volume from non-active image?

ling-yun (zengyunling)
summary: - Just create volume with an acitve image
+ Only create volume with an acitve image
description: updated
Revision history for this message
ling-yun (zengyunling) wrote :

To Huang Zhiteng:
If create from a deleted image, the create volume operation would fail and the volume status is error.

Revision history for this message
ling-yun (zengyunling) wrote :

To Huang Zhiteng:

1. We can get an non-active image info by glance show. An active image means that the image is in a valid status for use.
For now, if we call glance show image_id_already_deleted, it returns info as follows:
 root@devstack-aio:/home# glance image-delete f52d37a7-3953-4717-a4ef-2ffacd09d852
 root@devstack-aio:/home# glance image-show f52d37a7-3953-4717-a4ef-2ffacd09d852
 +------------------+--------------------------------------+
 | Property | Value |
 +------------------+--------------------------------------+
 | checksum | 50bdc35edb03a38d91b1b071afb20a3c |
 | container_format | bare |
 | created_at | 2014-04-08T06:20:12 |
 | deleted | True |
 | deleted_at | 2014-04-08T06:21:54 |
 | disk_format | qcow2 |
 | id | f52d37a7-3953-4717-a4ef-2ffacd09d852 |
 | is_public | False |
 | min_disk | 0 |
 | min_ram | 0 |
 | name | for_delete_test |
 | owner | 15b8d665cdc94685b168427a559405e3 |
 | protected | False |
 | size | 9761280 |
 | status | deleted |
 | updated_at | 2014-04-08T06:21:54 |
 +------------------+--------------------------------------+

2. In nova, when boot vm from an image, it would manually check whether the image status is active.
Nova code(nova/computer/api.py:_check_requested_image) as follows:
     def _check_requested_image(self, context, image_id, image, instance_type):
        if not image:
            # Image checks don't apply when building from volume
            return

        if image['status'] != 'active':
            raise exception.ImageNotActive(image_id=image_id)

3. In Cinder, when create from a deleted image, the volume would end in error status.
But if we create from a non-regitry image, it would raise a 404 error.
A deleted image equally to a non-regitry image, so we need manually check the image status whether it is active.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/85366
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=0756cf8ec3f2c73b4141b4b6dc597e82e47de669
Submitter: Jenkins
Branch: master

commit 0756cf8ec3f2c73b4141b4b6dc597e82e47de669
Author: ling-yun <email address hidden>
Date: Fri Apr 4 22:18:50 2014 +0800

    Only create volume with an active image

    1. Currently cinder doesn't check whether the image is active
    when create volume with an image id, we can even create volume
    with a deleted/saving/queued image.

    2. For deleted image, it only happened when using admin credentials.

    When using non-admin credentials, it returned an error that image
    is not found by using 'glance image-show' on a deleted image, which
    is expected. Also when creating a volume from this deleted image,
    it returned a 404 error upfront. This again is the expected result.

    When using admin credentials, we can view the details of deleted image
    with 'glance image-show'. If create a volume out of an image ID (which
    is now deleted), the operation succeeds, but the volume is left in
    'error' state.

    3. This accounts for a bug(he volume shouldn't be created) and should be fixed.

    Change-Id: If4f59695fbf6636778d0d352aef28d90bb45ee91
    Closes-Bug: #1302621

Changed in cinder:
status: In Progress → Fix Committed
Mike Perez (thingee)
Changed in cinder:
milestone: none → juno-1
importance: Undecided → Low
Thierry Carrez (ttx)
Changed in cinder:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in cinder:
milestone: juno-1 → 2014.2
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.