Unable to boot from volume when flavor disk too small

Bug #1457517 reported by Favyen Bastani
48
This bug affects 8 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Matthew Booth
Kilo
Fix Released
Undecided
Unassigned
nova (Ubuntu)
Fix Released
High
Liang Chen
Vivid
Fix Released
High
Unassigned

Bug Description

[Impact]

 * Without the backport, booting from volume requires flavor disk size larger than volume size, which is wrong. This patch skips flavor disk size checking when booting from volume.

[Test Case]

 * 1. create a bootable volume
   2. boot from this bootable volume with a flavor that has disk size smaller than the volume size
   3. error should be reported complaining disk size too small
   4. apply this patch
   5. boot from that bootable volume with a flavor that has disk size smaller than the volume size again
   6. boot should succeed

[Regression Potential]

 * none

Version: 1:2015.1.0-0ubuntu1~cloud0 on Ubuntu 14.04

I attempt to boot an instance from a volume:

nova boot --nic net-id=[NET ID] --flavor v.512mb --block-device source=volume,dest=volume,id=[VOLUME ID],bus=virtio,device=vda,bootindex=0,shutdown=preserve vm

This results in nova-api raising a FlavorDiskTooSmall exception in the "_check_requested_image" function in compute/api.py. However, according to [1], the root disk limit should not apply to volumes.

[1] http://docs.openstack.org/admin-guide-cloud/content/customize-flavors.html

