VMware: resize always fails for image with capacity larger than 1 GB

Bug #1443697 reported by Eric Brown
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Eric Brown

Bug Description

Resize will fail if using 0 disk flavors in combination with images that have disks larger than 1 GB.

Steps to reproduce:
1. Create two new flavors with disk sizes of 0. tiny and small will do
2. Create an image with a disk larger than 1 GB
3. Boot this image with tiny.0
4. Resize this image to small.0
5. Notice Horizon says nothing and the resize does nothing
6. An exception is in the Nova compute logs (stacktrace from Icehouse, but believe also an issue in Kilo)

2015-04-13 23:32:10.676 9404 ERROR oslo.messaging.rpc.dispatcher [-] Exception during message handling: Resize error: Unable to shrink disk.
2015-04-13 23:32:10.676 9404 TRACE oslo.messaging.rpc.dispatcher Traceback (most recent call last):
2015-04-13 23:32:10.676 9404 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.7/dist-packages/oslo/messaging/rpc/dispatcher.py", line 133, in _dispatch_and_reply
2015-04-13 23:32:10.676 9404 TRACE oslo.messaging.rpc.dispatcher incoming.message))
2015-04-13 23:32:10.676 9404 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.7/dist-packages/oslo/messaging/rpc/dispatcher.py", line 176, in _dispatch
2015-04-13 23:32:10.676 9404 TRACE oslo.messaging.rpc.dispatcher return self._do_dispatch(endpoint, method, ctxt, args)
2015-04-13 23:32:10.676 9404 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.7/dist-packages/oslo/messaging/rpc/dispatcher.py", line 122, in _do_dispatch
2015-04-13 23:32:10.676 9404 TRACE oslo.messaging.rpc.dispatcher result = getattr(endpoint, method)(ctxt, **new_args)
2015-04-13 23:32:10.676 9404 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.7/dist-packages/nova/exception.py", line 88, in wrapped
2015-04-13 23:32:10.676 9404 TRACE oslo.messaging.rpc.dispatcher payload)
2015-04-13 23:32:10.676 9404 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.7/dist-packages/nova/openstack/common/excutils.py", line 68, in __exit__
2015-04-13 23:32:10.676 9404 TRACE oslo.messaging.rpc.dispatcher six.reraise(self.type_, self.value, self.tb)
2015-04-13 23:32:10.676 9404 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.7/dist-packages/nova/exception.py", line 71, in wrapped
2015-04-13 23:32:10.676 9404 TRACE oslo.messaging.rpc.dispatcher return f(self, context, *args, **kw)
2015-04-13 23:32:10.676 9404 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 282, in decorated_function
2015-04-13 23:32:10.676 9404 TRACE oslo.messaging.rpc.dispatcher pass
2015-04-13 23:32:10.676 9404 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.7/dist-packages/nova/openstack/common/excutils.py", line 68, in __exit__
2015-04-13 23:32:10.676 9404 TRACE oslo.messaging.rpc.dispatcher six.reraise(self.type_, self.value, self.tb)
2015-04-13 23:32:10.676 9404 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 268, in decorated_function
2015-04-13 23:32:10.676 9404 TRACE oslo.messaging.rpc.dispatcher return function(self, context, *args, **kwargs)
2015-04-13 23:32:10.676 9404 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 335, in decorated_function
2015-04-13 23:32:10.676 9404 TRACE oslo.messaging.rpc.dispatcher function(self, context, *args, **kwargs)
2015-04-13 23:32:10.676 9404 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 256, in decorated_function
2015-04-13 23:32:10.676 9404 TRACE oslo.messaging.rpc.dispatcher migration.instance_uuid, exc_info=True)
2015-04-13 23:32:10.676 9404 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.7/dist-packages/nova/openstack/common/excutils.py", line 68, in __exit__
2015-04-13 23:32:10.676 9404 TRACE oslo.messaging.rpc.dispatcher six.reraise(self.type_, self.value, self.tb)
2015-04-13 23:32:10.676 9404 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 243, in decorated_function
2015-04-13 23:32:10.676 9404 TRACE oslo.messaging.rpc.dispatcher return function(self, context, *args, **kwargs)
2015-04-13 23:32:10.676 9404 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 311, in decorated_function
2015-04-13 23:32:10.676 9404 TRACE oslo.messaging.rpc.dispatcher e, sys.exc_info())
2015-04-13 23:32:10.676 9404 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.7/dist-packages/nova/openstack/common/excutils.py", line 68, in __exit__
2015-04-13 23:32:10.676 9404 TRACE oslo.messaging.rpc.dispatcher six.reraise(self.type_, self.value, self.tb)
2015-04-13 23:32:10.676 9404 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 298, in decorated_function
2015-04-13 23:32:10.676 9404 TRACE oslo.messaging.rpc.dispatcher return function(self, context, *args, **kwargs)
2015-04-13 23:32:10.676 9404 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 3506, in resize_instance
2015-04-13 23:32:10.676 9404 TRACE oslo.messaging.rpc.dispatcher self.instance_events.clear_events_for_instance(instance)
2015-04-13 23:32:10.676 9404 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.7/contextlib.py", line 35, in __exit__
2015-04-13 23:32:10.676 9404 TRACE oslo.messaging.rpc.dispatcher self.gen.throw(type, value, traceback)
2015-04-13 23:32:10.676 9404 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 5613, in _error_out_instance_on_exception
2015-04-13 23:32:10.676 9404 TRACE oslo.messaging.rpc.dispatcher raise error.inner_exception
2015-04-13 23:32:10.676 9404 TRACE oslo.messaging.rpc.dispatcher ResizeError: Resize error: Unable to shrink disk.
2015-04-13 23:32:10.676 9404 TRACE oslo.messaging.rpc.dispatcher
2015-04-13 23:32:10.678 9404 ERROR oslo.messaging._drivers.common [-] Returning exception Resize error: Unable to shrink disk. to caller

It appears that nova compute will throw an error when attempting to resize an instance _from_ a flavor with disk size of 0 _to_ a flavor with disk size 0.

The trick to reproducing this error is using any image that has a disk greater than 1 GB. I initially tested with cirros, tiny-iso, etc which are all less than 1 GB.

The root cause of the problem is this code in vmops.py:1332

        # Checks if the migration needs a disk resize down.
        if (flavor['root_gb'] < instance['root_gb'] or
            flavor['root_gb'] < vmdk.capacity_in_bytes / units.Gi):
            reason = _("Unable to shrink disk.")
            raise exception.InstanceFaultRollback(
                exception.ResizeError(reason=reason))

Dividing the capacity by 1 GB will result in 0 for any number less than 1 GB. However anything larger will be a positive integer. And the flavor size is always 0, so this exception is always raised in a resize of any image with capacity larger than 1 GB (which is most images).

Tags: vmware
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/173170

Changed in nova:
status: New → In Progress
Eric Brown (ericwb)
Changed in nova:
importance: Undecided → Medium
melanie witt (melwitt)
tags: added: vmware
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/173170
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=3a77c7c570acee40100f2fae77ef5b461997b78e
Submitter: Jenkins
Branch: master

commit 3a77c7c570acee40100f2fae77ef5b461997b78e
Author: Eric Brown <email address hidden>
Date: Mon Apr 13 21:58:20 2015 -0700

    VMware: Don't raise exception on resize of 0 disk

    An exception should not be raised if someone resizes and instance
    to a flavor with a zero disk size.

    Change-Id: I183740c974c2ba7e0608c28c05fa28a34a5e1966
    Fixes-Bug: #1443697

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