Confusing fault reasion when the flavors disk size was too small

Bug #1330856 reported by Attila Fazekas
32
This bug affects 5 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Thang Pham

Bug Description

Fedora-x86_64-20-20140407-sda has 2 GiB virtual size.

$ nova boot fed_1G_2 --image Fedora-x86_64-20-20140407-sda --flavor 1 --key-name mykey
$ nova show fed_1G_2
+--------------------------------------+------------------------------------------------------------------------------------------+
| Property | Value |
+--------------------------------------+------------------------------------------------------------------------------------------+
| OS-DCF:diskConfig | MANUAL |
| OS-EXT-AZ:availability_zone | nova |
| OS-EXT-STS:power_state | 0 |
| OS-EXT-STS:task_state | - |
| OS-EXT-STS:vm_state | error |
| OS-SRV-USG:launched_at | - |
| OS-SRV-USG:terminated_at | - |
| accessIPv4 | |
| accessIPv6 | |
| config_drive | |
| created | 2014-06-17T07:35:43Z |
| fault | {"message": "No valid host was found. ", "code": 500, "created": "2014-06-17T07:35:44Z"} |
| flavor | m1.tiny (1) |
| hostId | a904a292f4eb7f6735bef786c4a240a0b9240a6bc4f002519cb0e2b7 |
| id | 3c908a54-9682-40ad-8f12-a5bf64066660 |
| image | Fedora-x86_64-20-20140407-sda (085610a8-77ae-4bc8-9a28-3bcc1020e06e) |
| key_name | mykey |
| metadata | {} |
| name | fed_1G_2 |
| os-extended-volumes:volumes_attached | [] |
| private network | 10.1.0.5 |
| security_groups | default |
| status | ERROR |
| tenant_id | 1d26ad7003cf47e5b0107313be4832c3 |
| updated | 2014-06-17T07:35:44Z |
| user_id | bf52e56b9ca14648b391c5b6d490a0c1 |
+--------------------------------------+------------------------------------------------------------------------------------------+

$ # nova flavor-list
+-----+-----------+-----------+------+-----------+---------+-------+-------------+-----------+
| ID | Name | Memory_MB | Disk | Ephemeral | Swap_MB | VCPUs | RXTX_Factor | Is_Public |
+-----+-----------+-----------+------+-----------+---------+-------+-------------+-----------+
| 1 | m1.tiny | 512 | 1 | 0 | | 1 | 1.0 | True |
| 2 | m1.small | 2048 | 20 | 0 | | 1 | 1.0 | True |
| 3 | m1.medium | 4096 | 40 | 0 | | 2 | 1.0 | True |
| 4 | m1.large | 8192 | 80 | 0 | | 4 | 1.0 | True |
| 42 | m1.nano | 64 | 0 | 0 | | 1 | 1.0 | True |
| 451 | m1.heat | 1024 | 0 | 0 | | 2 | 1.0 | True |
| 5 | m1.xlarge | 16384 | 160 | 0 | | 8 | 1.0 | True |
| 84 | m1.micro | 128 | 0 | 0 | | 1 | 1.0 | True |
+-----+-----------+-----------+------+-----------+---------+-------+-------------+-----------+

Many images requires minimum 2,5,10 Gib as minimum disk size, the 1 used by m1.tiny is frequently not enough.
It might be increased to 10 or the original 0 should be restored.

This bug is about why I see 'message": "No valid host was found. ", "code": 500, "created": "2014-06-17T07:35:44Z"'
when "Flavor's disk is too small for requested image'" was raised on the n-cpu side.
It is confusing, 'No valid host was found' type of messages sounds like there is no n-cpu running, or all of them full.

instance: f62b56da-d1fa-4dc2-ae37-42b8fde3d3a5] Instance failed to spawn
 Traceback (most recent call last):
   File "/opt/stack/new/nova/nova/compute/manager.py", line 2064, in _build_resources
     yield resources
   File "/opt/stack/new/nova/nova/compute/manager.py", line 1966, in _build_and_run_instance
     block_device_info=block_device_info)
   File "/opt/stack/new/nova/nova/virt/libvirt/driver.py", line 2233, in spawn
     admin_pass=admin_password)
   File "/opt/stack/new/nova/nova/virt/libvirt/driver.py", line 2607, in _create_image
     project_id=instance['project_id'])
   File "/opt/stack/new/nova/nova/virt/libvirt/imagebackend.py", line 182, in cache
     *args, **kwargs)
   File "/opt/stack/new/nova/nova/virt/libvirt/imagebackend.py", line 374, in create_image
     prepare_template(target=base, max_size=size, *args, **kwargs)
   File "/opt/stack/new/nova/nova/openstack/common/lockutils.py", line 249, in inner
     return f(*args, **kwargs)
   File "/opt/stack/new/nova/nova/virt/libvirt/imagebackend.py", line 172, in fetch_func_sync
     fetch_func(target=target, *args, **kwargs)
   File "/opt/stack/new/nova/nova/virt/libvirt/utils.py", line 658, in fetch_image
     max_size=max_size)
   File "/opt/stack/new/nova/nova/virt/images.py", line 110, in fetch_to_raw
     raise exception.FlavorDiskTooSmall()
 FlavorDiskTooSmall: Flavor's disk is too small for requested image.

Tags: api
description: updated
Revision history for this message
Davanum Srinivas (DIMS) (dims-v) wrote :

Here's a theory:

We should catch the 3 Exceptions from _check_requested_image [1] in _build_and_run_instance [2] and NOT throw RescheduledException. Currently the FlavorDiskTooSmall ends up in the last Exception block which reschedules the deploy a few times and finally ends up throwing NoValidHost.

[1] https://github.com/openstack/nova/blob/master/nova/compute/api.py#L598
[2] https://github.com/openstack/nova/blob/master/nova/compute/manager.py#L1999

Thang Pham (thang-pham)
Changed in nova:
assignee: nobody → Thang Pham (thang-pham)
Tracy Jones (tjones-i)
tags: added: api
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/101090

Changed in nova:
status: New → In Progress
Thang Pham (thang-pham)
Changed in nova:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

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

commit da9891a30b3a3eac39458d829abdd5bc50cf876e
Author: Thang Pham <email address hidden>
Date: Thu Jun 19 00:19:13 2014 -0400

    Catch image and flavor exceptions in _build_and_run_instance

    If a user selects a flavor with a disk size that is smaller than
    the requested image, a FlavorDiskTooSmall exception is thrown.
    However, this exception is not specifically caught in
    _build_and_run_instance, but is caught as generic exception,
    causing a RescheduledException to be thrown. This forces the
    instance to be rescheduled a few times before finally throwing
    a NoValidHost exception. It causes confusion because the actual
    cause of it is that the disk size is smaller than the requested
    image. The following patch properly catches exceptions thrown by
    _check_requested_image in _build_and_run_instance.

    Change-Id: Ic8b435ba7e8721aa8ca54f29c1ad808833a7608d
    Closes-Bug: #1330856

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