Log (first line is debug output I added showing that it's looking at the image that the volume was created from):

2015-05-21 10:28:00.586 25835 INFO nova.compute.api [req-1fb882c7-07ae-4c2b-86bd-3d174602d0ae f438b80d215c42efb7508c59dc80940c 8341c85ad9ae49408fa25074adba0480 - - -] image: {'min_disk': 0, 'status': 'active', 'min_ram': 0, 'properties': {u'container_format': u'bare', u'min_ram': u'0', u'disk_format': u'qcow2', u'image_name': u'Ubuntu 14.04 64-bit', u'image_id': u'cf0dffef-30ef-4032-add0-516e88048d85', u'libvirt_cpu_mode': u'host-passthrough', u'checksum': u'76a965427d2866f006ddd2aac66ed5b9', u'min_disk': u'0', u'size': u'255524864'}, 'size': 21474836480}
2015-05-21 10:28:00.587 25835 INFO nova.api.openstack.wsgi [req-1fb882c7-07ae-4c2b-86bd-3d174602d0ae f438b80d215c42efb7508c59dc80940c 8341c85ad9ae49408fa25074adba0480 - - -] HTTP exception thrown: Flavor's disk is too small for requested image.

Temporary solution: I have special flavor for volume-backed instances so I just set the root disk on those to 0, but this doesn't work if volume are used on other flavors.
Reproduce: create flavor with 1 GB root disk size, then try to boot an instance from a volume created from an image that is larger than 1 GB.

Related branches

description: updated
description: updated
description: updated
Revision history for this message
wangxiyuan (wangxiyuan) wrote :

it's confirmed.But I think we have to discuss whether it's a bug.
For example:
create a 2G bootable volume and the image is large than 1G(maybe 1.5G)
then the error "flavor disk too small" is ok.

wangxiyuan (wangxiyuan)
Changed in nova:
assignee: nobody → wangxiyuan (wangxiyuan)
Revision history for this message
Favyen Bastani (fbastani) wrote :

Hm, why is it okay in that case? The admin documentation I linked above indicates that the flavor root disk limit does not apply to volumes. It seems like it is fine if the flavor has root disk 1 GB but you want to boot a larger image from it.

Also I'm not certain whether it is comparing the image size against the flavor root disk limit, or comparing the volume size. If it is comparing the volume size then I think this is an even larger problem. But if it's image size it's still bad, since what if you have a 20 GB snapshot that you want to provision volume-backed instance from on a small flavor?

Revision history for this message
wangxiyuan (wangxiyuan) wrote :

You are right. There is no need to check the disk in flavor if boot from volume.

But in nova code, it is a common function :
https://github.com/openstack/nova/blob/master/nova/compute/api.py#L651

If boot from image,we must check it. So there is two ways to solve this problem.One is to check whether is boot from volume before _check_requested_image().The other one is to check it in _check_requested_image() to avoid it.

I have submit a patch about this problem with the second way.You can test whether it's solved or not :)

Revision history for this message
wangxiyuan (wangxiyuan) wrote :
Revision history for this message
Favyen Bastani (fbastani) wrote :

I looked at the patch, it seems like it still compares the size of the image that volume was created from with the flavor root disk size. I can understand why this check is needed for the min_ram / flavor memory, but why is it needed for the disk?

I'm afraid of situation where user creates a large snapshot, creates a volume from it, and then is unable to boot it from a flavor that has small memory / disk parameters.

Revision history for this message
wangxiyuan (wangxiyuan) wrote :

My patch just avoid raising FlavorDiskTooSmall error in some ways.

So,the best way is that we don't have to check disk size with flavor if booting from volume.

like this:
        if root_gb and not boot_from_volume: # add a judgment condition
            if int(image.get('size') or 0) > root_gb * (1024 ** 3):
                raise exception.FlavorDiskTooSmall()
            if int(image.get('min_disk') or 0) > root_gb:
                    raise exception.FlavorDiskTooSmall()

is it looks ok?

Changed in nova:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (master)

Change abandoned by wangxiyuan (<email address hidden>) on branch: master
Review: https://review.openstack.org/185322
Reason: I think We should have a discuess about how to check bdm in api side.

First of all,maybe we should fix RT's bug :

https://bugs.launchpad.net/nova/+bug/1334974

Revision history for this message
wangxiyuan (wangxiyuan) wrote :

This bug is similar to the one below :

https://bugs.launchpad.net/nova/+bug/1334974

and it's difficulte to reach an agreement about how to solve it.

so I hava abandoned the patch.You can follow it if you are interested .

Changed in nova:
assignee: wangxiyuan (wangxiyuan) → nobody
Revision history for this message
Markus Zoeller (markus_z) (mzoeller) wrote :

Solving an inconsistency: The bug is "in progress" but without an assignee.
I set the status back to "new" because of comment #8 (possible duplicate?).

Feel free to assign the bug to yourself. If you do so, please set it to
"in progress".

Changed in nova:
status: In Progress → New
tags: added: launch volumes
Changed in nova:
assignee: nobody → Feodor Tersin (ftersin)
status: New → In Progress
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/204635

Changed in nova:
assignee: Feodor Tersin (ftersin) → Matthew Booth (mbooth-9)
Changed in nova:
assignee: Matthew Booth (mbooth-9) → Daniel Berrange (berrange)
Changed in nova:
assignee: Daniel Berrange (berrange) → Matthew Booth (mbooth-9)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/204635
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=642c986f0636d52a9ba279c87e25082b4aa9b3b8
Submitter: Jenkins
Branch: master

commit 642c986f0636d52a9ba279c87e25082b4aa9b3b8
Author: Matthew Booth <email address hidden>
Date: Wed Jul 22 14:56:52 2015 +0100

    Don't check flavor disk size when booting from volume

    When creating a volume from an image, cinder copies the image metadata
    into volume properties. When booting from the volume, we read this
    metadata from the volume and use it as image metadata once again.

    While fixing the check against min_ram,
    change I861a78b5c7efa71e4bf7206d388b8d0d8048c78e introduced a
    regression which prevents a user from booting a volume which is larger
    than the flavor's disk. As we are not creating this disk, this check
    does not make sense. Similarly, it checks the image metadata's
    min_disk against the flavor disk size, which is not being used.

    This change leaves the image metadata check unaltered when creating a
    flavor disk. When booting from a volume, we check min_disk from image
    metadata against the actual size of the volume. We don't check the
    volume size at all. The check against min_ram is retained unaltered.

    Closes-Bug: #1457517
    Closes-Bug: #1459491
    Closes-Bug: #1466305
    Change-Id: I264493172da20b664df571e32876030246c2a87c

Changed in nova:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (master)

Change abandoned by Feodor Tersin (<email address hidden>) on branch: master
Review: https://review.openstack.org/196569

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/kilo)

