Resize instance from large flavor to small flavor based on Hyperv driver, instance status is error and the phsical instance get destroyed

Bug #1163844 reported by GuoHui Liu on 2013-04-03
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Alessandro Pilotti

Bug Description

Test script:
1.Use flavor2 to deploy instance.
2.When deployment success , resize it from flavor2 to flavor1.
3.Instance status display error.

Flavor1 information:
512M memory
0G disk

Flavor2 information:
2048M memory
20G disk

the root cause is, in current hyperv driver implementation, when to perform finish_migration operation, there is a check that the VHD can't be resize to a smaller size.
                if new_size < curr_size:
                    raise vmutils.HyperVException(_("Cannot resize a VHD to a "
                                                    "smaller size"))
but at this point, the old instance get already destroyed, so the data could be lost.

Michael Fork (mjfork) wrote :

Started thread on the mailing list:

The behavior when the disk shrinks is inconsistent across all the hypervisors.

libvirt: logs it cannot resize to smaller and just keeps the larger disk
xen: tries to copy contents to a smaller disk, fails if too large
hyperv: always errors out if new disk size is smaller
powervm: silently keeps the larger disk
vmware: (couldn't find where migration code handled resize)

The only mention in the API guide - - is "scaling the server up or down."

Since Hyper-V always fails on a smaller disk and it can lead to being unable to access a VM, I would propose the behavior from libvirt and powervm be adopted and that this be addressed in the Nova v3 API and explicitly fail if we cannot resize down.

Fix proposed to branch: master

Changed in nova:
assignee: nobody → GuoHui LIu (guohliu)
status: New → In Progress
GuoHui Liu (guohliu) on 2013-04-20
Changed in nova:
assignee: GuoHui LIu (guohliu) → nobody
Changed in nova:
assignee: nobody → GuoHui LIu (guohliu)

Fix proposed to branch: master

Changed in nova:
assignee: GuoHui LIu (guohliu) → Alessandro Pilotti (alexpilotti)

The driver's migrate_disk_and_power_off method should be able to raise an exception in case the target instance flavor is not compatible with the current one, without resulting in an ERROR state for the instance.

As an alternative, an additional driver method could be added to verify the flavor compatibility before calling migrate_disk_and_power_off.

tags: added: hyper-v
removed: hyperv

Submitter: Jenkins
Branch: master

commit d50d69cbd807dfb67427b39e03fd4156479c1997
Author: Alessandro Pilotti <email address hidden>
Date: Tue May 7 01:04:22 2013 +0300

    Adds instance root disk size checks during resize

    Fixes bug: #1163844

    The Hyper-V driver does not support disk resizes to a smaller size.
    This patch verifies the disk size compatibility before the migration
    starts in order to avoid data losses.

    Change-Id: Ie99bf8779d583e97b911c9a136cee1bca9a1ecdc

Changed in nova:
status: In Progress → Fix Committed

As an additional note:

We are discussing to add "Soft Errors" support in Nova, meaning that the exception that we raise here will result in an instance action instead of an ERROR state.

The patch that has been recently committed can thus be considered as an interim step.

GuoHui Liu (guohliu) wrote :

Hi Alessandro, thanks for this information, it sounds great to me, let's keep this bug to tracking the next improvement. and if you have time please take a look of another hyperv issue,, thanks.

One additional note:

During a chat on #openstack-nova we discussed about adding soft errors in Nova, by leveraging the new nova actions.

This will allow us to raise a "soft exception" at the beginning of the resize operation (like it happens now), keeping the instance in ACTIVE state instead of ERROR.

Thierry Carrez (ttx) on 2013-05-29
Changed in nova:
milestone: none → havana-1
status: Fix Committed → Fix Released
Thierry Carrez (ttx) on 2013-10-17
Changed in nova:
milestone: havana-1 → 2013.2
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers