Resize to zero disk flavor is not allowed

Bug #1340159 reported by Shuangtai Tian
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Shuangtai Tian

Bug Description

When old flavor's root_gb is not equal 0 and new flavor's root_gb is 0, the resize() in nova.compute.api will raise CannotResizeDisk.

https://github.com/openstack/nova/blob/master/nova/compute/api.py#L2368

    def resize(self, context, instance, flavor_id=None,
        if not flavor_id:
            LOG.debug("flavor_id is None. Assuming migration.",
                      instance=instance)
            new_instance_type = current_instance_type
        else:
            new_instance_type = flavors.get_flavor_by_flavor_id(
                    flavor_id, read_deleted="no")
            if (new_instance_type.get('root_gb') == 0 and
                current_instance_type.get('root_gb') != 0):
                reason = _('Resize to zero disk flavor is not allowed.')
                raise exception.CannotResizeDisk(reason=reason)

Changed in nova:
assignee: nobody → Shuangtai Tian (shuangtai-tian)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

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

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

Reviewed: https://review.openstack.org/106034
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=80df9f5ec53cc71c1ec51a8590921ae5b776ec22
Submitter: Jenkins
Branch: master

commit 80df9f5ec53cc71c1ec51a8590921ae5b776ec22
Author: shuangtai <email address hidden>
Date: Thu Jul 10 19:58:58 2014 +0800

    Catch CannotResizeDisk exception when resize to zero disk

    When old flavor's root_gb is not equal 0 and new flavor's root_gb is 0,
    the resize() in nova.compute.api will raise CannotResizeDisk.

    Move up the new_instance_type check before using.

    Closes-Bug: #1340159

    Change-Id: I4abf93530cf919af50a88d6049019fb745547257

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → juno-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: juno-3 → 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.