Fix proposed to branch: stable/kilo
Review: https://review.openstack.org/213308

Liang Chen (cbjchen)
tags: added: sts
Liang Chen (cbjchen)
description: updated
Changed in nova (Ubuntu):
assignee: nobody → Liang Chen (cbjchen)
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in nova (Ubuntu):
status: New → Confirmed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/kilo)

Reviewed: https://review.openstack.org/213308
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=8794b938dcb983b7c918718807c2396cb255b4ce
Submitter: Jenkins
Branch: stable/kilo

commit 8794b938dcb983b7c918718807c2396cb255b4ce
Author: Matthew Booth <email address hidden>
Date: Wed Jul 22 14:56:52 2015 +0100

    Don't check flavor disk size when booting from volume

    When creating a volume from an image, cinder copies the image metadata
    into volume properties. When booting from the volume, we read this
    metadata from the volume and use it as image metadata once again.

    While fixing the check against min_ram,
    change I861a78b5c7efa71e4bf7206d388b8d0d8048c78e introduced a
    regression which prevents a user from booting a volume which is larger
    than the flavor's disk. As we are not creating this disk, this check
    does not make sense. Similarly, it checks the image metadata's
    min_disk against the flavor disk size, which is not being used.

    This change leaves the image metadata check unaltered when creating a
    flavor disk. When booting from a volume, we check min_disk from image
    metadata against the actual size of the volume. We don't check the
    volume size at all. The check against min_ram is retained unaltered.

    Closes-Bug: #1457517
    Closes-Bug: #1459491
    Closes-Bug: #1466305
    Change-Id: I264493172da20b664df571e32876030246c2a87c
    (cherry picked from commit 642c986f0636d52a9ba279c87e25082b4aa9b3b8)

tags: added: in-stable-kilo
Thierry Carrez (ttx)
Changed in nova:
milestone: none → liberty-3
status: Fix Committed → Fix Released
Chuck Short (zulcss)
Changed in nova (Ubuntu):
milestone: none → vivid-updates
milestone: vivid-updates → none
Revision history for this message
Billy Olsen (billy-olsen) wrote :

Adding debdiff, which is also available in the ubuntu vivid upload queue (merged into lp:~ubuntu-server-dev/nova/vivid)

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

This fix is in the current wily package, so marking fix released there.

Changed in nova (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Pushed the debdiff from comment #16 to New sru queue - thanks.

Changed in nova (Ubuntu Vivid):
importance: Undecided → High
Changed in nova (Ubuntu):
importance: Undecided → High
Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello Favyen, or anyone else affected,

Accepted nova into vivid-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/nova/1:2015.1.1-0ubuntu2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in nova (Ubuntu Vivid):
status: New → Fix Committed
tags: added: verification-needed
Revision history for this message
Billy Olsen (billy-olsen) wrote :

I was able to verify this bug fix today by the following:

1. Setup a vivid-kilo openstack cloud
2. Create a 5G volume from a cirros image
3. Boot an m1.tiny instance using the 5G volume created as the boot source,
   --> verify command is rejected due to size issue
4. Log into nova-cloud-controller and upgrade nova-* packages to version 1:2015.1.1-0ubuntu2 from the proposed pocket.
5. Boot an m1.tiny instance using the %G volume created as the boot source
  --> verify command is accepted and instance boots

tags: added: verification-done
removed: verification-needed
Revision history for this message
Chris J Arges (arges) wrote : Update Released

The verification of the Stable Release Update for nova has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package nova - 1:2015.1.1-0ubuntu2

---------------
nova (1:2015.1.1-0ubuntu2) vivid; urgency=medium

  [ Corey Bryant ]
  * d/rules: Prevent dh_python2 from guessing dependencies.

  [ Liang Chen ]
  * d/p/not-check-disk-size.patch: Fix booting from volume error
    when flavor disk too small (LP: #1457517)

 -- Corey Bryant <email address hidden> Thu, 13 Aug 2015 15:13:43 -0400

Changed in nova (Ubuntu Vivid):
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: liberty-3 → 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.